aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-07-27 17:38:41 +0000
committerThierry Vignaud <tv@mageia.org>2012-07-27 17:38:41 +0000
commitc8af0d7a062c9d74109a845987b9ca82806b7d67 (patch)
tree1e0fa699c284a6e15b4cd64bec395f9a77e86e38
parent856d715d5b8db51aeae349c8e5bde2cfbd55bdf7 (diff)
downloadrpm-setup-c8af0d7a062c9d74109a845987b9ca82806b7d67.tar
rpm-setup-c8af0d7a062c9d74109a845987b9ca82806b7d67.tar.gz
rpm-setup-c8af0d7a062c9d74109a845987b9ca82806b7d67.tar.bz2
rpm-setup-c8af0d7a062c9d74109a845987b9ca82806b7d67.tar.xz
rpm-setup-c8af0d7a062c9d74109a845987b9ca82806b7d67.zip
Generate debug symlinks for all filenames sharing a build-id (RhBug:641377)
(rpm.org, Jan Kratochvil <jan.kratochvil@redhat.com>, 2012-03-07)
-rw-r--r--NEWS1
-rwxr-xr-xfind-debuginfo.sh25
2 files changed, 26 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 9d34987..b9fb3fc 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@
(Mark Wielaard, 2011-05-25)
o create GDB index from find-debuginfo if possible (Tom Tromey, RhBug:617166)
o drop useless rpm5 bits (less divergence with upstream)
+ o generate debug symlinks for all filenames sharing a build-id (RhBug:641377)
o fix behavior on cross-directory hardlinks (RhBug:618426)
- kill unused find-provides.perl.in
- prevent RPM_BUILD_ROOT to break brp-* scripts if it contains spaces
diff --git a/find-debuginfo.sh b/find-debuginfo.sh
index fe6a4da..3427fdb 100755
--- a/find-debuginfo.sh
+++ b/find-debuginfo.sh
@@ -137,6 +137,23 @@ debug_link()
link_relative "$t" "$l" "$RPM_BUILD_ROOT"
}
+# Provide .2, .3, ... symlinks to all filename instances of this build-id.
+make_id_dup_link()
+{
+ local id="$1" file="$2" idfile
+
+ local n=1
+ while true; do
+ idfile=".build-id/${id:0:2}/${id:2}.$n"
+ [ $# -eq 3 ] && idfile="${idfile}$3"
+ if [ ! -L "$RPM_BUILD_ROOT/usr/lib/debug/$idfile" ]; then
+ break
+ fi
+ n=$[$n+1]
+ done
+ debug_link "$file" "/$idfile"
+}
+
# Make a build-id symlink for id $1 with suffix $3 to file $2.
make_id_link()
{
@@ -150,6 +167,8 @@ make_id_link()
return
fi
+ make_id_dup_link "$@"
+
[ $# -eq 3 ] && return 0
local other=$(readlink -m "$root_idfile")
@@ -208,6 +227,9 @@ while read nlinks inum f; do
if [ $nlinks -gt 1 ]; then
eval linked=\$linked_$inum
if [ -n "$linked" ]; then
+ eval id=\$linkedid_$inum
+ make_id_dup_link "$id" "$dn/$(basename $f)"
+ make_id_dup_link "$id" "/usr/lib/debug$dn/$bn" .debug
link=$debugfn
get_debugfn "$linked"
echo "hard linked $link to $debugfn"
@@ -223,6 +245,9 @@ while read nlinks inum f; do
id=$(/usr/lib/rpm/debugedit -b "$RPM_BUILD_DIR" -d /usr/src/debug \
-i -l "$SOURCEFILE" "$f") || exit
+ if [ $nlinks -gt 1 ]; then
+ eval linkedid_$inum=\$id
+ fi
if [ -z "$id" ]; then
echo >&2 "*** ${strict_error}: No build ID note found in $f"
$strict && exit 2