teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.9.0-debuginfo-allnames.patch

Panu Matilainen aca433
--- rpm-4.9.0/scripts/find-debuginfo.sh	2011-02-19 07:57:21.000000000 +0100
Panu Matilainen aca433
+++ rpm-4.9.0/scripts/find-debuginfo.sh.orig	2011-02-19 08:50:23.000000000 +0100
Panu Matilainen aca433
@@ -127,6 +127,23 @@ debug_link()
Panu Matilainen aca433
   link_relative "$t" "$l" "$RPM_BUILD_ROOT"
Panu Matilainen aca433
 }
Panu Matilainen aca433
 
Panu Matilainen aca433
+# Provide .2, .3, ... symlinks to all filename instances of this build-id.
Panu Matilainen aca433
+make_id_dup_link()
Panu Matilainen aca433
+{
Panu Matilainen aca433
+  local id="$1" file="$2" idfile
Panu Matilainen aca433
+
Panu Matilainen aca433
+  local n=1
Panu Matilainen aca433
+  while true; do
Panu Matilainen aca433
+    idfile=".build-id/${id:0:2}/${id:2}.$n"
Panu Matilainen aca433
+    [ $# -eq 3 ] && idfile="${idfile}$3"
Panu Matilainen aca433
+    if [ ! -L "$RPM_BUILD_ROOT/usr/lib/debug/$idfile" ]; then
Panu Matilainen aca433
+      break
Panu Matilainen aca433
+    fi
Panu Matilainen aca433
+    n=$[$n+1]
Panu Matilainen aca433
+  done
Panu Matilainen aca433
+  debug_link "$file" "/$idfile"
Panu Matilainen aca433
+}
Panu Matilainen aca433
+
Panu Matilainen aca433
 # Make a build-id symlink for id $1 with suffix $3 to file $2.
Panu Matilainen aca433
 make_id_link()
Panu Matilainen aca433
 {
Panu Matilainen aca433
@@ -140,6 +157,8 @@ make_id_link()
Panu Matilainen aca433
     return
Panu Matilainen aca433
   fi
Panu Matilainen aca433
 
Panu Matilainen aca433
+  make_id_dup_link "$@"
Panu Matilainen aca433
+
Panu Matilainen aca433
   [ $# -eq 3 ] && return 0
Panu Matilainen aca433
 
Panu Matilainen aca433
   local other=$(readlink -m "$root_idfile")
Panu Matilainen aca433
@@ -188,6 +207,9 @@ while read nlinks inum f; do
Panu Matilainen aca433
   if [ $nlinks -gt 1 ]; then
Panu Matilainen aca433
     eval linked=\$linked_$inum
Panu Matilainen aca433
     if [ -n "$linked" ]; then
Panu Matilainen aca433
+      eval id=\$linkedid_$inum
Panu Matilainen aca433
+      make_id_dup_link "$id" "$dn/$(basename $f)"
Panu Matilainen aca433
+      make_id_dup_link "$id" "/usr/lib/debug$dn/$bn" .debug
Panu Matilainen aca433
       link=$debugfn
Panu Matilainen aca433
       get_debugfn "$linked"
Panu Matilainen aca433
       echo "hard linked $link to $debugfn"
Panu Matilainen aca433
@@ -202,6 +224,9 @@ while read nlinks inum f; do
Panu Matilainen aca433
   echo "extracting debug info from $f"
Panu Matilainen aca433
   id=$(/usr/lib/rpm/debugedit -b "$RPM_BUILD_DIR" -d /usr/src/debug \
Panu Matilainen aca433
 			      -i -l "$SOURCEFILE" "$f") || exit
Panu Matilainen aca433
+  if [ $nlinks -gt 1 ]; then
Panu Matilainen aca433
+    eval linkedid_$inum=\$id
Panu Matilainen aca433
+  fi
Panu Matilainen aca433
   if [ -z "$id" ]; then
Panu Matilainen aca433
     echo >&2 "*** ${strict_error}: No build ID note found in $f"
Panu Matilainen aca433
     $strict && exit 2