RPM Package Manager, CVS Repository
http://rpm5.org/cvs/
____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson
Root: /v/rpm/cvs Email: jbj@rpm5.org
Module: rpm Date: 20-Jun-2007 18:56:48
Branch: HEAD Handle: 2007062017564700
Added files:
rpm/scripts brp-implant-ident-static brp-java-repack-jars
find-provides.ksyms find-requires.ksyms kmodtool
rpmsort symset-table
Modified files:
rpm CHANGES
rpm/scripts Makefile.am brp-compress brp-strip
brp-strip-comment-note brp-strip-shared
brp-strip-static-archive find-lang.sh
Log:
- collect CentOS5 redhat-rpm-config changes for reference composting.
Summary:
Revision Changes Path
1.1380 +1 -0 rpm/CHANGES
1.38 +3 -0 rpm/scripts/Makefile.am
1.13 +3 -3 rpm/scripts/brp-compress
1.1 +34 -0 rpm/scripts/brp-implant-ident-static
1.1 +95 -0 rpm/scripts/brp-java-repack-jars
1.6 +4 -1 rpm/scripts/brp-strip
1.5 +7 -2 rpm/scripts/brp-strip-comment-note
1.4 +4 -1 rpm/scripts/brp-strip-shared
1.3 +4 -1 rpm/scripts/brp-strip-static-archive
1.8 +1 -1 rpm/scripts/find-lang.sh
1.1 +9 -0 rpm/scripts/find-provides.ksyms
1.1 +48 -0 rpm/scripts/find-requires.ksyms
1.1 +258 -0 rpm/scripts/kmodtool
1.1 +76 -0 rpm/scripts/rpmsort
1.1 +40 -0 rpm/scripts/symset-table
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.1379 -r1.1380 CHANGES
--- rpm/CHANGES 20 Jun 2007 15:58:14 -0000 1.1379
+++ rpm/CHANGES 20 Jun 2007 16:56:47 -0000 1.1380
@@ -1,4 +1,5 @@
4.5 -> 5.0:
+ - jbj: collect CentOS5 redhat-rpm-config changes for reference composting.
- rse: calculate timezone directly, don't rely on timezone variable.
- rse: remove the hysterical bzip2 interface.
- rse: add the missing Autoconf glue code for using mmap(2) in the code
@@ .
patch -p0 <<'@@ .'
Index: rpm/scripts/Makefile.am
============================================================================
$ cvs diff -u -r1.37 -r1.38 Makefile.am
--- rpm/scripts/Makefile.am 17 Jun 2007 01:21:39 -0000 1.37
+++ rpm/scripts/Makefile.am 20 Jun 2007 16:56:47 -0000 1.38
@@ -6,8 +6,10 @@
brp-compress brp-python-bytecompile brp-java-gcjcompile \
brp-strip brp-strip-comment-note brp-nobuildrootpath \
brp-strip-shared brp-strip-static-archive brp-sparc64-linux \
+ brp-implant-ident-static brp-java-repack-jars \
check-files cross-build executabledeps.sh \
find-debuginfo.sh find-lang.sh find-prov.pl find-req.pl \
+ find-provides.ksyms find-requires.ksyms kmodtool \
cpanflute cpanflute2 Specfile.pm find-provides.perl \
find-requires.perl freshen.sh gendiff getpo.sh http.req \
check-java-closure.sh java.prov.sh java.req.sh \
@@ -16,6 +18,7 @@
php.prov php.req rpm2cpio \
rpmdb_loadcvt rpmdiff rpmdiff.cgi \
rpm.daily rpm.log rpm.xinetd \
+ rpmsort symset-table \
sql.prov sql.req symclash.py symclash.sh tcl.req tgpg trpm u_pkg.sh \
vpkg-provides.sh vpkg-provides2.sh \
macros.perl* macros.python* \
@@ .
patch -p0 <<'@@ .'
Index: rpm/scripts/brp-compress
============================================================================
$ cvs diff -u -r1.12 -r1.13 brp-compress
--- rpm/scripts/brp-compress 17 Oct 2004 18:49:52 -0000 1.12
+++ rpm/scripts/brp-compress 20 Jun 2007 16:56:47 -0000 1.13
@@ -23,9 +23,9 @@
[ "`basename $f`" = "dir" ] && continue
case "$f" in
- *.Z) gunzip $f; b=`echo $f | sed -e 's/\.Z$//'`;;
- *.gz) gunzip $f; b=`echo $f | sed -e 's/\.gz$//'`;;
- *.bz2) bunzip2 $f; b=`echo $f | sed -e 's/\.bz2$//'`;;
+ *.Z) gunzip -f $f; b=`echo $f | sed -e 's/\.Z$//'`;;
+ *.gz) gunzip -f $f; b=`echo $f | sed -e 's/\.gz$//'`;;
+ *.bz2) bunzip2 -f $f; b=`echo $f | sed -e 's/\.bz2$//'`;;
*) b=$f;;
esac
@@ .
patch -p0 <<'@@ .'
Index: rpm/scripts/brp-implant-ident-static
============================================================================
$ cvs diff -u -r0 -r1.1 brp-implant-ident-static
--- /dev/null 2007-06-20 18:55:00 +0200
+++ brp-implant-ident-static 2007-06-20 18:56:48 +0200
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# If using normal root, avoid changing anything.
+if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
+ exit 0
+fi
+
+tempdir=`mktemp -d /tmp/implant-ident-XXXXXX`
+if test -z "$tempdir" ; then
+ exit 1
+fi
+
+cleanup() {
+ rm -f $tempdir/*
+ rmdir $tempdir
+}
+trap cleanup 0 1 2 3 4 5 6 7 8 9 11 13 14 15
+
+for library in `find $RPM_BUILD_ROOT -type f -exec file \{\} \; | grep 'current ar archive' | sed 's,:.*,,g' ` ; do
+ pushd $tempdir > /dev/null
+ if test -n "$RPM_BUILD_ROOT" ; then
+ cleanedlibrary=`echo "$library" | sed s,"$RPM_BUILD_ROOT",,g`
+ else
+ cleanedlibrary="$library"
+ fi
+ ar x "$library"
+ for object in *.o ; do
+ echo '$RPM: '${RPM_PACKAGE_NAME:-UNKNOWN_NAME}-${RPM_PACKAGE_VERSION:-UNKNOWN_VERSION}-${RPM_PACKAGE_RELEASE:-UNKNOWN_RELEASE}:"$cleanedlibrary":"$object"' $' > __x_rpm_ident_string.txt
+ objcopy --add-section .rodata=__x_rpm_ident_string.txt "$object"
+ ar r "$library" "$object"
+ done
+ rm -f *.o
+ popd > /dev/null
+done
@@ .
patch -p0 <<'@@ .'
Index: rpm/scripts/brp-java-repack-jars
============================================================================
$ cvs diff -u -r0 -r1.1 brp-java-repack-jars
--- /dev/null 2007-06-20 18:55:00 +0200
+++ brp-java-repack-jars 2007-06-20 18:56:48 +0200
@@ -0,0 +1,95 @@
+#!/bin/sh
+
+# If using normal root, avoid changing anything.
+if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
+ exit 0
+fi
+
+# If zip is not installed, we can't repack the jars.
+if [ ! -x /usr/bin/zip ]; then
+ exit 0
+fi
+if [ ! -x /usr/bin/unzip ]; then
+ exit 0
+fi
+
+JARS=`find $RPM_BUILD_ROOT -type f -name \*.jar`
+if [ ! -z "$JARS" ]; then
+
+ # make $RPM_BUILD_ROOT/tmp if it doesn't exist
+ rmtmp=0
+ if [ ! -x "$RPM_BUILD_ROOT/tmp" ]; then
+ mkdir -p $RPM_BUILD_ROOT/tmp
+ rmtmp=1
+ fi
+
+ # unpack every jar, set the date of the files and directories and
+ # repack the jar
+ for j in $JARS ; do
+ JARNAME=`basename $j`
+ TMPDIR=`mktemp -d -p $RPM_BUILD_ROOT/tmp $JARNAME.tmpdir.XXXXXXXXXX` || exit 1
+ JARDIR=`mktemp -d -p $RPM_BUILD_ROOT/tmp $JARNAME.jardir.XXXXXXXXXX` || exit 1
+ TIMEREF=`mktemp -p $RPM_BUILD_ROOT/tmp $JARNAME.timeref.XXXXXXXXXX` || exit 1
+
+ pushd $TMPDIR > /dev/null
+ /usr/bin/unzip -qq -o $j
+ rm -f $j
+
+ # Create the directories first.
+ for d in `find -type d | LC_ALL=C sort`; do
+ mkdir -p $JARDIR/$d
+ done
+
+ # Get the modtime from the newest ChangeLog. If the project
+ # doesn't have a ChangeLog, Jan 1, 1970 will be used.
+ DATE="1970-01-01 UTC"
+
+ if [ -z $_PACKAGE_BUILD_DIR ]; then
+ _PACKAGE_BUILD_DIR=$RPM_BUILD_DIR/$RPM_PACKAGE_NAME-$RPM_PACKAGE_VERSION
+ fi
+
+ if [ -d $_PACKAGE_BUILD_DIR ]; then
+ CHANGELOGS=`find $_PACKAGE_BUILD_DIR -type f -name ChangeLog`
+ if [ ! -z "$CHANGELOGS" ]; then
+ for c in $CHANGELOGS; do
+ TMPDATE=`stat -c %y $c | cut -d " " -f 1-2`
+ if [ `date --date="$TMPDATE" +%s` -gt `date --date="$DATE" +%s` ]; then
+ DATE="$TMPDATE"
+ fi
+ done
+ fi
+ fi
+
+ # move the contents over to the a new directory in order and set
+ # the times.
+ for f in `find -type f | LC_ALL=C sort`; do
+ cp $f $JARDIR/$f
+ touch --date="$DATE" $JARDIR/$f
+ done
+ popd > /dev/null
+
+ # Set the times of the directories.
+ touch --date="$DATE" `find $JARDIR -type d`
+
+ # make the jar
+ pushd $JARDIR > /dev/null
+
+ if [ -n "`find -type f`" ]; then
+ find -type f -print | LC_ALL=C sort | /usr/bin/zip -q -X -9 $j -@
+ else
+ # Put the empty jar back
+ touch $j
+ fi
+ popd > /dev/null
+
+ # Cleanup.
+ rm -rf $TMPDIR
+ rm -rf $JARDIR
+ rm -f $TIMEREF
+ done
+
+ # remove $RPM_BUILD_ROOT/tmp if we created it
+ if [ $rmtmp -eq 1 ]; then
+ rm -rf $RPM_BUILD_ROOT/tmp
+ fi
+fi
@@ .
patch -p0 <<'@@ .'
Index: rpm/scripts/brp-strip
============================================================================
$ cvs diff -u -r1.5 -r1.6 brp-strip
--- rpm/scripts/brp-strip 30 May 2005 06:43:45 -0000 1.5
+++ rpm/scripts/brp-strip 20 Jun 2007 16:56:47 -0000 1.6
@@ -9,10 +9,13 @@
*) ;;
esac
+[ -z "$STRIP" -a -n "$1" ] && STRIP="$1"
+[ -z "$STRIP" ] && STRIP=strip
+
# Strip ELF binaries
for f in `find $RPM_BUILD_ROOT -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \
grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug" | \
grep -v ' shared object,' | \
sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'`; do
- strip -g "$f" || :
+ $STRIP -g "$f" || :
done
@@ .
patch -p0 <<'@@ .'
Index: rpm/scripts/brp-strip-comment-note
============================================================================
$ cvs diff -u -r1.4 -r1.5 brp-strip-comment-note
--- rpm/scripts/brp-strip-comment-note 30 May 2005 06:43:45 -0000 1.4
+++ rpm/scripts/brp-strip-comment-note 20 Jun 2007 16:56:47 -0000 1.5
@@ -9,15 +9,20 @@
*) ;;
esac
+[ -z "$STRIP" -a -n "$1" ] && STRIP="$1"
+[ -z "$OBJDUMP" -a -n "$2" ] && OBJDUMP="$2"
+[ -z "$STRIP" ] && STRIP=strip
+[ -z "$OBJDUMP" ] && OBJDUMP=objdump
+
# Strip .comment and .note sections (the latter only if it is not allocated)
# for already stripped elf files in the build root
for f in `find $RPM_BUILD_ROOT -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \
grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug" | \
sed -n -e 's/^\(.*\):[ ]*ELF.*, stripped/\1/p'`; do
note="-R .note"
- if objdump -h $f | grep '^[ ]*[0-9]*[ ]*.note[ ]' -A 1 | \
+ if $OBJDUMP -h $f | grep '^[ ]*[0-9]*[ ]*.note[ ]' -A 1 | \
grep ALLOC >/dev/null; then
note=
fi
- strip -R .comment $note "$f" || :
+ $STRIP -R .comment $note "$f" || :
done
@@ .
patch -p0 <<'@@ .'
Index: rpm/scripts/brp-strip-shared
============================================================================
$ cvs diff -u -r1.3 -r1.4 brp-strip-shared
--- rpm/scripts/brp-strip-shared 30 May 2005 06:43:45 -0000 1.3
+++ rpm/scripts/brp-strip-shared 20 Jun 2007 16:56:47 -0000 1.4
@@ -12,6 +12,9 @@
*) ;;
esac
+[ -z "$STRIP" -a -n "$1" ] && STRIP="$1"
+[ -z "$STRIP" ] && STRIP=strip
+
# Strip ELF shared objects
# Please note we don't restrict our search to executable files because
# our libraries are not (should not be, at least) +x.
@@ -19,5 +22,5 @@
grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug" | \
grep ' shared object,' | \
sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'`; do
- strip --strip-unneeded "$f"
+ $STRIP --strip-unneeded "$f"
done
@@ .
patch -p0 <<'@@ .'
Index: rpm/scripts/brp-strip-static-archive
============================================================================
$ cvs diff -u -r1.2 -r1.3 brp-strip-static-archive
--- rpm/scripts/brp-strip-static-archive 30 May 2005 06:43:45 -0000 1.2
+++ rpm/scripts/brp-strip-static-archive 20 Jun 2007 16:56:47 -0000 1.3
@@ -9,10 +9,13 @@
*) ;;
esac
+[ -z "$STRIP" -a -n "$1" ] && STRIP="$1"
+[ -z "$STRIP" ] && STRIP=strip
+
# Strip static libraries.
for f in `find $RPM_BUILD_ROOT -type f -a -exec file {} \; | \
grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug" | \
grep 'current ar archive' | \
sed -n -e 's/^\(.*\):[ ]*current ar archive/\1/p'`; do
- strip -g "$f"
+ $STRIP -g "$f"
done
@@ .
patch -p0 <<'@@ .'
Index: rpm/scripts/find-lang.sh
============================================================================
$ cvs diff -u -r1.7 -r1.8 find-lang.sh
--- rpm/scripts/find-lang.sh 20 Jun 2004 18:55:19 -0000 1.7
+++ rpm/scripts/find-lang.sh 20 Jun 2007 16:56:47 -0000 1.8
@@ -85,7 +85,7 @@
esac
done
-find $TOP_DIR -type f|sed '
+find $TOP_DIR -type f -or -type l|sed '
s:'"$TOP_DIR"'::
'"$ALL_NAME$MO"'s:\(.*/share/locale/\)\([^/_]\+\)\(.*\.mo$\):%lang(\2) \1\2\3:
'"$NO_ALL_NAME$MO"'s:\(.*/share/locale/\)\([^/_]\+\)\(.*/'"$NAME"'\.mo$\):%lang(\2) \1\2\3:
@@ .
patch -p0 <<'@@ .'
Index: rpm/scripts/find-provides.ksyms
============================================================================
$ cvs diff -u -r0 -r1.1 find-provides.ksyms
--- /dev/null 2007-06-20 18:55:00 +0200
+++ find-provides.ksyms 2007-06-20 18:56:48 +0200
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+IFS=$'\n'
+
+for module in $(grep -E '/lib/modules/.+\.ko$'); do
+ nm $module \
+ | sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):ksym(\2) = \1:p'
+done \
+| sort -u
@@ .
patch -p0 <<'@@ .'
Index: rpm/scripts/find-requires.ksyms
============================================================================
$ cvs diff -u -r0 -r1.1 find-requires.ksyms
--- /dev/null 2007-06-20 18:55:00 +0200
+++ find-requires.ksyms 2007-06-20 18:56:48 +0200
@@ -0,0 +1,48 @@
+#! /bin/bash
+
+IFS=$'\n'
+
+all_provides() {
+ nm "$@" \
+ | sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):\1\t\2:p' \
+ | sort -k2 -u
+}
+
+all_requires() {
+ for module in "$@"; do
+ set -- $(/sbin/modinfo -F vermagic "$module" | sed -e 's: .*::' -e q)
+ /sbin/modprobe --dump-modversions "$module" \
+ | sed -r -e 's:^0x0*::' -e 's:$:\t'"$1"':'
+ done \
+ | sort -k2 -u
+}
+
+if ! [ -e /sbin/modinfo -a -e /sbin/modprobe ]; then
+ cat > /dev/null
+ exit 0
+fi
+
+modules=($(grep -E '/lib/modules/.+\.ko$'))
+if [ ${#modules[@]} -gt 0 ]; then
+ symset_table=$(mktemp -t ${0##*/}.XXXXX)
+ /usr/lib/rpm/redhat/symset-table | sort > $symset_table
+
+ join -t $'\t' -j 1 -a 2 $symset_table <(
+ # Filter out requirements that we fulfill ourself.
+ join -t $'\t' -j 2 -v 1 \
+ <(all_requires "${modules[@]}") \
+ <(all_provides "${modules[@]}") \
+ | awk '
+ BEGIN { FS = "\t" ; OFS = "\t" }
+ { print $3 "/" $2 "/" $1 }
+ ' \
+ | sort -u) \
+ | sort -u \
+ | awk '
+ { FS = "\t" ; OFS = "\t" }
+ NF == 3 { print "kernel(" $2 ") = " $3
+ next }
+ { split($1, arr, "/")
+ print "ksym(" arr[3] ") = " arr[2] }
+ '
+fi
@@ .
patch -p0 <<'@@ .'
Index: rpm/scripts/kmodtool
============================================================================
$ cvs diff -u -r0 -r1.1 kmodtool
--- /dev/null 2007-06-20 18:55:00 +0200
+++ kmodtool 2007-06-20 18:56:48 +0200
@@ -0,0 +1,258 @@
+#!/bin/bash
+
+# kmodtool - Helper script for building kernel module RPMs
+# Copyright (c) 2003-2006 Ville Skyttä <ville.skytta@iki.fi>,
+# Thorsten Leemhuis <fedora@leemhuis.info>
+# Jon Masters <jcm@redhat.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+shopt -s extglob
+
+myprog="kmodtool"
+myver="0.10.10_kmp2"
+knownvariants=@(BOOT|PAE|@(big|huge)mem|debug|enterprise|kdump|?(large)smp|uml|xen[0U]?(-PAE)|xen)
+kmod_name=
+kver=
+verrel=
+variant=
+kmp=
+
+get_verrel ()
+{
+ verrel=${1:-$(uname -r)}
+ verrel=${verrel%%$knownvariants}
+}
+
+print_verrel ()
+{
+ get_verrel $@
+ echo "${verrel}"
+}
+
+get_variant ()
+{
+ get_verrel $@
+ variant=${1:-$(uname -r)}
+ variant=${variant##$verrel}
+ variant=${variant:-'""'}
+}
+
+print_variant ()
+{
+ get_variant $@
+ echo "${variant}"
+}
+
+get_rpmtemplate ()
+{
+ local variant="${1}"
+ local dashvariant="${variant:+-${variant}}"
+ case "$verrel" in
+ *.el*) kdep="kernel${dashvariant}-%{_target_cpu} = ${verrel}" ;;
+ *.EL*) kdep="kernel${dashvariant}-%{_target_cpu} = ${verrel}" ;;
+ *) kdep="kernel-%{_target_cpu} = ${verrel}${variant}" ;;
+ esac
+
+ echo "%package -n kmod-${kmod_name}${dashvariant}"
+
+ if [ -z "$kmp_provides_summary" ]; then
+ echo "Summary: ${kmod_name} kernel module(s)"
+ fi
+
+ if [ -z "$kmp_provides_group" ]; then
+ echo "Group: System Environment/Kernel"
+ fi
+
+ if [ ! -z "$kmp" ]; then
+ echo "Version: %{kmp_version}"
+ echo "Release: %{kmp_release}"
+ fi
+
+ if [ ! -z "$kmp" ]; then
+ echo "%global _use_internal_dependency_generator 0"
+ fi
+
+ cat <<EOF
+Provides: kernel-modules = ${verrel}${variant}
+Provides: ${kmod_name}-kmod = %{?epoch:%{epoch}:}%{version}-%{release}
+EOF
+
+ if [ -z "$kmp" ]; then
+ echo "Requires: ${kdep}"
+ fi
+
+ cat <<EOF
+Requires: ${kmod_name}-kmod-common >= %{?epoch:%{epoch}:}%{version}
+Requires(post): /sbin/depmod
+Requires(postun): /sbin/depmod
+EOF
+
+if [ "no" != "$kmp_nobuildreqs" ]
+then
+ echo "BuildRequires: kernel${dashvariant}-devel-%{_target_cpu} = ${verrel}"
+fi
+
+if [ "" != "$kmp_override_preamble" ]
+then
+ cat "$kmp_override_preamble"
+fi
+
+cat <<EOF
+%description -n kmod-${kmod_name}${dashvariant}
+This package provides the ${kmod_name} kernel modules built for the Linux
+kernel ${verrel}${variant} for the %{_target_cpu} family of processors.
+%post -n kmod-${kmod_name}${dashvariant}
+if [ -e "/boot/System.map-${verrel}${variant}" ]; then
+ /sbin/depmod -aeF "/boot/System.map-${verrel}${variant}" "${verrel}${variant}" > /dev/null || :
+fi
+EOF
+
+ if [ ! -z "$kmp" ]; then
+ cat <<EOF
+modules=( \$(rpm -ql kmod-${kmod_name}${dashvariant} | grep '\.ko$') )
+if [ -x "/sbin/weak-modules" ]; then
+ printf '%s\n' "\${modules[@]}" \
+ | /sbin/weak-modules --add-modules
+fi
+%preun -n kmod-${kmod_name}${dashvariant}
+find /lib/modules/${verrel}${variant}/extra/${kmod_name} | grep '\.ko$' \
+ > /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules
+EOF
+
+ fi
+
+ cat <<EOF
+%postun -n kmod-${kmod_name}${dashvariant}
+/sbin/depmod -aF /boot/System.map-${verrel}${variant} ${verrel}${variant} &> /dev/null || :
+EOF
+
+ if [ ! -z "$kmp" ]; then
+ cat <<EOF
+modules=( \$(cat /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules) )
+#rm /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules
+if [ -x "/sbin/weak-modules" ]; then
+ printf '%s\n' "\${modules[@]}" \
+ | /sbin/weak-modules --remove-modules
+fi
+EOF
+ fi
+
+echo "%files -n kmod-${kmod_name}${dashvariant}"
+
+if [ "" == "$kmp_override_filelist" ];
+then
+ echo "%defattr(644,root,root,755)"
+ echo "/lib/modules/${verrel}${variant}/"
+else
+ cat "$kmp_override_filelist"
+fi
+}
+
+print_rpmtemplate ()
+{
+ kmod_name="${1}"
+ shift
+ kver="${1}"
+ get_verrel "${1}"
+ shift
+ if [ -z "${kmod_name}" ] ; then
+ echo "Please provide the kmodule-name as first parameter." >&2
+ exit 2
+ elif [ -z "${kver}" ] ; then
+ echo "Please provide the kver as second parameter." >&2
+ exit 2
+ elif [ -z "${verrel}" ] ; then
+ echo "Couldn't find out the verrel." >&2
+ exit 2
+ fi
+
+ for variant in "$@" ; do
+ if [ "default" == "$variant" ];
+ then
+ get_rpmtemplate ""
+ else
+ get_rpmtemplate "${variant}"
+ fi
+ done
+}
+
+usage ()
+{
+ cat <<EOF
+You called: ${invocation}
+
+Usage: ${myprog} <command> <option>+
+ Commands:
+ verrel <uname>
+ - Get "base" version-release.
+ variant <uname>
+ - Get variant from uname.
+ rpmtemplate <mainpgkname> <uname> <variants>
+ - Return a template for use in a source RPM
+ rpmtemplate_kmp <mainpgkname> <uname> <variants>
+ - Return a template for use in a source RPM with KMP dependencies
+ version
+ - Output version number and exit.
+EOF
+}
+
+invocation="$(basename ${0}) $@"
+while [ "${1}" ] ; do
+ case "${1}" in
+ verrel)
+ shift
+ print_verrel $@
+ exit $?
+ ;;
+ variant)
+ shift
+ print_variant $@
+ exit $?
+ ;;
+ rpmtemplate)
+ shift
+ print_rpmtemplate "$@"
+ exit $?
+ ;;
+ rpmtemplate_kmp)
+ shift
+ kmp=1
+ print_rpmtemplate "$@"
+ exit $?
+ ;;
+ version)
+ echo "${myprog} ${myver}"
+ exit 0
+ ;;
+ *)
+ echo "Error: Unknown option '${1}'." >&2
+ usage >&2
+ exit 2
+ ;;
+ esac
+done
+
+# Local variables:
+# mode: sh
+# sh-indentation: 2
+# indent-tabs-mode: nil
+# End:
+# ex: ts=2 sw=2 et
@@ .
patch -p0 <<'@@ .'
Index: rpm/scripts/rpmsort
============================================================================
$ cvs diff -u -r0 -r1.1 rpmsort
--- /dev/null 2007-06-20 18:55:00 +0200
+++ rpmsort 2007-06-20 18:56:48 +0200
@@ -0,0 +1,76 @@
+#! /usr/bin/perl -w
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+# USA.
+
+use Getopt::Long qw(:config gnu_getopt);
+
+sub rpm_cmp_versions {
+ my ($evr1, $evr2) = @_;
+
+ sub _rpm_cmp {
+ my ($s1, $s2) = @_;
+
+ return defined $s1 <=> defined $s2
+ unless defined $s1 && defined $s2;
+
+ my ($r, $x1, $x2);
+ do {
+ $s1 =~ s/^[^a-zA-Z0-9]+//;
+ $s2 =~ s/^[^a-zA-Z0-9]+//;
+ if ($s1 =~ /^\d/ || $s2 =~ /^\d/) {
+ $s1 =~ s/^0*(\d*)//; $x1 = $1;
+ $s2 =~ s/^0*(\d*)//; $x2 = $1;
+ $r = length $x1 <=> length $x2 || $x1 cmp $x2;
+ } else {
+ $s1 =~ s/^([a-zA-Z]*)//; $x1 = $1;
+ $s2 =~ s/^([a-zA-Z]*)//; $x2 = $1;
+ return 0
+ if $x1 eq '' && $x2 eq '';
+ $r = $x1 cmp $x2;
+ }
+ } until $r;
+ return $r;
+ }
+
+ my ($e1, $v1, $r1) = $evr1 =~ /^(?:(\d*):)?(.*?)(?:-([^-]*))?$/;
+ my ($e2, $v2, $r2) = $evr2 =~ /^(?:(\d*):)?(.*?)(?:-([^-]*))?$/;
+ my $r = _rpm_cmp($e1 || 0, $e2 || 0);
+ $r = _rpm_cmp($v1, $v2)
+ unless $r;
+ $r = _rpm_cmp($r1, $r2)
+ unless $r;
+ return $r;
+}
+
+my $reorder = sub { return @_ };
+my $key = 0;
+
+GetOptions ("r|reverse" => sub { $reorder = sub { return reverse @_ } },
+ "k|key=i" => \$key)
+or do {
+ print STDERR "Usage\n";
+ exit 1;
+};
+
+if ($key == 0) {
+ # Sort by entire lines
+ map { print } &$reorder(sort { rpm_cmp_versions($a, $b) } <>);
+} else {
+ # Sort by field $key
+ my @data = map { [(split)[$key-1], $_] } <>;
+ map { print } &$reorder(map { $_->[1] }
+ sort { rpm_cmp_versions($a->[0], $b->[0]) } @data);
+}
@@ .
patch -p0 <<'@@ .'
Index: rpm/scripts/symset-table
============================================================================
$ cvs diff -u -r0 -r1.1 symset-table
--- /dev/null 2007-06-20 18:55:00 +0200
+++ symset-table 2007-06-20 18:56:48 +0200
@@ -0,0 +1,40 @@
+#! /bin/sh
+
+# Create a table of all symbol sets defined in all /boot/symsets*.tar.gz
+# files.
+#
+# Format:
+# kernelrelease/modver/symbol <tab> symset <tab> symset_hash
+#
+# This table is needed for computing the appropriate Requires: tags for
+# kernel module packages.
+
+tmpdir=$(mktemp -t -d ${0##*/}.XXXXXX)
+trap "cd / ; rm -rf $tmpdir" EXIT
+cd $tmpdir
+
+shopt -s nullglob
+for symsets in /boot/symsets-*.tar.gz; do
+ zcat $symsets \
+ | tar xf -
+done
+
+for symsets in /usr/src/kernels/*/symsets-*.tar.gz; do
+ zcat $symsets \
+ | tar xf -
+done
+
+for symsets in *; do
+ krel=${symsets#symsets-}
+ for symset in $symsets/*; do
+ class=${symset##*/} ; class=${class%.*}
+ hash=${symset##*.}
+ awk '
+ BEGIN { FS = "\t" ; OFS = "\t" }
+ { sub(/0x0*/, "", $1)
+ print krel "/" $1 "/" $2, class, hash }
+ ' krel="$krel" class="$class" hash="$hash" $symset
+ done
+done
+
+# vim:shiftwidth=4 softtabstop=4
@@ .
Received on Wed Jun 20 18:56:48 2007