Update upstream redhat-rpm-config release.

This commit is contained in:
Jon Masters 2006-10-12 03:33:42 +00:00
parent c8ec9fb01f
commit 97a32887d6
7 changed files with 246 additions and 1 deletions

View File

@ -3,6 +3,11 @@
# This script reads filenames from STDIN and outputs any relevant provides
# information that needs to be included in the package.
if [ "$1" ]
then
package_name = "$1"
fi
[ -z "$OBJDUMP" ] && OBJDUMP=objdump
filelist=`sed "s/['\"]/\\\&/g"`
@ -70,4 +75,30 @@ done | sort -u
[ -x /usr/lib/rpm/redhat/find-provides.pkgconfig ] &&
echo $filelist | tr '[:blank:]' \\n | /usr/lib/rpm/redhat/find-provides.pkgconfig | sort -u
#
# --- Kernel module imported symbols
#
# Since we don't (yet) get passed the name of the package being built, we
# cheat a little here by looking first for a kernel, then for a kmod.
#
is_kmod=1
for f in $filelist; do
if [ $(echo "$f" | sed -r -ne 's:^.*/lib/modules/(.*)/(.*).ko$:\2:p') ]
then
is_kernel=1;
fi
if [ $(echo "$f" | sed -r -ne 's:^.*/boot/(.*):\1:p') ]
then
unset is_kmod;
fi
done
if [ ! "$is_kernel" ] || [ "$package_name" == "kernel" ]
then
unset is_kmod
fi
[ -x /usr/lib/rpm/redhat/find-provides.ksyms ] && [ "$is_kmod" ] &&
printf "%s\n" "${filelist[@]}" | /usr/lib/rpm/redhat/find-provides.ksyms
exit 0

9
find-provides.ksyms Executable file
View File

@ -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

View File

@ -5,6 +5,11 @@
# sonames, script interpreters, and perl modules.
#
if [ "$1" ]
then
package_name = "$1"
fi
ulimit -c 0
#
@ -132,4 +137,30 @@ done | sort -u
[ -x /usr/lib/rpm/redhat/tcl.req -a -n "$tcllist" ] && \
echo $tcllist | tr '[:blank:]' \\n | /usr/lib/rpm/redhat/tcl.req | sort -u
#
# --- Kernel module imported symbols
#
# Since we don't (yet) get passed the name of the package being built, we
# cheat a little here by looking first for a kernel, then for a kmod.
#
is_kmod=1
for f in $filelist; do
if [ $(echo "$f" | sed -r -ne 's:^.*/lib/modules/(.*)/(.*).ko$:\2:p') ]
then
is_kernel=1;
fi
if [ $(echo "$f" | sed -r -ne 's:^.*/boot/(.*):\1:p') ]
then
unset is_kmod;
fi
done
if [ ! "$is_kernel" ] || [ "$package_name" == "kernel" ]
then
unset is_kmod
fi
[ -x /usr/lib/rpm/redhat/find-requires.ksyms ] && [ "$is_kmod" ] &&
printf "%s\n" "${filelist[@]}" | /usr/lib/rpm/redhat/find-requires.ksyms
exit 0

48
find-requires.ksyms Executable file
View File

@ -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

View File

@ -1,6 +1,6 @@
Summary: Red Hat specific rpm configuration files.
Name: redhat-rpm-config
Version: 8.0.40
Version: 8.0.45
Release: 1
License: GPL
Group: Development/System
@ -35,6 +35,21 @@ rm -rf ${RPM_BUILD_ROOT}
%{_prefix}/lib/rpm/redhat
%changelog
* Sun Jul 30 2006 Jon Masters <jcm@redhat.com> - 8.0.45-1
- Fix inverted kernel test.
* Sun Jul 30 2006 Jon Masters <jcm@redhat.com> - 8.0.44-1
- Add a better check for a kernel vs. kmod.
* Thu Jun 15 2006 Jon Masters <jcm@redhat.com> - 8.0.43-1
- Workaround bug in find-requires/find-provides for kmods.
* Thu Jun 15 2006 Jon Masters <jcm@redhat.com> - 8.0.42-1
- Fix a typo in KMP find-requires.
* Tue Jun 13 2006 Jon Masters <jcm@redhat.com> - 8.0.41-1
- Add support for KMP Fedora Extras packaging.
* Fri Feb 3 2006 Jeremy Katz <katzj@redhat.com> - 8.0.40-1
- use -mtune=generic for x86 and x86_64

76
rpmsort Executable file
View File

@ -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);
}

35
symset-table Executable file
View File

@ -0,0 +1,35 @@
#! /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 *; 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