teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame find-debuginfo-untangle-unique-build-options.patch

Mark Wielaard da3af5
commit 4842adfd91c3b37744c66d9f01c0112468fdbf37
Mark Wielaard da3af5
Author: Michael Schroeder <mls@suse.de>
Mark Wielaard da3af5
Date:   Tue Mar 28 14:20:50 2017 +0200
Mark Wielaard da3af5
Mark Wielaard da3af5
    Untangle unique build options in find-debuginfo.sh
Mark Wielaard da3af5
    
Mark Wielaard da3af5
    Rename --ver-rel option to --build-id-seed, so that it reflects what
Mark Wielaard da3af5
    it does, not how it is used.
Mark Wielaard da3af5
    
Mark Wielaard da3af5
    Remove implcit usage of the old --ver-rel option for --unique-debug-arch
Mark Wielaard da3af5
    and --unique-debug-src-base, instead already call find-debuginfo.sh with
Mark Wielaard da3af5
    the version included.
Mark Wielaard da3af5
    
Mark Wielaard da3af5
    Rename --unique-debug-arch to --unique-debug-suffix because it now
Mark Wielaard da3af5
    also contains the package version.
Mark Wielaard da3af5
Mark Wielaard da3af5
diff --git a/macros.in b/macros.in
Mark Wielaard da3af5
index 7656c06..0ddde29 100644
Mark Wielaard da3af5
--- a/macros.in
Mark Wielaard da3af5
+++ b/macros.in
Mark Wielaard da3af5
@@ -172,7 +172,18 @@
Mark Wielaard da3af5
 #	the script.  See the script for details.
Mark Wielaard da3af5
 #
Mark Wielaard da3af5
 %__debug_install_post   \
Mark Wielaard da3af5
-   %{_rpmconfigdir}/find-debuginfo.sh %{?_smp_mflags} %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_no_recompute_build_ids:-n} %{?_include_minidebuginfo:-m} %{?_include_gdb_index:-i} %{?_unique_build_ids:--ver-rel "%{VERSION}-%{RELEASE}"} %{?_unique_debug_names:--unique-debug-arch "%{_arch}"} %{?_unique_debug_srcs:--unique-debug-src-base "%{name}"} %{?_find_debuginfo_dwz_opts} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\
Mark Wielaard da3af5
+    %{_rpmconfigdir}/find-debuginfo.sh \\\
Mark Wielaard da3af5
+    %{?_smp_mflags} \\\
Mark Wielaard da3af5
+    %{?_missing_build_ids_terminate_build:--strict-build-id} \\\
Mark Wielaard da3af5
+    %{?_no_recompute_build_ids:-n} \\\
Mark Wielaard da3af5
+    %{?_include_minidebuginfo:-m} \\\
Mark Wielaard da3af5
+    %{?_include_gdb_index:-i} \\\
Mark Wielaard da3af5
+    %{?_unique_build_ids:--build-id-seed "%{VERSION}-%{RELEASE}"} \\\
Mark Wielaard da3af5
+    %{?_unique_debug_names:--unique-debug-suffix "-%{VERSION}-%{RELEASE}.%{_arch}"} \\\
Mark Wielaard da3af5
+    %{?_unique_debug_srcs:--unique-debug-src-base "%{name}-%{VERSION}-%{RELEASE}.%{_arch}"} \\\
Mark Wielaard da3af5
+    %{?_find_debuginfo_dwz_opts} \\\
Mark Wielaard da3af5
+    %{?_find_debuginfo_opts} \\\
Mark Wielaard da3af5
+    "%{_builddir}/%{?buildsubdir}"\
Mark Wielaard da3af5
 %{nil}
Mark Wielaard da3af5
 
Mark Wielaard da3af5
 #	Template for debug information sub-package.
Mark Wielaard da3af5
diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
Mark Wielaard da3af5
index 8effac8..1ebc159 100755
Mark Wielaard da3af5
--- a/scripts/find-debuginfo.sh
Mark Wielaard da3af5
+++ b/scripts/find-debuginfo.sh
Mark Wielaard da3af5
@@ -6,7 +6,7 @@
Mark Wielaard da3af5
 #	 		   [-o debugfiles.list]
Mark Wielaard da3af5
 #			   [--run-dwz] [--dwz-low-mem-die-limit N]
Mark Wielaard da3af5
 #			   [--dwz-max-die-limit N]
Mark Wielaard da3af5
-#			   [--ver-rel VERSION-RELEASE]
Mark Wielaard da3af5
+#			   [--build-id-seed VERSION-RELEASE]
Mark Wielaard da3af5
 #			   [[-l filelist]... [-p 'pattern'] -o debuginfo.list]
Mark Wielaard da3af5
 #			   [builddir]
Mark Wielaard da3af5
 #
Mark Wielaard da3af5
@@ -30,7 +30,7 @@
Mark Wielaard da3af5
 # if available, and --dwz-low-mem-die-limit and --dwz-max-die-limit
Mark Wielaard da3af5
 # provide detailed limits.  See dwz(1) -l and -L option for details.
Mark Wielaard da3af5
 #
Mark Wielaard da3af5
-# If --ver-rel VERSION-RELEASE is given then debugedit is called to
Mark Wielaard da3af5
+# If --build-id-seed VERSION-RELEASE is given then debugedit is called to
Mark Wielaard da3af5
 # update the build-ids it finds adding the VERSION-RELEASE string as
Mark Wielaard da3af5
 # seed to recalculate the build-id hash.  This makes sure the
Mark Wielaard da3af5
 # build-ids in the ELF files are unique between versions and releases
Mark Wielaard da3af5
@@ -65,11 +65,11 @@ run_dwz=false
Mark Wielaard da3af5
 dwz_low_mem_die_limit=
Mark Wielaard da3af5
 dwz_max_die_limit=
Mark Wielaard da3af5
 
Mark Wielaard da3af5
-# Version and release of the spec. Given by --ver-rel
Mark Wielaard da3af5
-ver_rel=
Mark Wielaard da3af5
+# build id seed given by the --build-id-seed option
Mark Wielaard da3af5
+build_id_seed=
Mark Wielaard da3af5
 
Mark Wielaard da3af5
 # Arch given by --unique-debug-arch
Mark Wielaard da3af5
-unique_debug_arch=
Mark Wielaard da3af5
+unique_debug_suffix=
Mark Wielaard da3af5
 
Mark Wielaard da3af5
 # Base given by --unique-debug-src-base
Mark Wielaard da3af5
 unique_debug_src_base=
Mark Wielaard da3af5
@@ -96,12 +96,12 @@ while [ $# -gt 0 ]; do
Mark Wielaard da3af5
     dwz_max_die_limit=$2
Mark Wielaard da3af5
     shift
Mark Wielaard da3af5
     ;;
Mark Wielaard da3af5
-  --ver-rel)
Mark Wielaard da3af5
-    ver_rel=$2
Mark Wielaard da3af5
+  --build-id-seed)
Mark Wielaard da3af5
+    build_id_seed=$2
Mark Wielaard da3af5
     shift
Mark Wielaard da3af5
     ;;
Mark Wielaard da3af5
-  --unique-debug-arch)
Mark Wielaard da3af5
-    unique_debug_arch=$2
Mark Wielaard da3af5
+  --unique-debug-suffix)
Mark Wielaard da3af5
+    unique_debug_suffix=$2
Mark Wielaard da3af5
     shift
Mark Wielaard da3af5
     ;;
Mark Wielaard da3af5
   --unique-debug-src-base)
Mark Wielaard da3af5
@@ -156,18 +156,8 @@ while [ $# -gt 0 ]; do
Mark Wielaard da3af5
   shift
Mark Wielaard da3af5
 done
Mark Wielaard da3af5
 
Mark Wielaard da3af5
-if test -z "$ver_rel" -a -n "$unique_debug_arch"; then
Mark Wielaard da3af5
-  echo >&2 "*** ERROR: --unique-debug-arch (${unique_debug_arch}) needs --ver-rel (${ver_rel})"
Mark Wielaard da3af5
-  exit 2
Mark Wielaard da3af5
-fi
Mark Wielaard da3af5
-
Mark Wielaard da3af5
-if test -z "$unique_debug_arch" -a -n "$unique_debug_src_base"; then
Mark Wielaard da3af5
-  echo >&2 "*** ERROR: --unique-debug-src-base (${unique_debug_src_base}) needs --unique-debug-arch (${unique_debug_arch})"
Mark Wielaard da3af5
-  exit 2
Mark Wielaard da3af5
-fi
Mark Wielaard da3af5
-
Mark Wielaard da3af5
-if test -n "$ver_rel" -a "$no_recompute_build_id" = "true"; then
Mark Wielaard da3af5
-  echo >&2 "*** ERROR: --ver-rel (unique build-ids) and -n (do not recompute build-id cannot be used together"
Mark Wielaard da3af5
+if test -n "$build_id_seed" -a "$no_recompute_build_id" = "true"; then
Mark Wielaard da3af5
+  echo >&2 "*** ERROR: --build-id-seed (unique build-ids) and -n (do not recompute build-id) cannot be used together"
Mark Wielaard da3af5
   exit 2
Mark Wielaard da3af5
 fi
Mark Wielaard da3af5
 
Mark Wielaard da3af5
@@ -278,12 +268,7 @@ debug_link()
Mark Wielaard da3af5
 get_debugfn()
Mark Wielaard da3af5
 {
Mark Wielaard da3af5
   dn=$(dirname "${1#$RPM_BUILD_ROOT}")
Mark Wielaard da3af5
-  if test -n "${unique_debug_arch}"; then
Mark Wielaard da3af5
-    bn=$(basename "$1" .debug)-${ver_rel}.${unique_debug_arch}.debug
Mark Wielaard da3af5
-  else
Mark Wielaard da3af5
-    bn=$(basename "$1" .debug).debug
Mark Wielaard da3af5
-  fi
Mark Wielaard da3af5
-
Mark Wielaard da3af5
+  bn=$(basename "$1" .debug)${unique_debug_suffix}.debug
Mark Wielaard da3af5
   debugdn=${debugdir}${dn}
Mark Wielaard da3af5
   debugfn=${debugdn}/${bn}
Mark Wielaard da3af5
 }
Mark Wielaard da3af5
@@ -310,23 +310,21 @@
Mark Wielaard da3af5
   [ -f "${debugfn}" ] && return
Mark Wielaard da3af5
 
Mark Wielaard da3af5
   echo "extracting debug info from $f"
Mark Wielaard da3af5
-  build_id_seed=
Mark Wielaard da3af5
-  if [ ! -z "$ver_rel" ]; then
Mark Wielaard da3af5
-    build_id_seed="--build-id-seed=$ver_rel"
Mark Wielaard da3af5
-  fi
Mark Wielaard da3af5
   # See also cpio SOURCEFILE copy. Directories must match up.
Mark Wielaard da3af5
   debug_base_name="$RPM_BUILD_DIR"
Mark Wielaard da3af5
   debug_dest_name="/usr/src/debug"
Mark Wielaard da3af5
   if [ ! -z "$unique_debug_src_base" ]; then
Mark Wielaard da3af5
     debug_base_name="$BUILDDIR"
Mark Wielaard da3af5
-    debug_dest_name="/usr/src/debug/${unique_debug_src_base}-${ver_rel}.${unique_debug_arch}"
Mark Wielaard da3af5
+    debug_dest_name="/usr/src/debug/${unique_debug_src_base}"
Mark Wielaard da3af5
   fi
Mark Wielaard da3af5
   no_recompute=
Mark Wielaard da3af5
   if [ "$no_recompute_build_id" = "true" ]; then
Mark Wielaard da3af5
     no_recompute="-n"
Mark Wielaard da3af5
   fi
Mark Wielaard da3af5
-  id=$(${lib_rpm_dir}/debugedit -b $debug_base_name -d $debug_dest_name \
Mark Wielaard da3af5
-	       $no_recompute -i $build_id_seed -l "$SOURCEFILE" "$f") || exit
Mark Wielaard da3af5
+  id=$(${lib_rpm_dir}/debugedit -b "$debug_base_name" -d "$debug_dest_name" \
Mark Wielaard da3af5
+			       $no_recompute -i \
Mark Wielaard da3af5
+			       ${build_id_seed:+--build-id-seed="$build_id_seed"} \
Mark Wielaard da3af5
+			       -l "$SOURCEFILE" "$f") || exit
Mark Wielaard da3af5
   if [ -z "$id" ]; then
Mark Wielaard da3af5
     echo >&2 "*** ${strict_error}: No build ID note found in $f"
Mark Wielaard da3af5
     $strict && exit 2
Mark Wielaard da3af5
@@ -509,7 +492,7 @@ if [ -s "$SOURCEFILE" ]; then
Mark Wielaard da3af5
   debug_dest_name="/usr/src/debug"
Mark Wielaard da3af5
   if [ ! -z "$unique_debug_src_base" ]; then
Mark Wielaard da3af5
     debug_base_name="$BUILDDIR"
Mark Wielaard da3af5
-    debug_dest_name="/usr/src/debug/${unique_debug_src_base}-${ver_rel}.${unique_debug_arch}"
Mark Wielaard da3af5
+    debug_dest_name="/usr/src/debug/${unique_debug_src_base}"
Mark Wielaard da3af5
   fi
Mark Wielaard da3af5
 
Mark Wielaard da3af5
   mkdir -p "${RPM_BUILD_ROOT}${debug_dest_name}"