rpm-build/scripts/find-debuginfo-files.in
Alexey Tourbin 845fefb64f brp-debuginfo: recognize $RPM_BRP_STRIP_DEBUG and $RPM_BRP_STRIP_NONE
This finally provides missing strip controls.  Note that even with
STRIP_NONE, the file will be edited with debugedit.  So there is no
way to bypass brp-debuginfo completely (and maybe we should tolerate
debugedit failures with STRIP_NONE).  But there is also an advantage:
/usr/src/debug sources will be installed even for non-stripped files!
This is why sources are now associated with .debuginfo/src/"$f"
instead of .debuginfo/src/"$debugf".
2011-02-03 11:30:45 +03:00

70 lines
1.5 KiB
Bash
Executable File

#!/bin/sh -efu
#
# find-debuginfo-files - make %files list for debuginfo package
#
# Written by Alexey Tourbin <at@altlinux.org>.
# License: GPLv2+.
. @RPMCONFIGDIR@/functions
ValidateBuildRoot
cd "$RPM_BUILD_ROOT"
rm -rf .tmp
mkdir .tmp
>.tmp/files
>.tmp/links
>.tmp/src
while read -r f; do
f=${f#$RPM_BUILD_ROOT}
if [ -f .debuginfo/src/"$f" ]; then
LC_ALL=C sort -m -u -o .tmp/src .tmp/src .debuginfo/src/"$f"
fi
debugf=./usr/lib/debug$f.debug
[ -f "$debugf" ] && [ ! -L "$debugf" ] || continue
printf '%s\n' "${debugf#.}" >>.tmp/files
if [ -f .debuginfo/links/"$debugf" ]; then
cat .debuginfo/links/"$debugf" >>.tmp/links
fi
id=$(@RPMCONFIGDIR@/debugedit -i "$debugf")
[ -n "$id" ] || continue
link=./usr/lib/debug/.build-id/${id:0:2}/${id:2}
if [ ! -L "$link" ]; then
mkdir -p "${link%/*}"
ln -snf "$(relative "$f" "${link#.}")" "$link"
ln -snf "$(relative "${debugf#.}" "${link#.}".debug)" "$link".debug
fi
to=$(readlink -vm "$link")
if [ "$to" = "$RPM_BUILD_ROOT$f" ]; then
printf '%s\n' "${link#.}" >>.tmp/links
printf '%s\n' "${link#.}".debug >>.tmp/links
fi
done
sed 's|\(.*\)/.*|\1|' .tmp/files .tmp/links .tmp/src |sort -u |
while read -r dir; do
while [ -n "$dir" ]; do
case $dir in
/usr/lib/debug/usr/*/*)
printf '%s\n' "$dir" ;;
/usr/lib/debug/usr/*)
break ;;
/usr/lib/debug/*/*)
printf '%s\n' "$dir" ;;
/usr/lib/debug/*)
break ;;
/usr/src/debug/*)
printf '%s\n' "$dir" ;;
*)
break ;;
esac
dir=${dir%/*}
done
done |
sort -u |
sed 's/^/%dir /'
sort .tmp/files .tmp/links .tmp/src