find-debuginfo-files: fix packaging of symlinks

Package only those /usr/lib/debug/* symlinks that complement the package
being processed and point to debuginfo regular files which are going to
be packaged along with these symlinks.

The most obvious consequence of this change is that library symlinks for
use of ld(1) will not result to their
/usr/lib/debug/usr/lib*/libNAME.so.debug counterparts to be packaged.
This commit is contained in:
Дмитрий Левин 2011-12-06 15:04:05 +00:00
parent bf54b11cf4
commit 9e73931c30

View File

@ -14,7 +14,9 @@ rm -rf .tmp
mkdir .tmp
>.tmp/files
>.tmp/files-can
>.tmp/links
>.tmp/links-in
>.tmp/src
while read -r f; do
@ -22,14 +24,22 @@ while read -r f; do
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
[ -f "$debugf" ] || continue
if [ -L "$debugf" ]; then
# Save symlink for later filtering.
printf '%s\n' "$debugf" >> .tmp/links-in
continue
fi
printf '%s\n' "${debugf#.}" >> .tmp/files
# Save canonical file name for later symlinks filtering.
readlink -ve "$debugf" >> .tmp/files-can
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%/*}"
@ -38,8 +48,17 @@ while read -r f; do
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
printf '%s\n' "${link#.}" >> .tmp/links
printf '%s\n' "${link#.}".debug >> .tmp/links
fi
done
# Filter out symlinks pointing out of the package.
sort -u .tmp/links-in |
while read -r link; do
to=$(readlink -vm "$link")
if grep -Fqsxe "$to" .tmp/files-can; then
printf '%s\n' "${link#.}" >> .tmp/links
fi
done