Blame SOURCES/kmod.attr

936cd0
%__kmod_path           ^/lib/modules/.*/(modules.builtin|.*\.ko|.*\.ko\.gz|.*\.ko\.bz2|.*\.ko\.xz|.*\.ko\.zst)$
67e50c
%__kmod_provides() %{lua:
67e50c
  function basename(fn)
67e50c
      return string.gsub(fn, "(.*/)(.*)", "%2")
67e50c
  end
936cd0
  function strip_compress_sfx(fn)
936cd0
      return string.gsub(fn, "(.*)(\.gz|\.bz2|\.xz|\.zst)?$", "%1")
936cd0
  end
67e50c
  function printdep(mod)
936cd0
      print("kmod("..mod..") ")
67e50c
  end
67e50c
  local fn = rpm.expand("%{1}")
67e50c
  local bn = basename(fn)
67e50c
  if bn == "modules.builtin" then
67e50c
      for l in io.lines(fn) do
936cd0
          local builtin_mod = basename(l)
936cd0
          printdep(builtin_mod)
936cd0
          if strip_compress_sfx(builtin_mod) ~= builtin_mod then
936cd0
              printdep(strip_compress_sfx(builtin_mod))
936cd0
          end
67e50c
      end
67e50c
  else
67e50c
      local mod = string.match(bn, "%g+.ko")
67e50c
      if mod then
67e50c
         printdep(mod)
936cd0
         if strip_compress_sfx(mod) ~= mod then
936cd0
             printdep(strip_compress_sfx(mod))
936cd0
         end
67e50c
      end
67e50c
  end
67e50c
}