aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2007-08-25 18:23:04 +0000
committerOlivier Blin <oblin@mandriva.com>2007-08-25 18:23:04 +0000
commita2ee6a6b2b1bb5bc44df4c91858c3f68e99f6c19 (patch)
tree6916caa3a899a86ddbd1e99e43232648b2c15e53
parentd47bdd8c207d2c6d23144844db62b00c8991a03a (diff)
downloadrpm-setup-a2ee6a6b2b1bb5bc44df4c91858c3f68e99f6c19.tar
rpm-setup-a2ee6a6b2b1bb5bc44df4c91858c3f68e99f6c19.tar.gz
rpm-setup-a2ee6a6b2b1bb5bc44df4c91858c3f68e99f6c19.tar.bz2
rpm-setup-a2ee6a6b2b1bb5bc44df4c91858c3f68e99f6c19.tar.xz
rpm-setup-a2ee6a6b2b1bb5bc44df4c91858c3f68e99f6c19.zip
add automatic kmod provides (based on work from Danny Tholen)
-rw-r--r--Makefile.am1
-rwxr-xr-xfind-provides.in5
-rwxr-xr-xkmod.prov13
3 files changed, 19 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 31bc3fd..32b8587 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -25,6 +25,7 @@ pkg_scripts = \
http.req \
magic.prov \
magic.req \
+ kmod.prov \
perl.prov \
perl.req \
php.prov \
diff --git a/find-provides.in b/find-provides.in
index 105af38..d45d44a 100755
--- a/find-provides.in
+++ b/find-provides.in
@@ -64,6 +64,11 @@ done | sort -u
echo "$filelist" | tr '[:blank:]' \\n | @RPMVENDORDIR@/php.prov | sort -u
#
+# --- Kernel modules.
+[ -x @RPMVENDORDIR@/php.prov ] &&
+ echo "$filelist" | tr '[:blank:]' \\n | @RPMVENDORDIR@/kmod.prov | sort -u
+
+#
# --- Pkgconfig deps
[ -x @RPMVENDORDIR@/pkgconfigdeps.sh ] &&
echo "$filelist" | tr '[:blank:]' \\n | @RPMVENDORDIR@/pkgconfigdeps.sh -P | sort -u
diff --git a/kmod.prov b/kmod.prov
new file mode 100755
index 0000000..f378ec3
--- /dev/null
+++ b/kmod.prov
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+provideslist=`sed "s/['\"]/\\\&/g"`
+modulelist=$(echo "$provideslist" | egrep '^.*(/lib/modules/|/var/lib/dkms/).*\.ko(\.gz)?$')
+echo $modulelist | xargs -r /sbin/modinfo | \
+ perl -lne '
+$name = $1 if m!^filename:.*\b([^/]+)\.k?o!;
+$ver = $1 if /^version:\s*[a-zA-Z]{0,6}\-?(\d+[\.\:\-\[\]]?\d*[\.\:\-\[\]]?\d*[\.\:\-\[\]]?\d*[\.\:\-\[\]]?\d*-?[a-zA-Z]{0,6}\d?).*/;
+if (/^srcversion:/) {
+ print "kmod\($name\) = $ver" if $name && $ver;
+ undef $name, $ver;
+}
+'