Blame SOURCES/kmod.attr

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