2006-12-19 00:17:44 +01:00
|
|
|
SUSE specific brp script patches
|
|
|
|
|
2011-05-16 18:07:44 +02:00
|
|
|
--- ./scripts/Makefile.am.orig 2010-12-03 12:11:57.000000000 +0000
|
|
|
|
+++ ./scripts/Makefile.am 2011-05-11 14:31:45.000000000 +0000
|
|
|
|
@@ -6,6 +6,7 @@ CLEANFILES =
|
|
|
|
|
|
|
|
EXTRA_DIST = \
|
|
|
|
brp-compress brp-python-bytecompile brp-java-gcjcompile \
|
|
|
|
+ brp-lib64-linux brp-symlink \
|
|
|
|
brp-strip brp-strip-comment-note brp-python-hardlink \
|
|
|
|
brp-strip-shared brp-strip-static-archive \
|
|
|
|
check-files check-prereqs \
|
|
|
|
@@ -24,6 +25,7 @@ EXTRA_DIST = \
|
|
|
|
|
|
|
|
rpmconfig_SCRIPTS = \
|
|
|
|
brp-compress brp-python-bytecompile brp-java-gcjcompile \
|
|
|
|
+ brp-lib64-linux brp-symlink \
|
|
|
|
brp-strip brp-strip-comment-note brp-python-hardlink \
|
|
|
|
brp-strip-shared brp-strip-static-archive \
|
|
|
|
check-files check-prereqs \
|
|
|
|
--- ./scripts/brp-lib64-linux.orig 2011-05-11 14:30:08.000000000 +0000
|
|
|
|
+++ ./scripts/brp-lib64-linux 2011-05-11 14:30:08.000000000 +0000
|
2006-12-19 00:17:44 +01:00
|
|
|
@@ -0,0 +1,42 @@
|
2008-09-12 20:37:28 +02:00
|
|
|
+#!/bin/bash
|
2006-12-19 00:17:44 +01:00
|
|
|
+# script checks wether package is 64-bit clean
|
|
|
|
+# and also for a linker bug. (linker allows 64bit libs to link 32bit libs)
|
|
|
|
+echo "sf@suse.de: if you find problems with this script, drop me a note"
|
|
|
|
+# If using normal root, avoid changing anything:
|
|
|
|
+if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
|
|
|
|
+ exit 0
|
|
|
|
+fi
|
|
|
|
+files=
|
|
|
|
+tfiles=
|
|
|
|
+LC_ALL=
|
|
|
|
+LANG=
|
|
|
|
+# check for 64-bit libs in */lib
|
|
|
|
+for p in `grep -v 'lib64' /etc/ld.so.conf`
|
|
|
|
+do
|
|
|
|
+ if test -d $RPM_BUILD_ROOT$p ; then
|
|
|
|
+ for f in `find $RPM_BUILD_ROOT$p \
|
|
|
|
+ -maxdepth 1 -type f -name \*.so\* -o -name \*.a -follow 2>/dev/null`
|
|
|
|
+ do
|
|
|
|
+ [ $HOSTTYPE = s390x ] && case $f in */lib/ld64.so.1) continue; esac
|
|
|
|
+ objdump -f $f 2>/dev/null | grep 'format elf64' \
|
|
|
|
+ && { echo "$f: should be in */lib64"; exit 1; }
|
|
|
|
+
|
|
|
|
+ done
|
|
|
|
+ fi
|
|
|
|
+done
|
|
|
|
+
|
|
|
|
+# check for 64 bit libs that have an rpath to a 32 bit Library
|
|
|
|
+
|
|
|
|
+for p in `grep 'lib64' /etc/ld.so.conf`
|
|
|
|
+do
|
|
|
|
+ if test -d $RPM_BUILD_ROOT$p ; then
|
|
|
|
+ for f in `find $RPM_BUILD_ROOT$p \
|
|
|
|
+ -maxdepth 1 -type f -name \*.so\* -o -name \*.a -follow 2>/dev/null`
|
|
|
|
+ do
|
|
|
|
+ # check for rpath to 32bit libs
|
|
|
|
+ objdump -x $f 2>/dev/null | grep -v "lib64" | grep -i 'rpath.*lib$' \
|
|
|
|
+ && { echo "$f: rpath to 32bit lib"; exit 1; }
|
|
|
|
+ done
|
|
|
|
+ fi
|
|
|
|
+done
|
|
|
|
+exit 0
|
2011-05-16 18:07:44 +02:00
|
|
|
--- ./scripts/brp-strip-comment-note.orig 2010-12-03 12:11:57.000000000 +0000
|
|
|
|
+++ ./scripts/brp-strip-comment-note 2011-05-11 14:30:08.000000000 +0000
|
|
|
|
@@ -16,6 +16,8 @@ esac
|
2006-12-19 00:17:44 +01:00
|
|
|
# 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" | \
|
|
|
|
+ grep -v ' shared object,' | \
|
|
|
|
+ grep -v '/lib/modules/' | \
|
|
|
|
sed -n -e 's/^\(.*\):[ ]*ELF.*, stripped/\1/p'`; do
|
|
|
|
note="-R .note"
|
2011-05-16 18:07:44 +02:00
|
|
|
if $OBJDUMP -h $f | grep '^[ ]*[0-9]*[ ]*.note[ ]' -A 1 | \
|
|
|
|
--- ./scripts/brp-strip.orig 2010-12-03 12:11:57.000000000 +0000
|
|
|
|
+++ ./scripts/brp-strip 2011-05-11 14:30:08.000000000 +0000
|
|
|
|
@@ -15,6 +15,7 @@ esac
|
|
|
|
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,' | \
|
|
|
|
+ grep -v '/lib/modules/' | \
|
|
|
|
sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'`; do
|
|
|
|
$STRIP -g "$f" || :
|
|
|
|
done
|
|
|
|
--- ./scripts/brp-symlink.orig 2011-05-11 14:30:08.000000000 +0000
|
|
|
|
+++ ./scripts/brp-symlink 2011-05-11 14:30:08.000000000 +0000
|
2008-12-15 11:56:27 +01:00
|
|
|
@@ -0,0 +1,184 @@
|
2006-12-19 00:17:44 +01:00
|
|
|
+#!/bin/sh
|
|
|
|
+
|
|
|
|
+# Task: go through the files in $RPM_BUILD_ROOT and
|
|
|
|
+# relink symbolic links so that:
|
|
|
|
+# links crossing top level directory boundaries (/usr/* -> /etc/*)
|
|
|
|
+# are absolute links
|
|
|
|
+# links below one top level directory (/usr/bin/* -> /usr/lib/*)
|
|
|
|
+# are relative links
|
|
|
|
+# NOTE: we're not doing this to fix a problem (as no matter how you
|
|
|
|
+# do it you fix one problem by creating another). We're doing it
|
|
|
|
+# so we can document this as policy - so you can rely on it
|
|
|
|
+
|
|
|
|
+# Additional Task: check some usual errors arround symlinks e.g.
|
|
|
|
+# dangling symlinks or symlinks to init scripts in wrong location
|
|
|
|
+
|
|
|
|
+# Author: Stephan Kulow <coolo@suse.de>
|
|
|
|
+
|
|
|
|
+# If using normal root, avoid changing anything.
|
|
|
|
+if [ -z "$RPM_BUILD_ROOT" ]; then
|
|
|
|
+ exit 0
|
|
|
|
+fi
|
|
|
|
+
|
|
|
|
+LC_ALL=
|
|
|
|
+LANG=
|
|
|
|
+LC_TIME=POSIX
|
|
|
|
+
|
|
|
|
+BASENAME=/usr/bin/basename
|
|
|
|
+DIRNAME=/usr/bin/dirname
|
|
|
|
+READLINK=/usr/bin/readlink
|
|
|
|
+
|
|
|
|
+cd $RPM_BUILD_ROOT
|
|
|
|
+
|
|
|
|
+had_errors=0
|
|
|
|
+
|
|
|
|
+links=`find . -type l | sed -e "s,^./,/,"`
|
|
|
|
+for link in $links
|
|
|
|
+do
|
|
|
|
+ link_dest=`$READLINK ./$link`
|
|
|
|
+ orig_link_dest=$link_dest
|
|
|
|
+
|
|
|
|
+ new_link_dest=NONE
|
|
|
|
+ link_dir=`$DIRNAME $link`
|
|
|
|
+
|
|
|
|
+ case $link_dest in
|
|
|
|
+ .|..|../..) # link to current dir
|
|
|
|
+ continue ;;
|
|
|
|
+ .*) # relative links up
|
|
|
|
+ link_dest="$link_dir/$link_dest"
|
|
|
|
+ ;;
|
|
|
|
+ /*) # absolute links
|
|
|
|
+ ;;
|
|
|
|
+ */*) # relative links down
|
|
|
|
+ link_dest="$link_dir/$link_dest"
|
|
|
|
+ ;;
|
|
|
|
+ *) # the rest
|
|
|
|
+ continue
|
|
|
|
+ esac
|
|
|
|
+
|
|
|
|
+ # cleaning out double slash
|
|
|
|
+ link_dest=`echo $link_dest | sed -e 's,//*,/,g; s,/\.$,/,; s,/$,,'`
|
|
|
|
+
|
|
|
|
+ # eliminating /./ components
|
|
|
|
+ link_dest=`echo $link_dest | sed -e "s,/\./,/,g"`;
|
|
|
|
+
|
|
|
|
+ counter=0
|
|
|
|
+ # eliminating back references
|
|
|
|
+ while echo $link_dest | egrep -q '/\.\.'; do
|
|
|
|
+ link_dest=`echo $link_dest | sed -e "s,/[^/]*/\.\.,,"`;
|
|
|
|
+ case $link_dest in
|
|
|
|
+ /..*) # this is very mean
|
|
|
|
+ echo "ERROR: $link points to illegal $link_dest"
|
|
|
|
+ exit 1
|
|
|
|
+ ;;
|
|
|
|
+ esac
|
|
|
|
+ counter=$((counter + 1))
|
|
|
|
+ if test $counter -gt 10; then
|
|
|
|
+ echo "ERROR: more than 10 back references in $link?"
|
|
|
|
+ exit 1
|
|
|
|
+ fi
|
|
|
|
+ done
|
|
|
|
+
|
|
|
|
+ # black list
|
|
|
|
+ case "$link,$link_dest" in
|
|
|
|
+ *,/var/lib/named*)
|
|
|
|
+ continue;;
|
|
|
|
+ /usr/etc,*|/usr/tmp,*)
|
|
|
|
+ continue;;
|
|
|
|
+ */share/texmf/*|/usr/share/terminfo/*)
|
|
|
|
+ continue;;
|
|
|
|
+ *share/automake-*)
|
|
|
|
+ echo "ERROR: link target $link points into automake directory"
|
|
|
|
+ echo " You might want to add a -c to the automake call (or just"
|
|
|
|
+ echo " skip the files from packaging)"
|
|
|
|
+ exit 1
|
|
|
|
+ ;;
|
2008-02-01 19:33:28 +01:00
|
|
|
+ *,/opt/kde3/share/doc*/HTML/*/common) # white listed for not existant
|
2006-12-19 00:17:44 +01:00
|
|
|
+ ;;
|
2009-04-23 18:29:01 +02:00
|
|
|
+ *,/usr/share/doc/kde/HTML/*/common) # white listed for not existant
|
2008-12-15 11:56:27 +01:00
|
|
|
+ ;;
|
2006-12-19 00:17:44 +01:00
|
|
|
+ *,/proc/*) # links pointing into /proc file system
|
|
|
|
+ ;;
|
|
|
|
+ *)
|
|
|
|
+ if test ! -L ./$link_dest && test ! -e $link_dest && test ! -e ./$link_dest; then
|
|
|
|
+ echo "ERROR: link target doesn't exist (neither in build root nor in installed system):"
|
|
|
|
+ echo " $link -> $link_dest"
|
|
|
|
+ echo "Add the package providing the target to neededforbuild and Requires"
|
|
|
|
+ test "$NO_BRP_STALE_LINK_ERROR" != "yes" && had_errors=1
|
|
|
|
+ fi
|
|
|
|
+ ;;
|
|
|
|
+ esac
|
|
|
|
+
|
|
|
|
+ forced_absolute=0
|
|
|
|
+ for prefix in /usr/X11R6/lib/X11 /usr/X11R6/include/X11 /usr/X11R6/lib/X11/app-defaults ; do
|
|
|
|
+ if echo $link | grep -q "^$prefix/"; then
|
|
|
|
+ if echo $link_dest | grep -q "^$prefix/"; then
|
|
|
|
+ # if it's below it, it's fine
|
|
|
|
+ :
|
|
|
|
+ else
|
|
|
|
+ forced_absolute=1
|
|
|
|
+ fi
|
|
|
|
+ fi
|
|
|
|
+ done
|
|
|
|
+
|
|
|
|
+ dest_dir=`$DIRNAME $link_dest`
|
|
|
|
+
|
|
|
|
+ # figuring out (currently) correct destination
|
|
|
|
+ if test "$link_dir" = "$dest_dir" || test "$dest_dir" = "."; then
|
|
|
|
+ new_link_dest=`$BASENAME $link_dest`
|
|
|
|
+ else
|
|
|
|
+ # figuring out top level directory
|
|
|
|
+ top_link=`echo $link | sed -e 's,^\(/[^/]*\)/.*,\1,'`
|
|
|
|
+ top_dest=`echo $link_dest | sed -e 's,^\(/[^/]*\)/.*,\1,'`
|
|
|
|
+ if test "$forced_absolute" = 0 && test "$top_link" = "$top_dest"; then # supposed to be relative
|
|
|
|
+
|
|
|
|
+ # first we need to cut out the common prefix
|
|
|
|
+ link_tmp=$link
|
|
|
|
+ while test "$top_link" = "$top_dest"; do
|
|
|
|
+ link_orig=$link_tmp
|
|
|
|
+ dest_orig=$link_dest
|
|
|
|
+ link_tmp=`echo $link_tmp | sed -e 's,^\(/[^/]*\)/,/,'`
|
|
|
|
+ link_dest=`echo $link_dest | sed -e 's,^\(/[^/]*\)/,/,'`
|
|
|
|
+ top_link=`echo $link_tmp | sed -e 's,^\(/[^/]*\)/.*,\1,'`
|
|
|
|
+ top_dest=`echo $link_dest | sed -e 's,^\(/[^/]*\)/.*,\1,'`
|
|
|
|
+
|
|
|
|
+ if test "$top_dest" = "$dest_orig" || test "$top_link" = "$link_orig"; then
|
|
|
|
+ link_tmp=$link_orig
|
|
|
|
+ link_dest=$dest_orig
|
|
|
|
+ break
|
|
|
|
+ fi
|
|
|
|
+ done
|
|
|
|
+
|
|
|
|
+ # now we add a .. for every directory component
|
|
|
|
+ link_tmp=`$DIRNAME $link_tmp`
|
|
|
|
+
|
|
|
|
+ if test "$link_tmp" = "$link_dest"; then
|
|
|
|
+ new_link_dest=.
|
|
|
|
+ elif test "$link_tmp" != "/"; then # we have a directory component
|
|
|
|
+ link_rel=
|
|
|
|
+
|
|
|
|
+ while test -n "$link_tmp"; do
|
|
|
|
+ link_tmp=`echo $link_tmp | sed -e 's,^\(/[^/]*\),,'`
|
|
|
|
+ link_rel="../$link_rel"
|
|
|
|
+ done
|
|
|
|
+
|
|
|
|
+ new_link_dest=`echo $link_rel/$link_dest | sed -e "s,//*,/,g"`
|
|
|
|
+ else
|
|
|
|
+ # get rid of the slash
|
|
|
|
+ link_dest=`echo $link_dest | sed -e 's,^/,,'`
|
|
|
|
+ new_link_dest=$link_dest
|
|
|
|
+ fi
|
|
|
|
+ else
|
|
|
|
+ new_link_dest=$link_dest
|
|
|
|
+ fi
|
|
|
|
+ fi
|
|
|
|
+
|
|
|
|
+ if test "$new_link_dest" != NONE && test "$new_link_dest" != "$orig_link_dest"; then
|
|
|
|
+ echo "INFO: relinking $link -> $new_link_dest (was $orig_link_dest)"
|
|
|
|
+ rm ./$link && ln -s $new_link_dest ./$link
|
|
|
|
+ fi
|
|
|
|
+done
|
|
|
|
+
|
|
|
|
+if test "$had_errors" = 1; then
|
|
|
|
+ exit 1
|
|
|
|
+fi
|