[packages/rpm-pld-macros] - 2.001 - add kmod-deps.sh script from rpm5
baggins
baggins at pld-linux.org
Thu Feb 25 20:16:00 CET 2021
commit 74f369681c39a62e62f3d18e345dd09df3fafc36
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Thu Feb 25 20:15:34 2021 +0100
- 2.001
- add kmod-deps.sh script from rpm5
kmod-deps.sh | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++
rpm-pld-macros.spec | 7 ++++--
2 files changed, 66 insertions(+), 2 deletions(-)
---
diff --git a/rpm-pld-macros.spec b/rpm-pld-macros.spec
index ddb0cec..ce35c3c 100644
--- a/rpm-pld-macros.spec
+++ b/rpm-pld-macros.spec
@@ -1,4 +1,4 @@
-%define rpm_macros_rev 2.000
+%define rpm_macros_rev 2.001
%define find_lang_rev 1.40
# split into individual X_prov_ver if there is a reason to desync
%define prov_ver 4.15
@@ -6,7 +6,7 @@ Summary: PLD Linux RPM macros
Summary(pl.UTF-8): Makra RPM dla Linuksa PLD
Name: rpm-pld-macros
Version: %{rpm_macros_rev}
-Release: 3
+Release: 1
License: GPL v2+
Group: Development/Building
Source0: macros.pld
@@ -54,6 +54,7 @@ Source54: macros.selinux
Source60: macros.gstreamer
Source61: attr.gstreamer
+Source62: kmod-deps.sh
Patch0: disable-systemd.patch
BuildRequires: rpm >= 4.4.9-56
BuildRequires: sed >= 4.0
@@ -196,6 +197,7 @@ cp -p %{SOURCE9} $RPM_BUILD_ROOT%{_usrlibrpm}/find-spec-bcond
cp -p %{SOURCE5} $RPM_BUILD_ROOT%{_usrlibrpm}/macros.d/macros.kernel
cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_usrlibrpm}/fileattrs/kernel.attr
+cp -p %{SOURCE62} $RPM_BUILD_ROOT%{_usrlibrpm}/kmod-deps.sh
cp -p service_generator.sh $RPM_BUILD_ROOT%{_usrlibrpm}
cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_usrlibrpm}/find-lang.sh
@@ -277,6 +279,7 @@ rm -rf $RPM_BUILD_ROOT
%attr(755,root,root) %{_usrlibrpm}/dokuwiki-find-lang.sh
%attr(755,root,root) %{_usrlibrpm}/find-lang.sh
%attr(755,root,root) %{_usrlibrpm}/find-spec-bcond
+%attr(755,root,root) %{_usrlibrpm}/kmod-deps.sh
%attr(755,root,root) %{_usrlibrpm}/service_generator.sh
%files rubyprov
diff --git a/kmod-deps.sh b/kmod-deps.sh
new file mode 100755
index 0000000..a78598b
--- /dev/null
+++ b/kmod-deps.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+# Kernel module dependency extractor.
+#
+# Author(s): Danny Tholen <obiwan at mandriva.org>
+# Olivier Blin <blino at mandriva.org>
+# Per Øyvind Karlsen <peroyvind at mandriva.org>
+#
+
+provides=0
+requires=0
+modinfo=/sbin/modinfo
+
+while [ "$#" -ne 0 ]; do
+ case $1 in
+ -P|--provides)
+ provides=1
+ ;;
+ -R|--requires)
+ requires=1
+ ;;
+ --modinfo)
+ shift
+ modinfo=$1
+ ;;
+ esac
+ shift
+done
+
+if [ $requires -eq 1 ]; then
+ echo "--requires not implemented!" 1>&2
+ exit 1
+fi
+
+if [ $provides -eq 1 ]; then
+ provideslist=`sed "s/['\"]/\\\&/g"`
+ modulelist=$(echo "$provideslist" | egrep '^.*(/lib/modules/|/var/lib/dkms/).*\.ko(\.gz|\.xz)?$')
+ echo $modulelist | xargs -r $modinfo | \
+ perl -lne '
+ $name = $1 if m!^filename:\s*(?:.*/)?([^/]+)\.k?o!;
+ $ver = $1 if /^version:\s*[a-zA-Z]{0,6}\-?(\d+[\.\:\-\[\]]?\d*[\.\:\-\[\]]?\d*[\.\:\-\[\]]?\d*[\.\:\-\[\]]?\d*-?[a-zA-Z]{0,6}\d?).*/;
+ $ver =~ s/(\:|-)/_/;
+ if (/^vermagic:/) {
+ print "kmod\($name\)" . ($ver ? " = $ver" : "") if $name;
+ undef $name; undef $ver;
+ }
+ '
+ dkmslist=$(echo "$provideslist" | egrep '(/var/lib/dkms-binary/[^/]+/[^/]+|/usr/src)/[^/]+/dkms.conf$')
+ [ -n "$dkmslist" ] && for d in $dkmslist; do
+ VERSION=`sed -rne 's/^PACKAGE_VERSION="?([^"]+)"?$/\1/;T;p' $d`
+ [ -z "$VERSION" ] && continue
+ PACKAGE_NAME=`sed -rne 's/^PACKAGE_NAME="?([^"]+)"?$/\1/;T;p' $d`
+ MODULES=`sed -rne 's/^DEST_MODULE_NAME\[[0-9]+\]="?([^"]+)"?$/\1/;T;p' $d`
+ [ -z "$MODULES" ] && MODULES=`sed -rne 's/^BUILT_MODULE_NAME\[[0-9]+\]="?([^"]+)"?$/\1/;T;p' $d`
+ # default on PACKAGE_NAME if no BUILT_MODULE_NAME is specified
+ [ -z "$MODULES" ] && MODULES=$PACKAGE_NAME
+ echo "$MODULES" | sed -re "s/\\\$PACKAGE_NAME/$PACKAGE_NAME/" | while read m; do
+ echo "kmod($m) = $VERSION"
+ done
+ done
+fi
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/rpm-pld-macros.git/commitdiff/74f369681c39a62e62f3d18e345dd09df3fafc36
More information about the pld-cvs-commit
mailing list