rpm/rpm-5.4.4-merge-find-debuginfo.sh-from-mandriva.patch
2012-02-01 18:08:07 +04:00

50 lines
1.9 KiB
Diff

--- rpm-5.4.4/scripts/find-debuginfo.sh.mdv~ 2011-10-21 17:35:46.000000000 +0200
+++ rpm-5.4.4/scripts/find-debuginfo.sh 2011-11-11 10:25:50.301878554 +0100
@@ -91,10 +91,10 @@ strip_to_debug()
{
local g=
$strip_g && case "$(file -bi "$2")" in
- application/x-sharedlib,*) g=-g ;;
+ application/x-sharedlib*) g=-g ;;
esac
- eu-strip --remove-comment $g -f "$1" "$2" || exit
- chmod 444 "$1" || exit
+ eu-strip --remove-comment $g $([ -n "$DISABLE_DEBUG" ] || echo -f "$1") "$2" || exit
+ [ -n "$DISABLE_DEBUG" ] || chmod 444 "$1" || exit
}
# Make a relative symlink to $1 called $3$2
@@ -174,13 +174,23 @@ set -o pipefail
strict_error=ERROR
$strict || strict_error=WARNING
+[[ -n "$EXCLUDE_FROM_STRIP" ]] && \
+EXCLUDE_REGEXP=`perl -e 'print "(", join("|", @ARGV), ")"' $EXCLUDE_FROM_STRIP`
+[[ -n "$EXCLUDE_FROM_FULL_STRIP" ]] && \
+EXCLUDE_FULL_REGEXP=`perl -e 'print "(", join("|", @ARGV), ")"' $EXCLUDE_FROM_FULL_STRIP`
+
+echo $EXCLUDE_REGEXP
# Strip ELF binaries
find "$RPM_BUILD_ROOT" ! -path "${debugdir}/*.debug" -type f \
- \( -perm -0100 -or -perm -0010 -or -perm -0001 \) \
+ \( -name \*.ko -or -perm -0100 -or -perm -0010 -or -perm -0001 \) \
-print | LANG=C sort |
file -N -f - | sed -n -e 's/^\(.*\):[ ]*.*ELF.*, not stripped/\1/p' |
xargs --no-run-if-empty stat -c '%h %D_%i %n' |
while read nlinks inum f; do
+ [ -n "$EXCLUDE_REGEXP" ] && grep -E -q "$EXCLUDE_REGEXP" <<< "$f" && \
+ continue
+ [ -n "$DISABLE_DEBUG" ] && strip_to_debug "" "$f" && continue
+
get_debugfn "$f"
[ -f "${debugfn}" ] && continue
@@ -256,7 +266,7 @@ fi
if [ -d "${RPM_BUILD_ROOT}/usr/lib" -o -d "${RPM_BUILD_ROOT}/usr/src" ]; then
((nout > 0)) ||
- test ! -d "${RPM_BUILD_ROOT}/usr/lib" ||
+ test ! -d "${RPM_BUILD_ROOT}/usr/lib/debug" ||
(cd "${RPM_BUILD_ROOT}/usr/lib"; find debug -type d) | LANG=C sort |
sed 's,^,%dir /usr/lib/,' >> "$LISTFILE"