diff --git a/SOURCES/weak-modules b/SOURCES/weak-modules index 324edb2..4df7642 100644 --- a/SOURCES/weak-modules +++ b/SOURCES/weak-modules @@ -544,7 +544,10 @@ update_modules_for_krel() { discard_installed # do not run heavy validation procedure if no modules to install - [[ "${#modules[@]}" -eq 0 ]] && return + if [[ "${#modules[@]}" -eq 0 ]]; then + finish_sandbox $krel + return + fi $func $krel @@ -854,9 +857,12 @@ add_modules() { # do_make_groups: # Takes tmp file which contains preprocessed modules.dep # output (or modules.dep) +# # reads modules.dep format information from stdin # produces groups associative array # the group is a maximum subset of modules having at least a link +# +# more fine tuned extra filtering. do_make_groups() { local tmp="$1" @@ -867,6 +873,8 @@ do_make_groups() while read i; do mods=($i) + echo "${mods[0]}" |grep -q "extra/" || continue + # if the module already met, then its dependencies already counted module_group="${grouped_modules[${mods[0]}]}" [[ -n $module_group ]] && continue @@ -875,6 +883,8 @@ do_make_groups() group_name="${mods[0]}" for mod in "${mods[@]}"; do + echo "$mod" |grep -q "extra/" || continue + # if there is already such group, # it is a subset of the one being created # due to depmod output @@ -892,26 +902,32 @@ do_make_groups() # preprocess output for make_groups # depmod -n produces also aliases, so it cuts them off # also it removes colon after the first module -filter_depmod_deps() +cut_depmod_deps() { awk 'BEGIN { pr = 1 } /^#/{ pr = 0 } pr == 1 {sub(":",""); print $0}' } -# make_abs_path: +# filter_extra_absoluted: # Takes kernel version # makes full path from the relative module path # (produced by depmod for in-kernel-dir modules) -make_abs_path() +# filter only extra/ modules +filter_extra_absoluted() { local kver="$1" local mod declare -a mods while read i; do + # skip non-extra. The check is not perfect, but ok + # to speed up handling in general cases + echo "$i" |grep -q "extra/" || continue + mods=($i) for j in "${!mods[@]}"; do mod="${mods[$j]}" - [[ ${mod:0:1} == "/" ]] || mod="/lib/modules/$kver/$mod" + + [[ ${mod:0:1} == "/" ]] || mod="$BASEDIR/lib/modules/$kver/$mod" mods[$j]="$mod" done echo "${mods[@]}" @@ -919,20 +935,20 @@ make_abs_path() } # make_groups: -# takes krel and a file with the list of modules, +# takes k -- kernel version, we are installing extras from # prepares and feeds to do_make_groups # to create the module groups (global) make_groups() { - local krel="$1" - local tmp1="$2" + local k="$1" local tmp2=$(mktemp -p $tmpdir) + local basedir=${BASEDIR:+-b $BASEDIR} groups=() grouped_modules=() - $depmod -n $krel $(cat $tmp1) 2>/dev/null | - filter_depmod_deps | make_abs_path $krel > $tmp2 + $depmod -n $basedir $k 2>/dev/null | + cut_depmod_deps | filter_extra_absoluted $k > $tmp2 do_make_groups $tmp2 @@ -957,7 +973,7 @@ add_kernel() { [[ "$krel" == "$k" ]] && continue find_modules $k extra > $tmp - is_empty_file "$tmp" || make_groups $krel $tmp + is_empty_file "$tmp" || make_groups $k # reuse tmp diff --git a/SPECS/kmod.spec b/SPECS/kmod.spec index 67dddfb..ffa3cd2 100644 --- a/SPECS/kmod.spec +++ b/SPECS/kmod.spec @@ -1,6 +1,6 @@ Name: kmod Version: 20 -Release: 27%{?dist} +Release: 28%{?dist} Summary: Linux kernel module management utilities Group: System Environment/Kernel @@ -138,6 +138,11 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Mon Dec 2 2019 Yauheni Kaliuta - 20-28 +- weak-modules: update_modules_for_krel: always finish sandbox +- weak-modules: groupping: use dependencies of extra/ provider + Resolves: rhbz#1774925 + * Tue Sep 24 2019 Yauheni Kaliuta - 20-27 - weak-modules: reverse checking order for add-kernel Resolves: rhbz#1752902