rpm/0035-Untangle-unique-build-options-in-find-debuginfo.sh.patch

173 lines
6.4 KiB
Diff
Raw Normal View History

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