public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Eric Chanudet <echanude@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/kmod] rawhide: weak-modules: updates/ directory for out-of-tree modules
Date: Wed, 28 Oct 2026 19:35:42 GMT	[thread overview]
Message-ID: <179321614243.1.10818847684768799515.rpms-kmod-ea92cdd293e5@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/kmod
            Branch : rawhide
            Commit : ea92cdd293e553bba9a9fefa7aaa25eed2f03b82
            Author : Eric Chanudet <echanude@redhat.com>
            Date   : 2026-10-28T10:29:05-04:00
            Stats  : +31/-24 in 1 file(s)
            URL    : https://src.fedoraproject.org/rpms/kmod/c/ea92cdd293e553bba9a9fefa7aaa25eed2f03b82?branch=rawhide

            Log:
            weak-modules: updates/ directory for out-of-tree modules

extra hasn't been used as a default for quite some time now. It was
changed back in 2022:
    b74d7bb7ca24 ("kbuild: Modify default INSTALL_MOD_DIR from extra to updates")
and as the commit mentions, kmod is now default and has always used
"updates" for directory.

Keep extra in the search path for retrocompatibility, but add updates to
search for weak-modules that are kABI compatible. The symlink will lead
to extra/ or updates/.

Signed-off-by: Eric Chanudet <echanude@redhat.com>

---
diff --git a/weak-modules b/weak-modules
index 6dd9340..fce27fc 100644
--- a/weak-modules
+++ b/weak-modules
@@ -355,17 +355,19 @@ is_weak_link() {
     [[ -L $link ]]
 }
 
-# is_extra_exists:
+# has_outoftree_module:
 # Takes a module filename, the module's kernel release and target kernel release.
-# The module filename should be a real, not a symlink, filename (i.e. in extra/).
+# The module filename should be a real, not a symlink, filename (i.e. in extra/, updates/).
 # Returns 'true' if the same module exists for the target kernel.
-is_extra_exists() {
+has_outoftree_module() {
     local module="$1"
     local module_krel="$2"
     local krel="$3"
     local subpath="${module#*/lib/modules/$module_krel/extra/}"
+    [[ "$subpath" = "$module" ]] && subpath="${module#*/lib/modules/$module_krel/updates/}"
 
-    [[ -f $BASEDIR/lib/modules/$krel/extra/$subpath ]]
+    [[ -f $BASEDIR/lib/modules/$krel/extra/$subpath ]] || \
+    [[ -f $BASEDIR/lib/modules/$krel/updates/$subpath ]]
 }
 
 is_kernel_installed() {
@@ -416,16 +418,21 @@ find_installed_kernels() {
     ls $BASEDIR/lib/modules/
 }
 
-# find_kernels_with_extra:
-# Produces list of kernels, where exists extra/ directory
-find_kernels_with_extra() {
+# find_kernels_with_outoftree:
+# Produces list of kernels where directories extra/ or updates/ exist and
+# contain compatible modules.
+find_kernels_with_outoftree() {
     local krel
-    local extra_dir
+    local extra_dir updates_dir
+    local outoftree_kos=()
 
     for krel in $(find_installed_kernels); do
         extra_dir="$BASEDIR/lib/modules/$krel/extra"
-        [[ -d "$extra_dir" ]] || continue
-        echo "$krel"
+        updates_dir="$BASEDIR/lib/modules/$krel/updates"
+        outoftree_kos=($(find_modules "$krel" extra) $(find_modules "$krel" updates))
+        if [[ ${#outoftree_kos[@]} -gt 0 ]]; then
+            echo "$krel"
+        fi
     done
 }
 
@@ -465,7 +472,7 @@ prepare_sandbox() {
     weak_updates_dir_override="$dir"
 
     #config
-    echo "search external extra built-in weak-updates" >"$conf"
+    echo "search external updates extra built-in weak-updates" >"$conf"
     echo "external * $dir" >>"$conf"
 
     depmod="$depmod_orig -C $conf"
@@ -678,7 +685,7 @@ add_weak_links() {
                 continue ;;
         esac
 
-        if is_extra_exists $module $module_krel $krel; then
+        if has_outoftree_module "$module" "$module_krel" "$krel"; then
             pr_verbose "found $(module_short_name $module) for $krel while installing for $module_krel, update case?"
         fi
 
@@ -915,7 +922,7 @@ global_link_state_announce_changes() {
 # Parameter (noreplace) is deprecated, acts always as "noreplace".
 # There is no sense in the "replace" functionality since according
 # to the current requirements RPM will track existing of only one version
-# of extra/ module (no same extra/ modules for different kernels).
+# of extra/ or updates/ module (no same extra/ or updates/ modules for different kernels).
 remove_modules() {
     update_modules remove_weak_links force_update
 }
@@ -937,7 +944,7 @@ add_modules() {
 # produces groups associative array
 # the group is a maximum subset of modules having at least a link
 #
-# more fine tuned extra filtering.
+# more fine tuned out-of-tree modules filtering.
 do_make_groups()
 {
     local tmp="$1"
@@ -948,7 +955,7 @@ do_make_groups()
     while read i; do
         read -a mods <<< "$i"
 
-        echo "${mods[0]}" |grep -q "extra/" || continue
+        echo "${mods[0]}" |grep -q "/\(extra\|updates\)/" || continue
 
         # if the module already met, then its dependencies already counted
         module_group="${grouped_modules[${mods[0]}]}"
@@ -958,7 +965,7 @@ do_make_groups()
         group_name="${mods[0]}"
 
         for mod in "${mods[@]}"; do
-            echo "$mod" |grep -q "extra/" || continue
+            echo "$mod" |grep -q "/\(extra\|updates\)/" || continue
 
             # if there is already such group,
             # it is a subset of the one being created
@@ -982,21 +989,21 @@ cut_depmod_deps()
     awk 'BEGIN { pr = 1 } /^#/{ pr = 0 } pr == 1 {sub(":",""); print $0}'
 }
 
-# filter_extra_absoluted:
+# filter_outoftree_absoluted:
 # Takes kernel version
 # makes full path from the relative module path
 # (produced by depmod for in-kernel-dir modules)
-# filter only extra/ modules
-filter_extra_absoluted()
+# filter only extra/ or updates/ modules
+filter_outoftree_absoluted()
 {
     local kver="$1"
     local mod
     declare -a mods
 
     while read i; do
-        # skip non-extra. The check is not perfect, but ok
+        # skip non extra or updates. The check is not perfect, but ok
         # to speed up handling in general cases
-        echo "$i" |grep -q "extra/" || continue
+        echo "$i" |grep -q "^\(extra\|updates\)/" || continue
 
         read -a mods <<< "$i"
         for j in "${!mods[@]}"; do
@@ -1023,7 +1030,7 @@ make_groups()
     grouped_modules=()
 
     $depmod -n $basedir $k 2>/dev/null |
-        cut_depmod_deps | filter_extra_absoluted $k > $tmp2
+        cut_depmod_deps | filter_outoftree_absoluted $k > $tmp2
 
     do_make_groups $tmp2
 
@@ -1044,9 +1051,9 @@ add_kernel() {
         exit 1
     fi
 
-    for k in $(find_kernels_with_extra | rpmsort -r); do
+    for k in $(find_kernels_with_outoftree | rpmsort -r); do
         [[ "$krel" == "$k" ]] && continue
-        find_modules $k extra > $tmp
+        find_modules $k extra updates > $tmp
 
         is_empty_file "$tmp" || make_groups $k
 

                 reply	other threads:[~2026-10-28 19:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179321614243.1.10818847684768799515.rpms-kmod-ea92cdd293e5@fedoraproject.org \
    --to=echanude@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox