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() { @@ -162,7 +162,7 @@ decompress_initramfs() {
# initramfs. The current directory must be the root of the uncompressed
# initramfs. The unsorted list of files is output to stdout.
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
}

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

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

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

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

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
}

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

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
}

@ -426,26 +432,24 @@ remove_weak_link_quiet() { @@ -426,26 +432,24 @@ remove_weak_link_quiet() {
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
# and depmod config to operate on it.
# Sets the global state accordingly

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

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

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

mkdir -p "$dir"
# 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"

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


# finish_dry_run:
# restore global state after dry_run changes
finish_dry_run() {
# finish_sandbox:
# restore global state after sandboxing
# 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=""
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() { @@ -482,30 +500,23 @@ finish_dry_run() {
update_modules_for_krel() {
local krel="$1"
local func="$2"
local do_fallback="$3"
local force_update="$3"

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

prepare_for_dry_run $krel
prepare_sandbox $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

global_link_state_announce_changes $krel

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

finish_dry_run
finish_sandbox $krel
}

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

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

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

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

update_modules remove_weak_links $no_fallback
update_modules remove_weak_links force_update
}

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

update_modules add_weak_links $no_force_update
}

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

tmp=$(mktemp -p $tmpdir)

@ -812,7 +822,7 @@ add_kernel() { @@ -812,7 +822,7 @@ add_kernel() {
read_modules_list < $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() {

49
SPECS/kmod.spec

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

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

%changelog
* Wed Dec 13 2017 Yauheni Kaliuta <ykaliuta@redhat.com> - 20-15.el7_4.7
- depmod: module_is_higher_priority: fix modname length calculation.
Resolves: rhbz#1525364.
* Tue Aug 28 2018 Yauheni Kaliuta <ykaliuta@redhat.com> - 20-23
- weak-modules: fix initial state creation for dry-run
- 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
- Backport external directories support.
Related: rhbz#1511943.
* Fri Dec 8 2017 Yauheni Kaliuta <ykaliuta@redhat.com> - 20-21
- depmod: module_is_higher_priority: fix modname length calculation.
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: 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
- bump up version for internal reasons.
Related: rhbz#1489696.
* Thu Sep 14 2017 Yauheni Kaliuta <ykaliuta@redhat.com> - 20-19
- weak-modules: fix dry-run for non-lib-modules installation
Resolves: rhbz#1477073

* Thu Sep 14 2017 Yauheni Kaliuta <ykaliuta@redhat.com> - 20-15.el7_4.3
- weak-modules: implement dry run by symlink restoration.
- weak-modules: fix dry-run for non-lib-modules installation.
Resolves: rhbz#1489696.
* Thu Aug 17 2017 Yauheni Kaliuta <ykaliuta@redhat.com> - 20-18
- depmod: external directories support.
Resolves: rhbz#1361857
- 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.
- 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
- weak-modules: fallback weak-modules state if incompatible installed
Resolves: rhbz#1469990
* Wed Jul 12 2017 Yauheni Kaliuta <ykaliuta@redhat.com> - 20-16
- weak-modules: fallback weak-modules state if incompatible installed.
Resolved: rhbz#1468042

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

Loading…
Cancel
Save