Browse Source

kmod package update

Signed-off-by: basebuilder_pel7x64builder0 <basebuilder@powerel.org>
master
basebuilder_pel7x64builder0 6 years ago
parent
commit
b758f5b5ff
  1. 74
      SOURCES/weak-modules
  2. 49
      SPECS/kmod.spec

74
SOURCES/weak-modules

@ -162,7 +162,7 @@ decompress_initramfs() {
# initramfs. The current directory must be the root of the uncompressed # initramfs. The current directory must be the root of the uncompressed
# initramfs. The unsorted list of files is output to stdout. # initramfs. The unsorted list of files is output to stdout.
list_module_files() { list_module_files() {
find . -iname \*.ko 2>/dev/null find . -iname \*.ko -o -iname '*.ko.xz' -o -iname '*.ko.gz' 2>/dev/null
find etc/modprobe.d usr/lib/modprobe.d -name \*.conf 2>/dev/null find etc/modprobe.d usr/lib/modprobe.d -name \*.conf 2>/dev/null
} }


@ -280,8 +280,11 @@ EOF
module_has_changed() { module_has_changed() {


declare module=$1 krel=$2 declare module=$1 krel=$2
declare orig_module=$module


module=${module%.ko} module=${module%.ko}
[[ $module == $orig_module ]] && module=${module%.ko.xz}
[[ $module == $orig_module ]] && module=${module%.ko.gz}
module=${module##*/} module=${module##*/}


eval "changed_modules_${krel//[^a-zA-Z0-9]/_}=$krel" eval "changed_modules_${krel//[^a-zA-Z0-9]/_}=$krel"
@ -378,7 +381,9 @@ find_modules() {
local dirs="$*" local dirs="$*"


for dir in $dirs; do for dir in $dirs; do
find $BASEDIR/lib/modules/$krel/$dir -name '*.ko' 2>/dev/null find $BASEDIR/lib/modules/$krel/$dir \
-name '*.ko' -o -name '*.ko.xz' -o -name '*.ko.gz' \
2>/dev/null
done done
} }


@ -389,7 +394,8 @@ find_modules_dirs() {
local dirs="$*" local dirs="$*"


for dir in $dirs; do for dir in $dirs; do
find $dir -name '*.ko' 2>/dev/null find $dir -name '*.ko' -o -name '*.ko.xz' -o -name '*.ko.gz' \
2>/dev/null
done done
} }


@ -426,26 +432,24 @@ remove_weak_link_quiet() {
rmdir --parents --ignore-fail-on-non-empty "$(dirname "${subpath#/}")" 2>/dev/null ) rmdir --parents --ignore-fail-on-non-empty "$(dirname "${subpath#/}")" 2>/dev/null )
} }


# prepare_for_dry_run: # prepare_sandbox:
# Takes kernel release, creates temporary weak-modules directory for it # Takes kernel release, creates temporary weak-modules directory for it
# and depmod config to operate on it. # and depmod config to operate on it.
# Sets the global state accordingly # Sets the global state accordingly


prepare_for_dry_run() { prepare_sandbox() {
local krel="$1" local krel="$1"
local orig_dir local orig_dir
local dir local dir
local conf="$tmpdir/depmod.conf" local conf="$tmpdir/depmod.conf"


[[ -z "$dry_run" ]] && return

#directory #directory
orig_dir=$(weak_updates_dir $krel) orig_dir=$(weak_updates_dir $krel)
dir="$tmpdir/$krel/weak-updates" dir="$tmpdir/$krel/weak-updates"


mkdir -p "$dir" mkdir -p "$dir"
# the orig_dir can be empty # the orig_dir can be empty
cp -R "$orig_dir/*" "$dir" 2>/dev/null cp -R "$orig_dir"/* "$dir" 2>/dev/null


weak_updates_dir_override="$dir" weak_updates_dir_override="$dir"


@ -457,11 +461,25 @@ prepare_for_dry_run() {
} }




# finish_dry_run: # finish_sandbox:
# restore global state after dry_run changes # restore global state after sandboxing
finish_dry_run() { # copy configuration to the kernel directory if not dry run
finish_sandbox() {
local krel="$1"
local override="$weak_updates_dir_override"
local wa_dir

weak_updates_dir_override="" weak_updates_dir_override=""
depmod="$depmod_orig" depmod="$depmod_orig"

[[ -n "$dry_run" ]] && return

wa_dir="$(weak_updates_dir $krel)"

rm -rf "$wa_dir"
mkdir -p "$wa_dir"

cp -R "${override}"/* "$wa_dir" 2>/dev/null
} }




@ -482,30 +500,23 @@ finish_dry_run() {
update_modules_for_krel() { update_modules_for_krel() {
local krel="$1" local krel="$1"
local func="$2" local func="$2"
local do_fallback="$3" local force_update="$3"


[[ -r "$BASEDIR/boot/symvers-$krel.gz" ]] || return [[ -r "$BASEDIR/boot/symvers-$krel.gz" ]] || return


prepare_for_dry_run $krel prepare_sandbox $krel


global_link_state_save $krel global_link_state_save $krel
$func $krel
if ! validate_weak_links $krel && [[ -n "$do_fallback" ]]; then
global_link_state_restore $krel


finish_dry_run $func $krel


return; if ! validate_weak_links $krel && [[ -z "$force_update" ]]; then
global_link_state_restore $krel
fi fi


global_link_state_announce_changes $krel global_link_state_announce_changes $krel


if [[ -n "$dry_run" ]]; then finish_sandbox $krel
pr_verbose "Dry run: restoring configuration"
global_link_state_restore $krel
fi

finish_dry_run
} }


# update_modules: # update_modules:
@ -516,14 +527,14 @@ update_modules_for_krel() {
# Triggers initrd rebuild for the kernels, which modules are installed. # Triggers initrd rebuild for the kernels, which modules are installed.
update_modules() { update_modules() {
local func="$1" local func="$1"
local do_fallback="$2" local force_update="$2"
local module_krel local module_krel


read_modules_list || exit 1 read_modules_list || exit 1
[[ ${#modules[@]} -gt 0 ]] || return [[ ${#modules[@]} -gt 0 ]] || return


for krel in $(find_installed_kernels); do for krel in $(find_installed_kernels); do
update_modules_for_krel $krel $func $do_fallback update_modules_for_krel $krel $func $force_update
done done


for module in "${modules[@]}"; do for module in "${modules[@]}"; do
@ -778,22 +789,21 @@ global_link_state_announce_changes() {
# to the current requirements RPM will track existing of only one version # to the current requirements RPM will track existing of only one version
# of extra/ module (no same extra/ modules for different kernels). # of extra/ module (no same extra/ modules for different kernels).
remove_modules() { remove_modules() {
local no_fallback="" update_modules remove_weak_links force_update

update_modules remove_weak_links $no_fallback
} }


# add_modules: # add_modules:
# Read in a list of modules from stdinput and process them for compatibility # Read in a list of modules from stdinput and process them for compatibility
# with installed kernels under /lib/modules. # with installed kernels under /lib/modules.
add_modules() { add_modules() {
update_modules add_weak_links do_fallback no_force_update=""

update_modules add_weak_links $no_force_update
} }


add_kernel() { add_kernel() {
local krel=${1:-$(uname -r)} local krel=${1:-$(uname -r)}
local tmp local tmp
local no_fallback=""


tmp=$(mktemp -p $tmpdir) tmp=$(mktemp -p $tmpdir)


@ -812,7 +822,7 @@ add_kernel() {
read_modules_list < $tmp read_modules_list < $tmp
rm -f $tmp rm -f $tmp


update_modules_for_krel $krel add_weak_links $no_fallback update_modules_for_krel $krel add_weak_links force_update
} }


remove_kernel() { remove_kernel() {

49
SPECS/kmod.spec

@ -1,6 +1,6 @@
Name: kmod Name: kmod
Version: 20 Version: 20
Release: 15%{?dist}.7 Release: 23%{?dist}
Summary: Linux kernel module management utilities Summary: Linux kernel module management utilities


Group: System Environment/Kernel Group: System Environment/Kernel
@ -138,36 +138,43 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf
%{_libdir}/libkmod.so %{_libdir}/libkmod.so


%changelog %changelog
* Wed Dec 13 2017 Yauheni Kaliuta <ykaliuta@redhat.com> - 20-15.el7_4.7 * Tue Aug 28 2018 Yauheni Kaliuta <ykaliuta@redhat.com> - 20-23
- depmod: module_is_higher_priority: fix modname length calculation. - weak-modules: fix initial state creation for dry-run
Resolves: rhbz#1525364. - weak-modules: check compatibility in a temporary directory
Resolves: rhbz#1619889.

* Thu Jun 21 2018 Yauheni Kaliuta <ykaliuta@redhat.com> - 20-22
- weak-modules: add compressed modules support.
Resolves: rhbz#1593448


* Thu Nov 16 2017 Yauheni Kaliuta <ykaliuta@redhat.com> - 20-15.el7_4.6 * Fri Dec 8 2017 Yauheni Kaliuta <ykaliuta@redhat.com> - 20-21
- Backport external directories support. - depmod: module_is_higher_priority: fix modname length calculation.
Related: rhbz#1511943. Resolves: rhbz#1522994


* Fri Nov 10 2017 Yauheni Kaliuta <ykaliuta@redhat.com> - 20-15.el7_4.5 * Thu Nov 9 2017 Yauheni Kaliuta <ykaliuta@redhat.com> - 20-20
- weak-modules: use function to generate weak_updates_dir - weak-modules: use function to generate weak_updates_dir
- weak-modules: implement dry-run on the tempdir - weak-modules: implement dry-run on the tempdir
Resolves: rhbz#1511943. Resolves: rhbz#1510058


* Fri Sep 15 2017 Yauheni Kaliuta <ykaliuta@redhat.com> - 20-15.el7_4.4 * Thu Sep 14 2017 Yauheni Kaliuta <ykaliuta@redhat.com> - 20-19
- bump up version for internal reasons. - weak-modules: fix dry-run for non-lib-modules installation
Related: rhbz#1489696. Resolves: rhbz#1477073


* Thu Sep 14 2017 Yauheni Kaliuta <ykaliuta@redhat.com> - 20-15.el7_4.3 * Thu Aug 17 2017 Yauheni Kaliuta <ykaliuta@redhat.com> - 20-18
- weak-modules: implement dry run by symlink restoration. - depmod: external directories support.
- weak-modules: fix dry-run for non-lib-modules installation. Resolves: rhbz#1361857
Resolves: rhbz#1489696. - BuildRequires automake autoconf libtool.


* Thu Aug 17 2017 Yauheni Kaliuta <ykaliuta@redhat.com> - 20-15.el7_4.2 * Mon Aug 7 2017 Yauheni Kaliuta <ykaliuta@redhat.com> - 20-17
- libkmod-elf: resolve CRC if module is built with MODULE_REL_CRCS. - libkmod-elf: resolve CRC if module is built with MODULE_REL_CRCS.
- weak-modules: process only weak-updates related depmod output. - weak-modules: process only weak-updates related depmod output.
Resolves: rhbz#1482385 Resolves: rhbz#1468305
- weak-modules: implement dry run by symlink restoration.
Resolves: rhbz#1477073


* Wed Jul 12 2017 Yauheni Kaliuta <ykaliuta@redhat.com> - 20-15.el7_4.1 * Wed Jul 12 2017 Yauheni Kaliuta <ykaliuta@redhat.com> - 20-16
- weak-modules: fallback weak-modules state if incompatible installed - weak-modules: fallback weak-modules state if incompatible installed.
Resolves: rhbz#1469990 Resolved: rhbz#1468042


* Fri May 12 2017 Yauheni Kaliuta <ykaliuta@redhat.com> - 20-15 * Fri May 12 2017 Yauheni Kaliuta <ykaliuta@redhat.com> - 20-15
- weak-modules: install weak link even if there is same name in extra. - weak-modules: install weak link even if there is same name in extra.

Loading…
Cancel
Save