Merge remote-tracking branch 'localupstream/master' into merge
* localupstream/master: (213 commits) Flatten the directory structure in preparation to merge ...
This commit is contained in:
commit
c8d1a00f2a
56
brp-compress
Executable file
56
brp-compress
Executable file
@ -0,0 +1,56 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# If using normal root, avoid changing anything.
|
||||||
|
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $RPM_BUILD_ROOT
|
||||||
|
|
||||||
|
# Compress man pages
|
||||||
|
COMPRESS="gzip -9 -n"
|
||||||
|
COMPRESS_EXT=.gz
|
||||||
|
|
||||||
|
for d in ./usr/man/man* ./usr/man/*/man* ./usr/info \
|
||||||
|
./usr/share/man/man* ./usr/share/man/*/man* ./usr/share/info \
|
||||||
|
./usr/kerberos/man ./usr/X11R6/man/man* ./usr/lib/perl5/man/man* \
|
||||||
|
./usr/share/doc/*/man/man* ./usr/lib/*/man/man*
|
||||||
|
do
|
||||||
|
[ -d $d ] || continue
|
||||||
|
for f in `find $d -type f`
|
||||||
|
do
|
||||||
|
[ -f "$f" ] || continue
|
||||||
|
[ "`basename $f`" = "dir" ] && continue
|
||||||
|
|
||||||
|
case "$f" in
|
||||||
|
*.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
|
||||||
|
|
||||||
|
$COMPRESS $b </dev/null 2>/dev/null || {
|
||||||
|
inode=`ls -i $b | awk '{ print $1 }'`
|
||||||
|
others=`find $d -type f -inum $inode`
|
||||||
|
if [ -n "$others" ]; then
|
||||||
|
for afile in $others ; do
|
||||||
|
[ "$afile" != "$b" ] && rm -f $afile
|
||||||
|
done
|
||||||
|
$COMPRESS -f $b
|
||||||
|
for afile in $others ; do
|
||||||
|
[ "$afile" != "$b" ] && ln $b$COMPRESS_EXT $afile$COMPRESS_EXT
|
||||||
|
done
|
||||||
|
else
|
||||||
|
$COMPRESS -f $b
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
done
|
||||||
|
|
||||||
|
for f in `find $d -type l`
|
||||||
|
do
|
||||||
|
l=`ls -l $f | sed -e 's/.* -> //' -e 's/\.gz$//' -e 's/\.bz2$//' -e 's/\.Z$//'`
|
||||||
|
rm -f $f
|
||||||
|
b=`echo $f | sed -e 's/\.gz$//' -e 's/\.bz2$//' -e 's/\.Z$//'`
|
||||||
|
ln -sf $l$COMPRESS_EXT $b$COMPRESS_EXT
|
||||||
|
done
|
||||||
|
done
|
34
brp-implant-ident-static
Executable file
34
brp-implant-ident-static
Executable file
@ -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
|
105
brp-java-repack-jars
Executable file
105
brp-java-repack-jars
Executable file
@ -0,0 +1,105 @@
|
|||||||
|
#!/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 -not -size 0`
|
||||||
|
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
|
||||||
|
OLD_IFS="$IFS"
|
||||||
|
IFS=$(printf '\n\t')
|
||||||
|
for j in $JARS ; do
|
||||||
|
JARNAME=`basename "$j"`
|
||||||
|
JTMPDIR=`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 "$JTMPDIR" > /dev/null
|
||||||
|
/usr/bin/unzip -qq -o "$j"
|
||||||
|
find -type d -exec chmod a+rx,u+w {} \;
|
||||||
|
find -type f -exec chmod a+r,u+w {} \;
|
||||||
|
rm -f "$j"
|
||||||
|
|
||||||
|
# Create the directories first.
|
||||||
|
find -type d | LC_ALL=C sort | while read d; 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.
|
||||||
|
find -type f | LC_ALL=C sort | while read f; do
|
||||||
|
cp "$f" "$JARDIR/$f"
|
||||||
|
touch --date="$DATE" "$JARDIR/$f"
|
||||||
|
done
|
||||||
|
popd > /dev/null
|
||||||
|
|
||||||
|
# Set the times of the directories.
|
||||||
|
find "$JARDIR" -type d | while read d; do
|
||||||
|
touch --date="$DATE" "$d"
|
||||||
|
done
|
||||||
|
|
||||||
|
# make the jar
|
||||||
|
pushd "$JARDIR" > /dev/null
|
||||||
|
|
||||||
|
if [ -n "`find -not -name '.'`" ]; then
|
||||||
|
if [ -e META-INF/MANIFEST.MF ]; then
|
||||||
|
/usr/bin/zip -q -X -9 "$j" META-INF/MANIFEST.MF
|
||||||
|
fi
|
||||||
|
find * -not -name '.' | LC_ALL=C sort | /usr/bin/zip -u -q -X -9 "$j" -@
|
||||||
|
else
|
||||||
|
# Put the empty jar back
|
||||||
|
touch "$j"
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
|
||||||
|
# Cleanup.
|
||||||
|
rm -rf "$JTMPDIR"
|
||||||
|
rm -rf "$JARDIR"
|
||||||
|
rm -f "$TIMEREF"
|
||||||
|
done
|
||||||
|
IFS="$OLD_IFS"
|
||||||
|
|
||||||
|
# remove $RPM_BUILD_ROOT/tmp if we created it
|
||||||
|
if [ $rmtmp -eq 1 ]; then
|
||||||
|
rm -rf $RPM_BUILD_ROOT/tmp
|
||||||
|
fi
|
||||||
|
fi
|
19
brp-python-hardlink
Executable file
19
brp-python-hardlink
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# If using normal root, avoid changing anything.
|
||||||
|
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Hardlink identical *.pyc and *.pyo, originally from PLD's rpm-build-macros
|
||||||
|
# Modified to use sha1sum instead of cmp to avoid a diffutils dependency.
|
||||||
|
find "$RPM_BUILD_ROOT" -type f -name "*.pyc" | while read pyc ; do
|
||||||
|
pyo="$(echo $pyc | sed -e 's/.pyc$/.pyo/')"
|
||||||
|
if [ -f "$pyo" ] ; then
|
||||||
|
csha="$(sha1sum -b "$pyc" | cut -d' ' -f 1)" && \
|
||||||
|
osha="$(sha1sum -b "$pyo" | cut -d' ' -f 1)" && \
|
||||||
|
if [ "$csha" = "$osha" ] ; then
|
||||||
|
ln -f "$pyc" "$pyo"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
14
brp-strip
Executable file
14
brp-strip
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# If using normal root, avoid changing anything.
|
||||||
|
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
[ -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" || :
|
||||||
|
done
|
23
brp-strip-comment-note
Executable file
23
brp-strip-comment-note
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# If using normal root, avoid changing anything.
|
||||||
|
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -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 | \
|
||||||
|
grep ALLOC >/dev/null; then
|
||||||
|
note=
|
||||||
|
fi
|
||||||
|
$STRIP -R .comment $note "$f" || :
|
||||||
|
done
|
20
brp-strip-shared
Executable file
20
brp-strip-shared
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Conectiva brp - strip shared libraries. Based on Red Hat's brp-strip.
|
||||||
|
# Thu Apr 20 - Guilherme Manika <gwm@conectiva.com.br>
|
||||||
|
# Created file
|
||||||
|
|
||||||
|
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -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.
|
||||||
|
for f in `find $RPM_BUILD_ROOT -type f -a -exec file {} \; | \
|
||||||
|
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"
|
||||||
|
done
|
16
brp-strip-static-archive
Executable file
16
brp-strip-static-archive
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "$STRIP" -a -n "$1" ] && STRIP="$1"
|
||||||
|
[ -z "$STRIP" ] && STRIP=strip
|
||||||
|
|
||||||
|
# Strip static libraries.
|
||||||
|
for f in `find $RPM_BUILD_ROOT -name \*.a -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"
|
||||||
|
done
|
1558
config.guess
vendored
Normal file
1558
config.guess
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1791
config.sub
vendored
Normal file
1791
config.sub
vendored
Normal file
File diff suppressed because it is too large
Load Diff
66
dist.sh
Executable file
66
dist.sh
Executable file
@ -0,0 +1,66 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# dist.sh
|
||||||
|
# Author: Tom "spot" Callaway <tcallawa@redhat.com>
|
||||||
|
# License: GPL
|
||||||
|
# This is a script to output the value for the %{dist}
|
||||||
|
# tag. The dist tag takes the following format: .$type$num
|
||||||
|
# Where $type is one of: el, fc, rh
|
||||||
|
# (for RHEL, Fedora Core, and RHL, respectively)
|
||||||
|
# And $num is the version number of the distribution.
|
||||||
|
# NOTE: We can't detect Rawhide or Fedora Test builds properly.
|
||||||
|
# If we successfully detect the version number, we output the
|
||||||
|
# dist tag. Otherwise, we exit with no output.
|
||||||
|
|
||||||
|
RELEASEFILE=/etc/redhat-release
|
||||||
|
|
||||||
|
function check_num {
|
||||||
|
MAINVER=`cut -d "(" -f 1 < $RELEASEFILE | \
|
||||||
|
sed -e "s/[^0-9.]//g" -e "s/$//g" | cut -d "." -f 1`
|
||||||
|
|
||||||
|
echo $MAINVER | grep -q '[0-9]' && echo $MAINVER
|
||||||
|
}
|
||||||
|
|
||||||
|
function check_rhl {
|
||||||
|
grep -q "Red Hat Linux" $RELEASEFILE && ! grep -q "Advanced" $RELEASEFILE && echo $DISTNUM
|
||||||
|
}
|
||||||
|
|
||||||
|
function check_rhel {
|
||||||
|
egrep -q "(Enterprise|Advanced)" $RELEASEFILE && echo $DISTNUM
|
||||||
|
}
|
||||||
|
|
||||||
|
function check_fedora {
|
||||||
|
grep -q Fedora $RELEASEFILE && echo $DISTNUM
|
||||||
|
}
|
||||||
|
|
||||||
|
DISTNUM=`check_num`
|
||||||
|
DISTFC=`check_fedora`
|
||||||
|
DISTRHL=`check_rhl`
|
||||||
|
DISTRHEL=`check_rhel`
|
||||||
|
if [ -n "$DISTNUM" ]; then
|
||||||
|
if [ -n "$DISTFC" ]; then
|
||||||
|
DISTTYPE=fc
|
||||||
|
elif [ -n "$DISTRHEL" ]; then
|
||||||
|
DISTTYPE=el
|
||||||
|
elif [ -n "$DISTRHL" ]; then
|
||||||
|
DISTTYPE=rhl
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
[ -n "$DISTTYPE" -a -n "$DISTNUM" ] && DISTTAG=".${DISTTYPE}${DISTNUM}"
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
--el) echo -n "$DISTRHEL" ;;
|
||||||
|
--fc) echo -n "$DISTFC" ;;
|
||||||
|
--rhl) echo -n "$DISTRHL" ;;
|
||||||
|
--distnum) echo -n "$DISTNUM" ;;
|
||||||
|
--disttype) echo -n "$DISTTYPE" ;;
|
||||||
|
--help)
|
||||||
|
printf "Usage: $0 [OPTIONS]\n"
|
||||||
|
printf " Default mode is --dist. Possible options:\n"
|
||||||
|
printf " --el\t\tfor RHEL version (if RHEL)\n"
|
||||||
|
printf " --fc\t\tfor Fedora version (if Fedora)\n"
|
||||||
|
printf " --rhl\t\tfor RHL version (if RHL)\n"
|
||||||
|
printf " --dist\t\tfor distribution tag\n"
|
||||||
|
printf " --distnum\tfor distribution number (major)\n"
|
||||||
|
printf " --disttype\tfor distribution type\n" ;;
|
||||||
|
*) echo -n "$DISTTAG" ;;
|
||||||
|
esac
|
112
find-provides
Executable file
112
find-provides
Executable file
@ -0,0 +1,112 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# 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"`
|
||||||
|
|
||||||
|
solist=$(echo $filelist | grep "\\.so" | grep -v "^/lib/ld.so" | \
|
||||||
|
xargs file -L 2>/dev/null | grep "ELF.*shared object" | cut -d: -f1)
|
||||||
|
pythonlist=
|
||||||
|
tcllist=
|
||||||
|
|
||||||
|
#
|
||||||
|
# --- Alpha does not mark 64bit dependencies
|
||||||
|
case `uname -m` in
|
||||||
|
alpha*) mark64="" ;;
|
||||||
|
*) mark64="()(64bit)" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
#
|
||||||
|
# --- Library sonames and weak symbol versions (from glibc).
|
||||||
|
for f in $solist; do
|
||||||
|
soname=$(objdump -p $f | awk '/SONAME/ {print $2}')
|
||||||
|
|
||||||
|
lib64=`if file -L $f 2>/dev/null | \
|
||||||
|
grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
|
||||||
|
if [ "$soname" != "" ]; then
|
||||||
|
if [ ! -L $f ]; then
|
||||||
|
echo $soname$lib64
|
||||||
|
objdump -p $f | awk '
|
||||||
|
BEGIN { START=0 ; }
|
||||||
|
/Version definitions:/ { START=1; }
|
||||||
|
/^[0-9]/ && (START==1) { print $4; }
|
||||||
|
/^$/ { START=0; }
|
||||||
|
' | \
|
||||||
|
grep -v $soname | \
|
||||||
|
while read symbol ; do
|
||||||
|
echo "$soname($symbol)`echo $lib64 | sed 's/()//'`"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo ${f##*/}$lib64
|
||||||
|
fi
|
||||||
|
done | sort -u
|
||||||
|
|
||||||
|
#
|
||||||
|
# --- Perl modules.
|
||||||
|
[ -x /usr/lib/rpm/perl.prov ] &&
|
||||||
|
echo $filelist | tr '[:blank:]' \\n | grep '\.pm$' | /usr/lib/rpm/perl.prov | sort -u
|
||||||
|
|
||||||
|
#
|
||||||
|
# --- Python modules.
|
||||||
|
[ -x /usr/lib/rpm/redhat/python.prov -a -n "$pythonlist" ] &&
|
||||||
|
echo $pythonlist | tr '[:blank:]' \\n | /usr/lib/rpm/redhat/python.prov | sort -u
|
||||||
|
|
||||||
|
#
|
||||||
|
# --- Tcl modules.
|
||||||
|
[ -x /usr/lib/rpm/redhat/tcl.prov -a -n "$tcllist" ] &&
|
||||||
|
echo $tcllist | tr '[:blank:]' \\n | /usr/lib/rpm/redhat/tcl.prov | sort -u
|
||||||
|
|
||||||
|
#
|
||||||
|
# --- libtool
|
||||||
|
[ -x /usr/lib/rpm/redhat/find-provides.libtool ] &&
|
||||||
|
echo $filelist | tr '[:blank:]' \\n | /usr/lib/rpm/redhat/find-provides.libtool | sort -u
|
||||||
|
|
||||||
|
#
|
||||||
|
# --- any other extra find-provides scripts
|
||||||
|
for i in /usr/lib/rpm/redhat/find-provides.d/*.prov
|
||||||
|
do
|
||||||
|
[ -x $i ] &&
|
||||||
|
(echo $filelist | tr '[:blank:]' \\n | $i | sort -u)
|
||||||
|
done
|
||||||
|
|
||||||
|
#
|
||||||
|
# --- pkgconfig
|
||||||
|
[ -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
9
find-provides.ksyms
Executable 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
|
10
find-provides.libtool
Executable file
10
find-provides.libtool
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
while read possible ; do
|
||||||
|
case "$possible" in
|
||||||
|
*.la)
|
||||||
|
if grep -iq '^# Generated by ltmain.sh' "$possible" 2> /dev/null ; then
|
||||||
|
echo "libtool($possible)"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
22
find-provides.pkgconfig
Executable file
22
find-provides.pkgconfig
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
pkgconfig=${1:-/usr/bin/pkg-config}
|
||||||
|
test -x $pkgconfig || exit 0
|
||||||
|
while read filename ; do
|
||||||
|
case "${filename}" in
|
||||||
|
*.pc)
|
||||||
|
# Assume that this file doesn't contain useful information.
|
||||||
|
needs_pkgconfig=false
|
||||||
|
# Query the dependencies of the package.
|
||||||
|
$pkgconfig --print-provides "$filename" 2> /dev/null | while read n r v ; do
|
||||||
|
# We have a dependency. Make a note that we need the pkgconfig
|
||||||
|
# tool for this package.
|
||||||
|
echo "pkgconfig($n)" "$r" "$v"
|
||||||
|
needs_pkgconfig=true
|
||||||
|
done
|
||||||
|
# The dependency on the pkgconfig package itself.
|
||||||
|
if $needs_pkgconfig ; then
|
||||||
|
echo pkgconfig
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
160
find-requires
Executable file
160
find-requires
Executable file
@ -0,0 +1,160 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Auto-generate requirements for executables (both ELF and a.out) and library
|
||||||
|
# sonames, script interpreters, and perl modules.
|
||||||
|
#
|
||||||
|
|
||||||
|
ulimit -c 0
|
||||||
|
|
||||||
|
#
|
||||||
|
# --- Set needed to 0 for traditional find-requires behavior.
|
||||||
|
needed=1
|
||||||
|
if [ X"$1" = Xldd ]; then
|
||||||
|
needed=0
|
||||||
|
elif [ X"$1" = Xobjdump ]; then
|
||||||
|
needed=1
|
||||||
|
fi
|
||||||
|
[ -z "$OBJDUMP" ] && OBJDUMP=objdump
|
||||||
|
|
||||||
|
#
|
||||||
|
# --- Grab the file manifest and classify files.
|
||||||
|
#filelist=`sed "s/['\"]/\\\&/g"`
|
||||||
|
filelist=`sed "s/[]['\"*?{}]/\\\\\&/g"`
|
||||||
|
exelist=`echo $filelist | xargs -r file | egrep -v ":.* (commands|script) " | \
|
||||||
|
grep ":.*executable" | cut -d: -f1`
|
||||||
|
scriptlist=`echo $filelist | xargs -r file | \
|
||||||
|
egrep ":.* (commands|script) " | cut -d: -f1`
|
||||||
|
liblist=`echo $filelist | xargs -r file | \
|
||||||
|
grep ":.*shared object" | cut -d : -f1`
|
||||||
|
|
||||||
|
interplist=
|
||||||
|
perllist=
|
||||||
|
pythonlist=
|
||||||
|
tcllist=
|
||||||
|
|
||||||
|
#
|
||||||
|
# --- Alpha does not mark 64bit dependencies
|
||||||
|
case `uname -m` in
|
||||||
|
alpha*) mark64="" ;;
|
||||||
|
*) mark64="()(64bit)" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ "$needed" -eq 0 ]; then
|
||||||
|
#
|
||||||
|
# --- Executable dependency sonames.
|
||||||
|
for f in $exelist; do
|
||||||
|
[ -r $f -a -x $f ] || continue
|
||||||
|
lib64=`if file -L $f 2>/dev/null | \
|
||||||
|
grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
|
||||||
|
ldd $f | awk '/=>/ {
|
||||||
|
if ($1 !~ /libNoVersion.so/ && $1 !~ /4[um]lib.so/ && $1 !~ /libredhat-kernel.so/) {
|
||||||
|
gsub(/'\''"/,"\\&",$1);
|
||||||
|
printf "%s'$lib64'\n", $1
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
done | xargs -r -n 1 basename | sort -u
|
||||||
|
|
||||||
|
#
|
||||||
|
# --- Library dependency sonames.
|
||||||
|
for f in $liblist; do
|
||||||
|
[ -r $f ] || continue
|
||||||
|
lib64=`if file -L $f 2>/dev/null | \
|
||||||
|
grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
|
||||||
|
ldd $f | awk '/=>/ {
|
||||||
|
if ($1 !~ /libNoVersion.so/ && $1 !~ /4[um]lib.so/ && $1 !~ /libredhat-kernel.so/) {
|
||||||
|
gsub(/'\''"/,"\\&",$1);
|
||||||
|
printf "%s'$lib64'\n", $1
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
done | xargs -r -n 1 basename | sort -u
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# --- Script interpreters.
|
||||||
|
for f in $scriptlist; do
|
||||||
|
[ -r $f -a -x $f ] || continue
|
||||||
|
interp=`head -n 1 $f | sed -e 's/^\#\![ ]*//' | cut -d" " -f1`
|
||||||
|
interplist="$interplist $interp"
|
||||||
|
case $interp in
|
||||||
|
*/perl) perllist="$perllist $f" ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
[ -n "$interplist" ] && { echo "$interplist" | tr '[:blank:]' \\n | sort -u ; }
|
||||||
|
|
||||||
|
#
|
||||||
|
# --- Add perl module files to perllist.
|
||||||
|
for f in $filelist; do
|
||||||
|
[ -r $f -a "${f%.pm}" != "${f}" ] && perllist="$perllist $f"
|
||||||
|
done
|
||||||
|
|
||||||
|
#
|
||||||
|
# --- Weak symbol versions (from glibc).
|
||||||
|
[ -n "$mark64" ] && mark64="(64bit)"
|
||||||
|
for f in $liblist $exelist ; do
|
||||||
|
[ -r $f ] || continue
|
||||||
|
lib64=`if file -L $f 2>/dev/null | \
|
||||||
|
grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
|
||||||
|
$OBJDUMP -p $f | awk 'BEGIN { START=0; LIBNAME=""; needed='$needed'; }
|
||||||
|
/^$/ { START=0; }
|
||||||
|
/^Dynamic Section:$/ { START=1; }
|
||||||
|
(START==1) && /NEEDED/ {
|
||||||
|
if (needed) {
|
||||||
|
if ("'$lib64'" != "") {
|
||||||
|
sub(/$/, "()'$lib64'", $2) ;
|
||||||
|
}
|
||||||
|
print $2 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
(START==2) && /^[A-Za-z]/ { START=3; }
|
||||||
|
/^Version References:$/ { START=2; }
|
||||||
|
(START==2) && /required from/ {
|
||||||
|
sub(/:/, "", $3);
|
||||||
|
LIBNAME=$3;
|
||||||
|
}
|
||||||
|
(START==2) && (LIBNAME!="") && ($4!="") {
|
||||||
|
print LIBNAME "(" $4 ")'$lib64'";
|
||||||
|
}
|
||||||
|
'
|
||||||
|
done | sort -u
|
||||||
|
|
||||||
|
#
|
||||||
|
# --- Perl modules.
|
||||||
|
[ -x /usr/lib/rpm/perl.req -a -n "$perllist" ] && \
|
||||||
|
echo $perllist | tr '[:blank:]' \\n | /usr/lib/rpm/perl.req | sort -u
|
||||||
|
|
||||||
|
#
|
||||||
|
# --- Python modules.
|
||||||
|
[ -x /usr/lib/rpm/redhat/python.req -a -n "$pythonlist" ] && \
|
||||||
|
echo $pythonlist | tr '[:blank:]' \\n | /usr/lib/rpm/redhat/python.req | sort -u
|
||||||
|
|
||||||
|
#
|
||||||
|
# --- Tcl modules.
|
||||||
|
[ -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.
|
||||||
|
#
|
||||||
|
|
||||||
|
unset is_kmod
|
||||||
|
|
||||||
|
for f in $filelist; do
|
||||||
|
if [ $(echo "$f" | sed -r -ne 's:^.*/lib/modules/(.*)/(.*).ko$:\2:p') ]
|
||||||
|
then
|
||||||
|
is_kmod=1;
|
||||||
|
elif [ $(echo "$f" | sed -r -ne 's:^.*/boot/(.*):\1:p') ]
|
||||||
|
then
|
||||||
|
unset is_kmod;
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Disabling for now while the Fedora kernel doesn't produce kABI deps.
|
||||||
|
#[ -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
48
find-requires.ksyms
Executable 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
|
15
find-requires.libtool
Executable file
15
find-requires.libtool
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
while read possible ; do
|
||||||
|
case "$possible" in
|
||||||
|
*.la)
|
||||||
|
for dep in `grep ^dependency_libs= "$possible" 2> /dev/null | \
|
||||||
|
sed -r -e "s,^dependency_libs='(.*)',\1,g"` ; do
|
||||||
|
case "$dep" in
|
||||||
|
/*.la)
|
||||||
|
echo "libtool($dep)"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
11
find-requires.pkgconfig
Executable file
11
find-requires.pkgconfig
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
pkgconfig=${1:-/usr/bin/pkg-config}
|
||||||
|
test -x $pkgconfig || exit 0
|
||||||
|
while read filename ; do
|
||||||
|
case "${filename}" in
|
||||||
|
*.pc)
|
||||||
|
$pkgconfig --print-requires --print-requires-private "$filename" 2> /dev/null | while read n r v ; do
|
||||||
|
echo "pkgconfig($n)" "$r" "$v"
|
||||||
|
done
|
||||||
|
esac
|
||||||
|
done
|
14
firmware.prov
Normal file
14
firmware.prov
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# firmware.prov - Automatically extract any and all firmware dependencies from
|
||||||
|
# kernel object (.ko) files and add to RPM deps.
|
||||||
|
|
||||||
|
IFS=$'\n'
|
||||||
|
|
||||||
|
for module in $(grep -E '/lib/modules/.+\.ko$') $*;
|
||||||
|
do
|
||||||
|
for firmware in `/sbin/modinfo -F firmware $module`;
|
||||||
|
do
|
||||||
|
echo "firmware($firmware)"
|
||||||
|
done
|
||||||
|
done
|
267
kmodtool
Executable file
267
kmodtool
Executable file
@ -0,0 +1,267 @@
|
|||||||
|
#!/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_version" ]; then
|
||||||
|
echo "Version: %{kmp_version}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "$kmp_release" ]; then
|
||||||
|
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
|
||||||
|
|
||||||
|
#
|
||||||
|
# RHEL5 - Remove common package requirement on general kmod packages.
|
||||||
|
# Requires: ${kmod_name}-kmod-common >= %{?epoch:%{epoch}:}%{version}
|
||||||
|
#
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
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=( \$(find /lib/modules/${verrel}${variant}/extra/${kmod_name}) )
|
||||||
|
if [ -x "/sbin/weak-modules" ]; then
|
||||||
|
printf '%s\n' "\${modules[@]}" \
|
||||||
|
| /sbin/weak-modules --add-modules
|
||||||
|
fi
|
||||||
|
%preun -n kmod-${kmod_name}${dashvariant}
|
||||||
|
rpm -ql kmod-${kmod_name}${dashvariant} | 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}/"
|
||||||
|
echo "/lib/firmware/"
|
||||||
|
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
|
284
macros
Normal file
284
macros
Normal file
@ -0,0 +1,284 @@
|
|||||||
|
# Per-platform rpm configuration file.
|
||||||
|
|
||||||
|
#==============================================================================
|
||||||
|
# ---- per-platform macros.
|
||||||
|
#
|
||||||
|
%_vendor redhat
|
||||||
|
%_os linux
|
||||||
|
%_target_platform %{_target_cpu}-%{_vendor}-%{_target_os}%{?_gnu}
|
||||||
|
|
||||||
|
#==============================================================================
|
||||||
|
# ---- configure macros. note that most of these are inherited
|
||||||
|
# from the defaults.
|
||||||
|
#
|
||||||
|
%_prefix /usr
|
||||||
|
%_sysconfdir /etc
|
||||||
|
%_localstatedir /var
|
||||||
|
%_infodir %{_prefix}/share/info
|
||||||
|
%_mandir %{_prefix}/share/man
|
||||||
|
|
||||||
|
%_defaultdocdir %{_prefix}/share/doc
|
||||||
|
%_pkgdocdir %{_docdir}/%{name}
|
||||||
|
%_docdir_fmt %%{NAME}
|
||||||
|
|
||||||
|
%_fmoddir %{_libdir}/gfortran/modules
|
||||||
|
|
||||||
|
%_enable_debug_packages 1
|
||||||
|
%_include_minidebuginfo 1
|
||||||
|
|
||||||
|
#==============================================================================
|
||||||
|
# ---- configure and makeinstall.
|
||||||
|
#
|
||||||
|
%_configure_libtool_hardening_hack 1
|
||||||
|
%_configure ./configure
|
||||||
|
%configure \
|
||||||
|
CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
|
||||||
|
CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
|
||||||
|
FFLAGS="${FFLAGS:-%optflags -I%_fmoddir}" ; export FFLAGS ; \
|
||||||
|
FCFLAGS="${FCFLAGS:-%optflags -I%_fmoddir}" ; export FCFLAGS ; \
|
||||||
|
LDFLAGS="${LDFLAGS:-%__global_ldflags}"; export LDFLAGS; \
|
||||||
|
for i in $(find . -name config.guess -o -name config.sub) ; do \
|
||||||
|
[ -f /usr/lib/rpm/redhat/$(basename $i) ] && %{__rm} -f $i && %{__cp} -fv /usr/lib/rpm/redhat/$(basename $i) $i ; \
|
||||||
|
done ; \
|
||||||
|
[ "%_configure_libtool_hardening_hack" = 1 ] && [ x != "x%{_hardened_ldflags}" ] && \
|
||||||
|
for i in $(find . -name ltmain.sh) ; do \
|
||||||
|
%{__sed} -i.backup -e 's~compiler_flags=$~compiler_flags="%{_hardened_ldflags}"~' $i \
|
||||||
|
done ; \
|
||||||
|
%{_configure} --build=%{_build} --host=%{_host} \\\
|
||||||
|
--program-prefix=%{?_program_prefix} \\\
|
||||||
|
--disable-dependency-tracking \\\
|
||||||
|
--prefix=%{_prefix} \\\
|
||||||
|
--exec-prefix=%{_exec_prefix} \\\
|
||||||
|
--bindir=%{_bindir} \\\
|
||||||
|
--sbindir=%{_sbindir} \\\
|
||||||
|
--sysconfdir=%{_sysconfdir} \\\
|
||||||
|
--datadir=%{_datadir} \\\
|
||||||
|
--includedir=%{_includedir} \\\
|
||||||
|
--libdir=%{_libdir} \\\
|
||||||
|
--libexecdir=%{_libexecdir} \\\
|
||||||
|
--localstatedir=%{_localstatedir} \\\
|
||||||
|
--sharedstatedir=%{_sharedstatedir} \\\
|
||||||
|
--mandir=%{_mandir} \\\
|
||||||
|
--infodir=%{_infodir}
|
||||||
|
|
||||||
|
%makeinstall \
|
||||||
|
%{__make} \\\
|
||||||
|
prefix=%{?buildroot:%{buildroot}}%{_prefix} \\\
|
||||||
|
exec_prefix=%{?buildroot:%{buildroot}}%{_exec_prefix} \\\
|
||||||
|
bindir=%{?buildroot:%{buildroot}}%{_bindir} \\\
|
||||||
|
sbindir=%{?buildroot:%{buildroot}}%{_sbindir} \\\
|
||||||
|
sysconfdir=%{?buildroot:%{buildroot}}%{_sysconfdir} \\\
|
||||||
|
datadir=%{?buildroot:%{buildroot}}%{_datadir} \\\
|
||||||
|
includedir=%{?buildroot:%{buildroot}}%{_includedir} \\\
|
||||||
|
libdir=%{?buildroot:%{buildroot}}%{_libdir} \\\
|
||||||
|
libexecdir=%{?buildroot:%{buildroot}}%{_libexecdir} \\\
|
||||||
|
localstatedir=%{?buildroot:%{buildroot}}%{_localstatedir} \\\
|
||||||
|
sharedstatedir=%{?buildroot:%{buildroot}}%{_sharedstatedir} \\\
|
||||||
|
mandir=%{?buildroot:%{buildroot}}%{_mandir} \\\
|
||||||
|
infodir=%{?buildroot:%{buildroot}}%{_infodir} \\\
|
||||||
|
install
|
||||||
|
|
||||||
|
# Maximum number of CPU's to use when building, 0 for unlimited.
|
||||||
|
%_smp_ncpus_max 16
|
||||||
|
%_smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \\\
|
||||||
|
&& RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
|
||||||
|
ncpus_max=%{?_smp_ncpus_max}; \\\
|
||||||
|
if [ -n "$ncpus_max" ] && [ "$ncpus_max" -gt 0 ] && [ "$RPM_BUILD_NCPUS" -gt "$ncpus_max" ]; then RPM_BUILD_NCPUS="$ncpus_max"; fi; \\\
|
||||||
|
if [ "$RPM_BUILD_NCPUS" -gt 1 ]; then echo "-j$RPM_BUILD_NCPUS"; fi)
|
||||||
|
|
||||||
|
#==============================================================================
|
||||||
|
# ---- Build policy macros.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#---------------------------------------------------------------------
|
||||||
|
# Expanded at beginning of %install scriptlet.
|
||||||
|
#
|
||||||
|
|
||||||
|
%__spec_install_pre %{___build_pre}\
|
||||||
|
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"\
|
||||||
|
mkdir -p `dirname "$RPM_BUILD_ROOT"`\
|
||||||
|
mkdir "$RPM_BUILD_ROOT"\
|
||||||
|
%{nil}
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------
|
||||||
|
# Expanded at end of %install scriptlet.
|
||||||
|
#
|
||||||
|
|
||||||
|
%__arch_install_post /usr/lib/rpm/check-buildroot
|
||||||
|
|
||||||
|
%__os_install_post \
|
||||||
|
/usr/lib/rpm/redhat/brp-compress \
|
||||||
|
%{!?__debug_package:\
|
||||||
|
/usr/lib/rpm/redhat/brp-strip %{__strip} \
|
||||||
|
/usr/lib/rpm/redhat/brp-strip-comment-note %{__strip} %{__objdump} \
|
||||||
|
} \
|
||||||
|
/usr/lib/rpm/redhat/brp-strip-static-archive %{__strip} \
|
||||||
|
/usr/lib/rpm/brp-python-bytecompile %{__python} %{?_python_bytecompile_errors_terminate_build} \
|
||||||
|
/usr/lib/rpm/redhat/brp-python-hardlink \
|
||||||
|
%{!?__jar_repack:/usr/lib/rpm/redhat/brp-java-repack-jars} \
|
||||||
|
%{nil}
|
||||||
|
|
||||||
|
# /usr/lib/rpm/redhat/brp-implant-ident-static
|
||||||
|
|
||||||
|
%__spec_install_post\
|
||||||
|
%{?__debug_package:%{__debug_install_post}}\
|
||||||
|
%{__arch_install_post}\
|
||||||
|
%{__os_install_post}\
|
||||||
|
%{nil}
|
||||||
|
|
||||||
|
|
||||||
|
# Template for debug information sub-package.
|
||||||
|
# NOTE: This is a copy from rpm to get the ifnarch noarch fix, it can be removed later
|
||||||
|
%debug_package \
|
||||||
|
%ifnarch noarch\
|
||||||
|
%global __debug_package 1\
|
||||||
|
%package debuginfo \
|
||||||
|
Summary: Debug information for package %{name}\
|
||||||
|
Group: Development/Debug\
|
||||||
|
AutoReqProv: 0\
|
||||||
|
%description debuginfo\
|
||||||
|
This package provides debug information for package %{name}.\
|
||||||
|
Debug information is useful when developing applications that use this\
|
||||||
|
package or when debugging this package.\
|
||||||
|
%files debuginfo -f debugfiles.list\
|
||||||
|
%defattr(-,root,root)\
|
||||||
|
%endif\
|
||||||
|
%{nil}
|
||||||
|
|
||||||
|
%install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\
|
||||||
|
%%install\
|
||||||
|
%{nil}
|
||||||
|
|
||||||
|
#
|
||||||
|
# use internal dep generator?
|
||||||
|
%_use_internal_dependency_generator 1
|
||||||
|
|
||||||
|
#
|
||||||
|
# Should missing %doc files terminate a build?
|
||||||
|
%_missing_doc_files_terminate_build 1
|
||||||
|
#
|
||||||
|
# Should missing buildids terminate a build?
|
||||||
|
%_missing_build_ids_terminate_build 1
|
||||||
|
|
||||||
|
#
|
||||||
|
# Should unpackaged files in a build root terminate a build?
|
||||||
|
%_unpackaged_files_terminate_build 1
|
||||||
|
|
||||||
|
#
|
||||||
|
## Should python bytecompilation errors terminate a build?
|
||||||
|
%_python_bytecompile_errors_terminate_build 1
|
||||||
|
|
||||||
|
# Use SHA-256 for FILEDIGESTS instead of default MD5
|
||||||
|
%_source_filedigest_algorithm 8
|
||||||
|
%_binary_filedigest_algorithm 8
|
||||||
|
|
||||||
|
# Use XZ compression for binary payloads
|
||||||
|
%_binary_payload w2.xzdio
|
||||||
|
|
||||||
|
%__find_provides /usr/lib/rpm/redhat/find-provides
|
||||||
|
%__find_requires /usr/lib/rpm/redhat/find-requires
|
||||||
|
|
||||||
|
%_hardening_cflags -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
|
||||||
|
# we don't escape symbols '~', '"', etc. so be careful when changing this
|
||||||
|
%_hardening_ldflags -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
|
||||||
|
|
||||||
|
#_hardened_build 0
|
||||||
|
%_hardened_cflags %{?_hardened_build:%{_hardening_cflags}}
|
||||||
|
%_hardened_ldflags %{?_hardened_build:%{_hardening_ldflags}}
|
||||||
|
|
||||||
|
%__global_cflags -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches %{_hardened_cflags}
|
||||||
|
%__global_ldflags -Wl,-z,relro %{_hardened_ldflags}
|
||||||
|
|
||||||
|
# Use these macros to differentiate between RH and other KMP implementation(s).
|
||||||
|
redhat_kernel_module_package 1
|
||||||
|
kernel_module_package_release 1
|
||||||
|
|
||||||
|
#kernel_module_package [ -n name ] [ -v version ] [ -r release ] [ -s script ]
|
||||||
|
# [ -f filelist] [ -x ] [ -p preamble ] flavor flavor ...
|
||||||
|
|
||||||
|
%kernel_module_package_buildreqs %global kmodtool_generate_buildreqs 1 \
|
||||||
|
kernel-devel
|
||||||
|
|
||||||
|
%kernel_module_package(n:v:r:s:f:xp:) %{expand:%( \
|
||||||
|
%define kmodtool %{-s*}%{!-s:/usr/lib/rpm/redhat/kmodtool} \
|
||||||
|
%define kmp_version %{-v*}%{!-v:%{version}} \
|
||||||
|
%define kmp_release %{-r*}%{!-r:%{release}} \
|
||||||
|
%define latest_kernel %(rpm -q --qf '%{VERSION}-%{RELEASE}\\\\n' `rpm -q kernel-devel | /usr/lib/rpm/redhat/rpmsort -r | head -n 1` | head -n 1) \
|
||||||
|
%{!?kernel_version:%{expand:%%global kernel_version %{latest_kernel}}} \
|
||||||
|
%global kverrel %(%{kmodtool} verrel %{?kernel_version} 2>/dev/null) \
|
||||||
|
flavors="default" \
|
||||||
|
if [ "i686" == "%{_target_cpu}" ] || [ "x86_64" == "%{_target_cpu}" ] \
|
||||||
|
then \
|
||||||
|
xenver=$(rpm -q kernel-xen-devel-%{kverrel}|head -n 1)\
|
||||||
|
kdver=$(rpm -q kernel-kdump-devel-%{kverrel}|head -n 1)\
|
||||||
|
if [ "kernel-xen-devel-%{kverrel}" == "$xenver" ] \
|
||||||
|
then \
|
||||||
|
flavors="$flavors xen" \
|
||||||
|
fi \
|
||||||
|
if [ "kernel-kdump-devel-%{kverrel}" == "$kdver" ] \
|
||||||
|
then \
|
||||||
|
flavors="$flavors kdump" \
|
||||||
|
fi \
|
||||||
|
fi \
|
||||||
|
if [ -z "%*" ]; then \
|
||||||
|
flavors_to_build=$flavors \
|
||||||
|
elif [ -z "%{-x}" ]; then \
|
||||||
|
flavors_to_build="%*" \
|
||||||
|
else \
|
||||||
|
flavors_to_build=" $flavors "\
|
||||||
|
echo "[$flavors_to_build]" >/tmp/tmp.txt
|
||||||
|
for i in %* \
|
||||||
|
do \
|
||||||
|
flavors_to_build=${flavors_to_build//$i /}
|
||||||
|
done \
|
||||||
|
fi \
|
||||||
|
echo "%%global flavors_to_build ${flavors_to_build:-%%nil}" \
|
||||||
|
echo "%%global kernel_source() /usr/src/kernels/%kverrel-\\\$([ %%%%{1} = default ] || echo "%%%%{1}.")%_target_cpu" \
|
||||||
|
if [ ! -z "%{-f*}" ] \
|
||||||
|
then \
|
||||||
|
filelist="%{-f*}" \
|
||||||
|
fi \
|
||||||
|
if [ ! -z "%{-p*}" ] \
|
||||||
|
then \
|
||||||
|
preamble="%{-p*}" \
|
||||||
|
fi \
|
||||||
|
if [ -z "%{kmodtool_generate_buildreqs}" ] \
|
||||||
|
then \
|
||||||
|
nobuildreqs="yes" \
|
||||||
|
fi \
|
||||||
|
kmp_override_filelist="$filelist" kmp_override_preamble="$preamble" kmp_nobuildreqs="$buildreqs" %{kmodtool} rpmtemplate_kmp %{-n*}%{!-n:%name} %{kverrel} $flavors_to_build 2>/dev/null \
|
||||||
|
)}
|
||||||
|
|
||||||
|
#==============================================================================
|
||||||
|
# ---- Generic auto req/prov filtering macros
|
||||||
|
#
|
||||||
|
# http://fedoraproject.org/wiki/PackagingDrafts/AutoProvidesAndRequiresFiltering
|
||||||
|
|
||||||
|
# prevent anything matching from being scanned for provides
|
||||||
|
%filter_provides_in(P) %{expand: \
|
||||||
|
%global __filter_prov_cmd %{?__filter_prov_cmd} %{__grep} -v %{-P} '%*' | \
|
||||||
|
}
|
||||||
|
|
||||||
|
# prevent anything matching from being scanned for requires
|
||||||
|
%filter_requires_in(P) %{expand: \
|
||||||
|
%global __filter_req_cmd %{?__filter_req_cmd} %{__grep} -v %{-P} '%*' | \
|
||||||
|
}
|
||||||
|
|
||||||
|
# filter anything matching out of the provides stream
|
||||||
|
%filter_from_provides() %{expand: \
|
||||||
|
%global __filter_from_prov %{?__filter_from_prov} | %{__sed} -e '%*' \
|
||||||
|
}
|
||||||
|
|
||||||
|
# filter anything matching out of the requires stream
|
||||||
|
%filter_from_requires() %{expand: \
|
||||||
|
%global __filter_from_req %{?__filter_from_req} | %{__sed} -e '%*' \
|
||||||
|
}
|
||||||
|
|
||||||
|
# actually set up the filtering bits
|
||||||
|
%filter_setup %{expand: \
|
||||||
|
%global _use_internal_dependency_generator 0 \
|
||||||
|
%global __deploop() while read FILE; do echo "${FILE}" | /usr/lib/rpm/rpmdeps -%{1}; done | /bin/sort -u \
|
||||||
|
%global __find_provides /bin/sh -c "%{?__filter_prov_cmd} %{__deploop P} %{?__filter_from_prov}" \
|
||||||
|
%global __find_requires /bin/sh -c "%{?__filter_req_cmd} %{__deploop R} %{?__filter_from_req}" \
|
||||||
|
}
|
||||||
|
|
39
macros.dwz
Normal file
39
macros.dwz
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# Macros for reducing debug info size using dwz(1) utility.
|
||||||
|
|
||||||
|
# The two default values below should result in dwz taking at most
|
||||||
|
# 3GB of RAM or so on 64-bit hosts and 2.5GB on 32-bit hosts
|
||||||
|
# on the largest *.debug files (in mid 2012 those are
|
||||||
|
# libreoffice-debuginfo, debuginfos containing
|
||||||
|
# libxul.so.debug and libwebkitgtk-*.so.*.debug).
|
||||||
|
# This needs to be tuned based on the amount of available RAM
|
||||||
|
# on build boxes for each architecture as well as virtual address
|
||||||
|
# space limitations if dwz is 32-bit program. While it needs less
|
||||||
|
# memory than 64-bit program because pointers are smaller, it can
|
||||||
|
# never have more than 4GB-epsilon of RAM and on some architecture
|
||||||
|
# even less than that (e.g. 2GB).
|
||||||
|
|
||||||
|
# Number of debugging information entries (DIEs) above which
|
||||||
|
# dwz will stop considering file for multifile optimizations
|
||||||
|
# and enter a low memory mode, in which it will optimize
|
||||||
|
# in about half the memory needed otherwise.
|
||||||
|
%_dwz_low_mem_die_limit 10000000
|
||||||
|
# Number of DIEs above which dwz will stop processing
|
||||||
|
# a file altogether.
|
||||||
|
%_dwz_max_die_limit 50000000
|
||||||
|
|
||||||
|
# On x86_64 increase the higher limit to make libwebkit* optimizable.
|
||||||
|
# libwebkit* in mid 2012 contains roughly 87mil DIEs, and 64-bit
|
||||||
|
# dwz is able to optimize it from ~1.1GB to ~410MB using 5.2GB of RAM.
|
||||||
|
%_dwz_max_die_limit_x86_64 110000000
|
||||||
|
|
||||||
|
# On ARM, build boxes often have only 512MB of RAM and are very slow.
|
||||||
|
# Lower both the limits.
|
||||||
|
%_dwz_low_mem_die_limit_armv5tel 4000000
|
||||||
|
%_dwz_low_mem_die_limit_armv7hl 4000000
|
||||||
|
%_dwz_max_die_limit_armv5tel 10000000
|
||||||
|
%_dwz_max_die_limit_armv7hl 10000000
|
||||||
|
|
||||||
|
%_dwz_limit() %{expand:%%{?%{1}_%{_arch}}%%{!?%{1}_%{_arch}:%%%{1}}}
|
||||||
|
%_find_debuginfo_dwz_opts --run-dwz\\\
|
||||||
|
--dwz-low-mem-die-limit %{_dwz_limit _dwz_low_mem_die_limit}\\\
|
||||||
|
--dwz-max-die-limit %{_dwz_limit _dwz_max_die_limit}
|
3
macros.ghc-srpm
Normal file
3
macros.ghc-srpm
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# macro defining the archs that ghc runs on in fedora
|
||||||
|
%ghc_arches %{ix86} x86_64 ppc ppc64 alpha sparcv9 armv7hl armv5tel s390 s390x
|
||||||
|
%ghc_arches_with_ghci %{ix86} x86_64 ppc sparcv9 armv7hl armv5tel
|
4
macros.gnat-srpm
Normal file
4
macros.gnat-srpm
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# GNAT_arches lists the architectures where GNAT is available in Fedora. Ada
|
||||||
|
# packages won't build on other architectures until GNAT is bootstrapped for
|
||||||
|
# them.
|
||||||
|
%GNAT_arches %{ix86} x86_64 ia64 ppc ppc64 alpha
|
2
macros.mono-srpm
Normal file
2
macros.mono-srpm
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# arches that mono builds on
|
||||||
|
%mono_arches %{ix86} x86_64 sparc sparcv9 ia64 %{arm} alpha s390x ppc ppc64
|
6
macros.nodejs-srpm
Normal file
6
macros.nodejs-srpm
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# nodejs_arches lists what arches Node.js and dependent packages run on.
|
||||||
|
#
|
||||||
|
# Enabling Node.js on other arches requires porting the V8 JavaScript JIT to
|
||||||
|
# those arches.
|
||||||
|
|
||||||
|
%nodejs_arches %{ix86} x86_64 %{arm}
|
2
macros.ocaml-srpm
Normal file
2
macros.ocaml-srpm
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# arches that ocaml runs on
|
||||||
|
%ocaml_arches alpha %{arm} %{ix86} ia64 x86_64 ppc sparc sparcv9 ppc64
|
76
modalias.prov
Normal file
76
modalias.prov
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
# heavily based upon find-suggests.ksyms by Andreas Gruenbacher <agruen@suse.de>.
|
||||||
|
# with modifications by Michael Brown <Michael_E_Brown@dell.com>
|
||||||
|
#
|
||||||
|
# -- added module versioning info to modalias() symbols
|
||||||
|
# -- removed code which inspects spec files.
|
||||||
|
|
||||||
|
IFS=$'\n'
|
||||||
|
|
||||||
|
#
|
||||||
|
# Initially, dont generate modalias() lines for kernel package. This needs
|
||||||
|
# additional discussion. Would like to eventually add them for
|
||||||
|
# completeness, so that we can determine when drivers are folded into
|
||||||
|
# mainline kernel.
|
||||||
|
#
|
||||||
|
case "$1" in
|
||||||
|
kernel-module-*) ;; # Fedora kernel module package names start with
|
||||||
|
# kernel-module.
|
||||||
|
kernel*) is_kernel_package=1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if ! [ -z "$is_kernel_package" ]; then
|
||||||
|
cat > /dev/null
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
print_modaliases() {
|
||||||
|
declare class=$1 variants=$2 pos=$3
|
||||||
|
if [ -n "$variants" ]; then
|
||||||
|
echo "${class:0:pos}[$variants]${class:pos+1}"
|
||||||
|
else
|
||||||
|
[ -z "$class" ] || echo "$class"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
combine_modaliases() {
|
||||||
|
declare tag class variants pos n
|
||||||
|
read class
|
||||||
|
while read tag; do
|
||||||
|
for ((n=0; n<${#class}; n++)); do
|
||||||
|
if [ "*" != "${class:n:1}" -a \
|
||||||
|
"${class:0:n}" = "${tag:0:n}" -a \
|
||||||
|
"${class:n+1}" = "${tag:n+1}" ] &&
|
||||||
|
( [ -z "$pos" ] || [ $n = $pos ] ); then
|
||||||
|
variants="${variants:-${class:n:1}}${tag:n:1}"
|
||||||
|
pos=$n
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ $n -eq ${#class} ]; then
|
||||||
|
print_modaliases "$class" "$variants" "$pos"
|
||||||
|
variants=
|
||||||
|
pos=
|
||||||
|
class=$tag
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
print_modaliases "$class" "$variants" "$pos"
|
||||||
|
}
|
||||||
|
|
||||||
|
for module in $(grep -E '/lib/modules/.+\.ko$') $*; do
|
||||||
|
# | head -n1 because some modules have *two* version tags. *cough*b44*cough*
|
||||||
|
modver=$(/sbin/modinfo -F version "$module"| head -n1)
|
||||||
|
modver=${modver// /_}
|
||||||
|
|
||||||
|
# only add version tag if it has a version
|
||||||
|
if [ -n "$modver" ]; then
|
||||||
|
/sbin/modinfo -F alias "$module" \
|
||||||
|
| sed -nre "s,(.+),modalias(\\1) = $modver,p"
|
||||||
|
else
|
||||||
|
/sbin/modinfo -F alias "$module" \
|
||||||
|
| sed -nre "s,(.+),modalias(\\1),p"
|
||||||
|
fi
|
||||||
|
done \
|
||||||
|
| sort -u \
|
||||||
|
| combine_modaliases
|
87
rpmrc
Normal file
87
rpmrc
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
include: /usr/lib/rpm/rpmrc
|
||||||
|
|
||||||
|
optflags: i386 %{__global_cflags} -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables
|
||||||
|
optflags: i486 %{__global_cflags} -m32 -march=i486 -fasynchronous-unwind-tables
|
||||||
|
optflags: i586 %{__global_cflags} -m32 -march=i586 -mtune=generic -fasynchronous-unwind-tables
|
||||||
|
optflags: i686 %{__global_cflags} -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables
|
||||||
|
optflags: athlon %{__global_cflags} -m32 -march=athlon -fasynchronous-unwind-tables
|
||||||
|
optflags: ia64 %{__global_cflags}
|
||||||
|
optflags: x86_64 %{__global_cflags} -m64 -mtune=generic
|
||||||
|
|
||||||
|
optflags: alpha %{__global_cflags} -mieee
|
||||||
|
optflags: alphaev5 %{__global_cflags} -mieee -mcpu=ev5
|
||||||
|
optflags: alphaev56 %{__global_cflags} -mieee -mcpu=ev56
|
||||||
|
optflags: alphapca56 %{__global_cflags} -mieee -mcpu=pca56
|
||||||
|
optflags: alphaev6 %{__global_cflags} -mieee -mcpu=ev6
|
||||||
|
optflags: alphaev67 %{__global_cflags} -mieee -mcpu=ev67
|
||||||
|
|
||||||
|
optflags: sparc %{__global_cflags} -m32 -mcpu=v7 -mtune=ultrasparc
|
||||||
|
optflags: sparcv8 %{__global_cflags} -m32 -mcpu=v8
|
||||||
|
optflags: sparcv9 %{__global_cflags} -m32 -mcpu=ultrasparc
|
||||||
|
optflags: sparcv9v %{__global_cflags} -m32 -mcpu=niagara
|
||||||
|
optflags: sparc64 %{__global_cflags} -m64 -mcpu=ultrasparc
|
||||||
|
optflags: sparc64v %{__global_cflags} -m64 -mcpu=niagara
|
||||||
|
|
||||||
|
optflags: m68k %{__global_cflags}
|
||||||
|
|
||||||
|
optflags: ppc %{__global_cflags} -m32
|
||||||
|
optflags: ppciseries %{__global_cflags} -m32
|
||||||
|
optflags: ppcpseries %{__global_cflags} -m32
|
||||||
|
optflags: ppc64 %{__global_cflags} -m64
|
||||||
|
optflags: ppc64le %{__global_cflags} -m64
|
||||||
|
optflags: ppc64iseries %{__global_cflags} -m64
|
||||||
|
optflags: ppc64pseries %{__global_cflags} -m64
|
||||||
|
optflags: ppc8260 %{__global_cflags} -m32
|
||||||
|
optflags: ppc8560 %{__global_cflags} -m32
|
||||||
|
|
||||||
|
optflags: parisc %{__global_cflags} -mpa-risc-1-0
|
||||||
|
optflags: hppa1.0 %{__global_cflags} -mpa-risc-1-0
|
||||||
|
optflags: hppa1.1 %{__global_cflags} -mpa-risc-1-0
|
||||||
|
optflags: hppa1.2 %{__global_cflags} -mpa-risc-1-0
|
||||||
|
optflags: hppa2.0 %{__global_cflags} -mpa-risc-1-0
|
||||||
|
|
||||||
|
optflags: mips %{__global_cflags}
|
||||||
|
optflags: mipsel %{__global_cflags}
|
||||||
|
|
||||||
|
optflags: armv3l %{__global_cflags} -fsigned-char -march=armv3
|
||||||
|
optflags: armv4b %{__global_cflags} -fsigned-char -march=armv4
|
||||||
|
optflags: armv4l %{__global_cflags} -fsigned-char -march=armv4
|
||||||
|
optflags: armv4tl %{__global_cflags} -march=armv4t
|
||||||
|
optflags: armv5tel %{__global_cflags} -march=armv5te -mfloat-abi=soft
|
||||||
|
optflags: armv5tejl %{__global_cflags} -march=armv5te -mfloat-abi=soft
|
||||||
|
optflags: armv6l %{__global_cflags} -march=armv6 -mfloat-abi=soft
|
||||||
|
optflags: armv7l %{__global_cflags} -march=armv7-a -mfloat-abi=soft
|
||||||
|
optflags: armv7hl %{__global_cflags} -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard
|
||||||
|
optflags: armv7hnl %{__global_cflags} -march=armv7-a -mfpu=neon -mfloat-abi=hard
|
||||||
|
|
||||||
|
optflags: atarist %{__global_cflags}
|
||||||
|
optflags: atariste %{__global_cflags}
|
||||||
|
optflags: ataritt %{__global_cflags}
|
||||||
|
optflags: falcon %{__global_cflags}
|
||||||
|
optflags: atariclone %{__global_cflags}
|
||||||
|
optflags: milan %{__global_cflags}
|
||||||
|
optflags: hades %{__global_cflags}
|
||||||
|
|
||||||
|
optflags: s390 %{__global_cflags} -m31 -march=z9-109 -mtune=z10
|
||||||
|
optflags: s390x %{__global_cflags} -m64 -march=z9-109 -mtune=z10
|
||||||
|
|
||||||
|
optflags: aarch64 %{__global_cflags} -fno-stack-protector
|
||||||
|
|
||||||
|
# set build arch to fedora buildarches on hardware capable of running it
|
||||||
|
# saves having to do rpmbuild --target=
|
||||||
|
buildarchtranslate: athlon: i686
|
||||||
|
buildarchtranslate: geode: i686
|
||||||
|
buildarchtranslate: pentium4: i686
|
||||||
|
buildarchtranslate: pentium3: i686
|
||||||
|
buildarchtranslate: i686: i686
|
||||||
|
buildarchtranslate: i586: i586
|
||||||
|
|
||||||
|
buildarchtranslate: sparcv9: sparcv9
|
||||||
|
buildarchtranslate: sparcv9v: sparcv9
|
||||||
|
|
||||||
|
buildarchtranslate: armv5tejl: armv5tel
|
||||||
|
buildarchtranslate: armv6l: armv5tel
|
||||||
|
buildarchtranslate: armv7l: armv5tel
|
||||||
|
buildarchtranslate: armv7hl: armv7hl
|
||||||
|
buildarchtranslate: armv7hnl: armv7hl
|
||||||
|
|
76
rpmsort
Executable file
76
rpmsort
Executable 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);
|
||||||
|
}
|
40
symset-table
Executable file
40
symset-table
Executable file
@ -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
|
Loading…
Reference in New Issue
Block a user