|
Panu Matilainen |
5b4d98 |
From 76e637c715e13fe7f746feb29af4a6fd0de3cbc7 Mon Sep 17 00:00:00 2001
|
|
Panu Matilainen |
5b4d98 |
Message-Id: <76e637c715e13fe7f746feb29af4a6fd0de3cbc7.1488964568.git.pmatilai@redhat.com>
|
|
Panu Matilainen |
5b4d98 |
In-Reply-To: <189b4f88c8e100155ec23a1e0b214bdc8473532a.1488964568.git.pmatilai@redhat.com>
|
|
Panu Matilainen |
5b4d98 |
References: <189b4f88c8e100155ec23a1e0b214bdc8473532a.1488964568.git.pmatilai@redhat.com>
|
|
Panu Matilainen |
5b4d98 |
From: Mark Wielaard <mjw@redhat.com>
|
|
Panu Matilainen |
5b4d98 |
Date: Thu, 16 Jun 2016 14:24:22 +0200
|
|
Panu Matilainen |
5b4d98 |
Subject: [PATCH 04/11] Add option to have unique debug file names across
|
|
Panu Matilainen |
5b4d98 |
version/release/arch.
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
Introduce a new macro _unique_debug_names that when set will pass
|
|
Panu Matilainen |
5b4d98 |
--unique-debug-arch "%{_arch}" to find-debuginfo.sh to create debuginfo
|
|
Panu Matilainen |
5b4d98 |
files which end in "-<ver>-<rel>.<arch>.debug" instead of simply ".debug".
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
Adds testcases for dwz and buildid with and without unique debug file names.
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
Panu Matilainen |
5b4d98 |
---
|
|
Panu Matilainen |
5b4d98 |
build/files.c | 19 ++-
|
|
Panu Matilainen |
5b4d98 |
macros.debug | 3 +
|
|
Panu Matilainen |
5b4d98 |
macros.in | 9 +-
|
|
Panu Matilainen |
5b4d98 |
scripts/find-debuginfo.sh | 18 ++-
|
|
Panu Matilainen |
5b4d98 |
tests/rpmbuild.at | 168 +++++++++++++++++++-----
|
|
Panu Matilainen |
5b4d98 |
tests/rpmbuildid.at | 316 +++++++++++++++++++++++++++++++++++++++++++++-
|
|
Panu Matilainen |
5b4d98 |
6 files changed, 494 insertions(+), 39 deletions(-)
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
diff --git a/build/files.c b/build/files.c
|
|
Panu Matilainen |
5b4d98 |
index b010483..eb39856 100644
|
|
Panu Matilainen |
5b4d98 |
--- a/build/files.c
|
|
Panu Matilainen |
5b4d98 |
+++ b/build/files.c
|
|
Panu Matilainen |
5b4d98 |
@@ -1790,6 +1790,16 @@ static int generateBuildIDs(FileList fl)
|
|
Panu Matilainen |
5b4d98 |
}
|
|
Panu Matilainen |
5b4d98 |
}
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
+ /* In case we need ALLDEBUG links we might need the vra as
|
|
Panu Matilainen |
5b4d98 |
+ tagged onto the .debug file name. */
|
|
Panu Matilainen |
5b4d98 |
+ char *vra = NULL;
|
|
Panu Matilainen |
5b4d98 |
+ if (rc == 0 && needDbg && build_id_links == BUILD_IDS_ALLDEBUG) {
|
|
Panu Matilainen |
5b4d98 |
+ int unique_debug_names =
|
|
Panu Matilainen |
5b4d98 |
+ rpmExpandNumeric("%{?_unique_debug_names}");
|
|
Panu Matilainen |
5b4d98 |
+ if (unique_debug_names == 1)
|
|
Panu Matilainen |
5b4d98 |
+ vra = rpmExpand("-%{version}-%{release}.%{_arch}", NULL);
|
|
Panu Matilainen |
5b4d98 |
+ }
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
/* Now add a subdir and symlink for each buildid found. */
|
|
Panu Matilainen |
5b4d98 |
for (i = 0; i < nr_ids; i++) {
|
|
Panu Matilainen |
5b4d98 |
/* Don't add anything more when an error occured. But do
|
|
Panu Matilainen |
5b4d98 |
@@ -1884,15 +1894,17 @@ static int generateBuildIDs(FileList fl)
|
|
Panu Matilainen |
5b4d98 |
int pathlen = strlen(paths[i]);
|
|
Panu Matilainen |
5b4d98 |
int debuglen = strlen(".debug");
|
|
Panu Matilainen |
5b4d98 |
int prefixlen = strlen("/usr/lib/debug");
|
|
Panu Matilainen |
5b4d98 |
- if (pathlen > prefixlen
|
|
Panu Matilainen |
5b4d98 |
- && strcmp (paths[i] + pathlen - debuglen,
|
|
Panu Matilainen |
5b4d98 |
+ int vralen = vra == NULL ? 0 : strlen(vra);
|
|
Panu Matilainen |
5b4d98 |
+ if (pathlen > prefixlen + debuglen + vralen
|
|
Panu Matilainen |
5b4d98 |
+ && strcmp ((paths[i] + pathlen - debuglen),
|
|
Panu Matilainen |
5b4d98 |
".debug") == 0) {
|
|
Panu Matilainen |
5b4d98 |
free(linkpath);
|
|
Panu Matilainen |
5b4d98 |
free(targetpath);
|
|
Panu Matilainen |
5b4d98 |
char *targetstr = xstrdup (paths[i]
|
|
Panu Matilainen |
5b4d98 |
+ prefixlen);
|
|
Panu Matilainen |
5b4d98 |
int targetlen = pathlen - prefixlen;
|
|
Panu Matilainen |
5b4d98 |
- targetstr[targetlen - debuglen] = '\0';
|
|
Panu Matilainen |
5b4d98 |
+ int targetend = targetlen - debuglen - vralen;
|
|
Panu Matilainen |
5b4d98 |
+ targetstr[targetend] = '\0';
|
|
Panu Matilainen |
5b4d98 |
rasprintf(&linkpath, "%s/%s",
|
|
Panu Matilainen |
5b4d98 |
buildidsubdir, &ids[i][2]);
|
|
Panu Matilainen |
5b4d98 |
rasprintf(&targetpath, "../../../../..%s",
|
|
Panu Matilainen |
5b4d98 |
@@ -1911,6 +1923,7 @@ static int generateBuildIDs(FileList fl)
|
|
Panu Matilainen |
5b4d98 |
free(paths[i]);
|
|
Panu Matilainen |
5b4d98 |
free(ids[i]);
|
|
Panu Matilainen |
5b4d98 |
}
|
|
Panu Matilainen |
5b4d98 |
+ free(vra);
|
|
Panu Matilainen |
5b4d98 |
free(paths);
|
|
Panu Matilainen |
5b4d98 |
free(ids);
|
|
Panu Matilainen |
5b4d98 |
}
|
|
Panu Matilainen |
5b4d98 |
diff --git a/macros.debug b/macros.debug
|
|
Panu Matilainen |
5b4d98 |
index d273c08..ee0cc9e 100644
|
|
Panu Matilainen |
5b4d98 |
--- a/macros.debug
|
|
Panu Matilainen |
5b4d98 |
+++ b/macros.debug
|
|
Panu Matilainen |
5b4d98 |
@@ -1,4 +1,7 @@
|
|
Panu Matilainen |
5b4d98 |
# macros to include to generate debuginfo
|
|
Panu Matilainen |
5b4d98 |
+# Note don't define/enable a feature here if it is already the default in
|
|
Panu Matilainen |
5b4d98 |
+# macros.in. Otherwise it cannot simply be --undefined on the command line
|
|
Panu Matilainen |
5b4d98 |
+# in the tests (it needs to be undefined multiple times then).
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
%_enable_debug_packages 1
|
|
Panu Matilainen |
5b4d98 |
%_include_minidebuginfo 1
|
|
Panu Matilainen |
5b4d98 |
diff --git a/macros.in b/macros.in
|
|
Panu Matilainen |
5b4d98 |
index c845f58..68bf391 100644
|
|
Panu Matilainen |
5b4d98 |
--- a/macros.in
|
|
Panu Matilainen |
5b4d98 |
+++ b/macros.in
|
|
Panu Matilainen |
5b4d98 |
@@ -180,7 +180,7 @@
|
|
Panu Matilainen |
5b4d98 |
# the script. See the script for details.
|
|
Panu Matilainen |
5b4d98 |
#
|
|
Panu Matilainen |
5b4d98 |
%__debug_install_post \
|
|
Panu Matilainen |
5b4d98 |
- %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_include_minidebuginfo:-m} %{?_include_gdb_index:-i} %{?_unique_build_ids:--ver-rel "%{version}-%{release}"} %{?_find_debuginfo_dwz_opts} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\
|
|
Panu Matilainen |
5b4d98 |
+ %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_include_minidebuginfo:-m} %{?_include_gdb_index:-i} %{?_unique_build_ids:--ver-rel "%{version}-%{release}"} %{?_unique_debug_names:--unique-debug-arch "%{_arch}"} %{?_find_debuginfo_dwz_opts} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\
|
|
Panu Matilainen |
5b4d98 |
%{nil}
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
# Template for debug information sub-package.
|
|
Panu Matilainen |
5b4d98 |
@@ -488,6 +488,13 @@ package or when debugging this package.\
|
|
Panu Matilainen |
5b4d98 |
# onto debugedit --build-id-seed to be used to prime the build-id note hash.
|
|
Panu Matilainen |
5b4d98 |
%_unique_build_ids 1
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
+# Whether .debug files should be made unique between package version,
|
|
Panu Matilainen |
5b4d98 |
+# release and architecture. If set to 1 this will pass
|
|
Panu Matilainen |
5b4d98 |
+# --unique-debug-arch "%{_arch}" to find-debuginfo.sh to create
|
|
Panu Matilainen |
5b4d98 |
+# debuginfo files which end in -<ver>-<rel>.<arch>.debug
|
|
Panu Matilainen |
5b4d98 |
+# Requires _unique_build_ids.
|
|
Panu Matilainen |
5b4d98 |
+%_unique_debug_names 1
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
#
|
|
Panu Matilainen |
5b4d98 |
# Use internal dependency generator rather than external helpers?
|
|
Panu Matilainen |
5b4d98 |
%_use_internal_dependency_generator 1
|
|
Panu Matilainen |
5b4d98 |
diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
|
|
Panu Matilainen |
5b4d98 |
index 8e60813..3653c48 100644
|
|
Panu Matilainen |
5b4d98 |
--- a/scripts/find-debuginfo.sh
|
|
Panu Matilainen |
5b4d98 |
+++ b/scripts/find-debuginfo.sh
|
|
Panu Matilainen |
5b4d98 |
@@ -64,6 +64,9 @@ dwz_max_die_limit=
|
|
Panu Matilainen |
5b4d98 |
# Version and release of the spec. Given by --ver-rel
|
|
Panu Matilainen |
5b4d98 |
ver_rel=
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
+# Arch given by --unique-debug-arch
|
|
Panu Matilainen |
5b4d98 |
+unique_debug_arch=
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
BUILDDIR=.
|
|
Panu Matilainen |
5b4d98 |
out=debugfiles.list
|
|
Panu Matilainen |
5b4d98 |
nout=0
|
|
Panu Matilainen |
5b4d98 |
@@ -87,6 +90,10 @@ while [ $# -gt 0 ]; do
|
|
Panu Matilainen |
5b4d98 |
ver_rel=$2
|
|
Panu Matilainen |
5b4d98 |
shift
|
|
Panu Matilainen |
5b4d98 |
;;
|
|
Panu Matilainen |
5b4d98 |
+ --unique-debug-arch)
|
|
Panu Matilainen |
5b4d98 |
+ unique_debug_arch=$2
|
|
Panu Matilainen |
5b4d98 |
+ shift
|
|
Panu Matilainen |
5b4d98 |
+ ;;
|
|
Panu Matilainen |
5b4d98 |
-g)
|
|
Panu Matilainen |
5b4d98 |
strip_g=true
|
|
Panu Matilainen |
5b4d98 |
;;
|
|
Panu Matilainen |
5b4d98 |
@@ -125,6 +132,11 @@ while [ $# -gt 0 ]; do
|
|
Panu Matilainen |
5b4d98 |
shift
|
|
Panu Matilainen |
5b4d98 |
done
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
+if test -z "$ver_rel" -a -n "$unique_debug_arch"; then
|
|
Panu Matilainen |
5b4d98 |
+ echo >&2 "*** ERROR: --unique-debug-arch (${unique_debug_arch}) needs --ver-rel (${ver_rel})"
|
|
Panu Matilainen |
5b4d98 |
+ exit 2
|
|
Panu Matilainen |
5b4d98 |
+fi
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
i=0
|
|
Panu Matilainen |
5b4d98 |
while ((i < nout)); do
|
|
Panu Matilainen |
5b4d98 |
outs[$i]="$BUILDDIR/${outs[$i]}"
|
|
Panu Matilainen |
5b4d98 |
@@ -232,7 +244,11 @@ debug_link()
|
|
Panu Matilainen |
5b4d98 |
get_debugfn()
|
|
Panu Matilainen |
5b4d98 |
{
|
|
Panu Matilainen |
5b4d98 |
dn=$(dirname "${1#$RPM_BUILD_ROOT}")
|
|
Panu Matilainen |
5b4d98 |
- bn=$(basename "$1" .debug).debug
|
|
Panu Matilainen |
5b4d98 |
+ if test -n "${unique_debug_arch}"; then
|
|
Panu Matilainen |
5b4d98 |
+ bn=$(basename "$1" .debug)-${ver_rel}.${unique_debug_arch}.debug
|
|
Panu Matilainen |
5b4d98 |
+ else
|
|
Panu Matilainen |
5b4d98 |
+ bn=$(basename "$1" .debug).debug
|
|
Panu Matilainen |
5b4d98 |
+ fi
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
debugdn=${debugdir}${dn}
|
|
Panu Matilainen |
5b4d98 |
debugfn=${debugdn}/${bn}
|
|
Panu Matilainen |
5b4d98 |
diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at
|
|
Panu Matilainen |
5b4d98 |
index a312324..0a2c01e 100644
|
|
Panu Matilainen |
5b4d98 |
--- a/tests/rpmbuild.at
|
|
Panu Matilainen |
5b4d98 |
+++ b/tests/rpmbuild.at
|
|
Panu Matilainen |
5b4d98 |
@@ -386,8 +386,9 @@ AT_CLEANUP
|
|
Panu Matilainen |
5b4d98 |
# Check if rpmbuild runs dwz and generates a multi file that with shared
|
|
Panu Matilainen |
5b4d98 |
# debuginfo. This is simply the hello example with one binary build twice
|
|
Panu Matilainen |
5b4d98 |
# so dwz has enough slightly similar debug data.
|
|
Panu Matilainen |
5b4d98 |
+# Test the case without unique debug file names.
|
|
Panu Matilainen |
5b4d98 |
AT_SETUP([rpmbuild debuginfo dwz])
|
|
Panu Matilainen |
5b4d98 |
-AT_KEYWORDS([build] [debuginfo])
|
|
Panu Matilainen |
5b4d98 |
+AT_KEYWORDS([build] [debuginfo] [dwz])
|
|
Panu Matilainen |
5b4d98 |
AT_CHECK([
|
|
Panu Matilainen |
5b4d98 |
rm -rf ${TOPDIR}
|
|
Panu Matilainen |
5b4d98 |
AS_MKDIR_P(${TOPDIR}/SOURCES)
|
|
Panu Matilainen |
5b4d98 |
@@ -397,63 +398,170 @@ cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz "${abs_srcdir}"/data/SOURCES/he
|
|
Panu Matilainen |
5b4d98 |
run rpmbuild --quiet \
|
|
Panu Matilainen |
5b4d98 |
--macros=${abs_top_builddir}/macros:${abs_top_builddir}/tests/testing/usr/local/lib/rpm/platform/%{_target_cpu}-%{_target_os}/macros:${top_srcdir}/macros.debug \
|
|
Panu Matilainen |
5b4d98 |
--rcfile=${abs_top_builddir}/rpmrc \
|
|
Panu Matilainen |
5b4d98 |
+ --undefine "_unique_debug_names" \
|
|
Panu Matilainen |
5b4d98 |
-ba "${abs_srcdir}"/data/SPECS/hello2.spec
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
# The debuginfo package should contain a .debug file for each binary
|
|
Panu Matilainen |
5b4d98 |
# and a dwz multi file that contains the shared debuginfo between them.
|
|
Panu Matilainen |
5b4d98 |
rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-debuginfo-1.0-1.*.rpm \
|
|
Panu Matilainen |
5b4d98 |
| cpio -diu
|
|
Panu Matilainen |
5b4d98 |
-test -f ./usr/lib/debug/usr/local/bin/hello.debug || exit 1
|
|
Panu Matilainen |
5b4d98 |
-test -f ./usr/lib/debug/usr/local/bin/hello2.debug || exit 1
|
|
Panu Matilainen |
5b4d98 |
-test -f ./usr/lib/debug/.dwz/hello2-1.0-1.* || exit 1
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+hello_file_debug=./usr/lib/debug/usr/local/bin/hello.debug
|
|
Panu Matilainen |
5b4d98 |
+hello2_file_debug=./usr/lib/debug/usr/local/bin/hello2.debug
|
|
Panu Matilainen |
5b4d98 |
+hello_multi_file=./usr/lib/debug/.dwz/hello2-1.0-1.*
|
|
Panu Matilainen |
5b4d98 |
+test -f $hello_file_debug || echo "no hello debug file: $hello_file_debug"
|
|
Panu Matilainen |
5b4d98 |
+test -f $hello2_file_debug || echo "no hello2 debug file: $hello2_file_debug"
|
|
Panu Matilainen |
5b4d98 |
+test -f $hello_multi_file || echo "no dwz multi file: $hello_multi_file"
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
# Make sure the main package binaries contain the correct build-ids
|
|
Panu Matilainen |
5b4d98 |
# linking them to the debug packages.
|
|
Panu Matilainen |
5b4d98 |
rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-1.0-1.*.rpm \
|
|
Panu Matilainen |
5b4d98 |
| cpio -diu
|
|
Panu Matilainen |
5b4d98 |
-id1=$(file ./usr/local/bin/hello | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
-id2=$(file ./usr/local/bin/hello2 | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
-id1debug=$(file ./usr/lib/debug/usr/local/bin/hello.debug \
|
|
Panu Matilainen |
5b4d98 |
- | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
-id2debug=$(file ./usr/lib/debug/usr/local/bin/hello2.debug \
|
|
Panu Matilainen |
5b4d98 |
- | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
-idmulti=$(file ./usr/lib/debug/.dwz/hello2-1.0-1.* \
|
|
Panu Matilainen |
5b4d98 |
- | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
-
|
|
Panu Matilainen |
5b4d98 |
-test "$id1" = "$id1debug" || exit 1
|
|
Panu Matilainen |
5b4d98 |
-test "$id2" = "$id2debug" || exit 1
|
|
Panu Matilainen |
5b4d98 |
+hello_file=./usr/local/bin/hello
|
|
Panu Matilainen |
5b4d98 |
+hello2_file=./usr/local/bin/hello2
|
|
Panu Matilainen |
5b4d98 |
+test -f $hello_file || echo "no hello file: $hello_file"
|
|
Panu Matilainen |
5b4d98 |
+test -f $hello2_file || echo "no hello2 file: $hello2_file"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+id1=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
+id2=$(file $hello2_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
+id1debug=$(file $hello_file_debug | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
+id2debug=$(file $hello2_file_debug | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
+idmulti=$(file $hello_multi_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test "$id1" = "$id1debug" || echo "id1: $id1 != id1debug: $id1debug"
|
|
Panu Matilainen |
5b4d98 |
+test "$id2" = "$id2debug" || echo "id2: $id2 != id2debug: $id2debug"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# The build-id files should link to the .debug files.
|
|
Panu Matilainen |
5b4d98 |
+id1file="./usr/lib/debug/.build-id/${id1:0:2}/${id1:2}"
|
|
Panu Matilainen |
5b4d98 |
+canonid1file=$(readlink -f ${id1file})
|
|
Panu Matilainen |
5b4d98 |
+canonfile1=$(readlink -f $hello_file)
|
|
Panu Matilainen |
5b4d98 |
+canonid1debug=$(readlink -f ${id1file}.debug)
|
|
Panu Matilainen |
5b4d98 |
+canondebug1=$(readlink -f $hello_file_debug)
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test "$canonid1file" = "$canonfile1" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "canonid1file: $canonid1file != $canonfile1"
|
|
Panu Matilainen |
5b4d98 |
+test "$canonid1debug" = "$canondebug1" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "canonid1debug: $canonid1debug != $canondebug1"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+id2file="./usr/lib/debug/.build-id/${id2:0:2}/${id2:2}"
|
|
Panu Matilainen |
5b4d98 |
+canonid2file=$(readlink -f ${id2file})
|
|
Panu Matilainen |
5b4d98 |
+canonfile2=$(readlink -f $hello2_file)
|
|
Panu Matilainen |
5b4d98 |
+canonid2debug=$(readlink -f ${id2file}.debug)
|
|
Panu Matilainen |
5b4d98 |
+canondebug2=$(readlink -f $hello2_file_debug)
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test "$canonid2file" = "$canonfile2" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "canonid2: $canonid2file != $canonfile2"
|
|
Panu Matilainen |
5b4d98 |
+test "$canonid2debug" = "$canondebug2" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "canonid2debug: $canonid2debug" != "$canondebug2"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# Both .debug files should point to the dwz multi file.
|
|
Panu Matilainen |
5b4d98 |
+# It would be nice to also test that they contain the correct dwz build-id
|
|
Panu Matilainen |
5b4d98 |
+# but that is a bit hard to grep out of the section data.
|
|
Panu Matilainen |
5b4d98 |
+multiref1=$(readelf --string-dump=.gnu_debugaltlink $hello_file_debug \
|
|
Panu Matilainen |
5b4d98 |
+ | grep '[ 0]' | cut -c13-)
|
|
Panu Matilainen |
5b4d98 |
+multiref2=$(readelf --string-dump=.gnu_debugaltlink $hello2_file_debug \
|
|
Panu Matilainen |
5b4d98 |
+ | grep '[ 0]' | cut -c13-)
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test "$multiref1" = "$multiref2" || echo "multiref: $multiref1 != $multiref2"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+canonmultiref=$(readlink -f $(dirname $canondebug1)/$multiref1)
|
|
Panu Matilainen |
5b4d98 |
+canonmultifile=$(readlink -f $hello_multi_file)
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test "$canonmultiref" = "$canonmultifile" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "canonmultiref: $canonmultiref" != "$canonmultifile"
|
|
Panu Matilainen |
5b4d98 |
+],
|
|
Panu Matilainen |
5b4d98 |
+[0],
|
|
Panu Matilainen |
5b4d98 |
+[],
|
|
Panu Matilainen |
5b4d98 |
+[ignore])
|
|
Panu Matilainen |
5b4d98 |
+AT_CLEANUP
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# ------------------------------
|
|
Panu Matilainen |
5b4d98 |
+# Check if rpmbuild runs dwz and generates a multi file that with shared
|
|
Panu Matilainen |
5b4d98 |
+# debuginfo. This is simply the hello example with one binary build twice
|
|
Panu Matilainen |
5b4d98 |
+# so dwz has enough slightly similar debug data.
|
|
Panu Matilainen |
5b4d98 |
+# Test with unique debug file names.
|
|
Panu Matilainen |
5b4d98 |
+AT_SETUP([rpmbuild debuginfo dwz unique debug names])
|
|
Panu Matilainen |
5b4d98 |
+AT_KEYWORDS([build] [debuginfo] [dwz])
|
|
Panu Matilainen |
5b4d98 |
+AT_CHECK([
|
|
Panu Matilainen |
5b4d98 |
+rm -rf ${TOPDIR}
|
|
Panu Matilainen |
5b4d98 |
+AS_MKDIR_P(${TOPDIR}/SOURCES)
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz "${abs_srcdir}"/data/SOURCES/hello-1.0-modernize.patch ${TOPDIR}/SOURCES
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+run rpmbuild --quiet \
|
|
Panu Matilainen |
5b4d98 |
+ --macros=${abs_top_builddir}/macros:${abs_top_builddir}/tests/testing/usr/local/lib/rpm/platform/%{_target_cpu}-%{_target_os}/macros:${top_srcdir}/macros.debug \
|
|
Panu Matilainen |
5b4d98 |
+ --rcfile=${abs_top_builddir}/rpmrc \
|
|
Panu Matilainen |
5b4d98 |
+ --define "_unique_debug_names 1" \
|
|
Panu Matilainen |
5b4d98 |
+ -ba "${abs_srcdir}"/data/SPECS/hello2.spec
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# The debuginfo package should contain a .debug file for each binary
|
|
Panu Matilainen |
5b4d98 |
+# and a dwz multi file that contains the shared debuginfo between them.
|
|
Panu Matilainen |
5b4d98 |
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-debuginfo-1.0-1.*.rpm \
|
|
Panu Matilainen |
5b4d98 |
+ | cpio -diu
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+hello_file_debug=./usr/lib/debug/usr/local/bin/hello-*.debug
|
|
Panu Matilainen |
5b4d98 |
+hello2_file_debug=./usr/lib/debug/usr/local/bin/hello2-*.debug
|
|
Panu Matilainen |
5b4d98 |
+hello_multi_file=./usr/lib/debug/.dwz/hello2-1.0-1.*
|
|
Panu Matilainen |
5b4d98 |
+test -f $hello_file_debug || echo "no hello debug file: $hello_file_debug"
|
|
Panu Matilainen |
5b4d98 |
+test -f $hello2_file_debug || echo "no hello2 debug file: $hello2_file_debug"
|
|
Panu Matilainen |
5b4d98 |
+test -f $hello_multi_file || echo "no dwz multi file: $hello_multi_file"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# Make sure the main package binaries contain the correct build-ids
|
|
Panu Matilainen |
5b4d98 |
+# linking them to the debug packages.
|
|
Panu Matilainen |
5b4d98 |
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-1.0-1.*.rpm \
|
|
Panu Matilainen |
5b4d98 |
+ | cpio -diu
|
|
Panu Matilainen |
5b4d98 |
+hello_file=./usr/local/bin/hello
|
|
Panu Matilainen |
5b4d98 |
+hello2_file=./usr/local/bin/hello2
|
|
Panu Matilainen |
5b4d98 |
+test -f $hello_file || echo "no hello file: $hello_file"
|
|
Panu Matilainen |
5b4d98 |
+test -f $hello2_file || echo "no hello2 file: $hello2_file"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+id1=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
+id2=$(file $hello2_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
+id1debug=$(file $hello_file_debug | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
+id2debug=$(file $hello2_file_debug | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
+idmulti=$(file $hello_multi_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test "$id1" = "$id1debug" || echo "id1: $id1 != id1debug: $id1debug"
|
|
Panu Matilainen |
5b4d98 |
+test "$id2" = "$id2debug" || echo "id2: $id2 != id2debug: $id2debug"
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
# The build-id files should link to the .debug files.
|
|
Panu Matilainen |
5b4d98 |
id1file="./usr/lib/debug/.build-id/${id1:0:2}/${id1:2}"
|
|
Panu Matilainen |
5b4d98 |
canonid1file=$(readlink -f ${id1file})
|
|
Panu Matilainen |
5b4d98 |
-canonfile1=$(readlink -f ./usr/local/bin/hello)
|
|
Panu Matilainen |
5b4d98 |
+canonfile1=$(readlink -f $hello_file)
|
|
Panu Matilainen |
5b4d98 |
canonid1debug=$(readlink -f ${id1file}.debug)
|
|
Panu Matilainen |
5b4d98 |
-canondebug1=$(readlink -f ./usr/lib/debug/usr/local/bin/hello.debug)
|
|
Panu Matilainen |
5b4d98 |
+canondebug1=$(readlink -f $hello_file_debug)
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
-test "$canonid1file" = "$canonfile1" || exit 1
|
|
Panu Matilainen |
5b4d98 |
-test "$canonid1debug" = "$canondebug1" || exit 1
|
|
Panu Matilainen |
5b4d98 |
+test "$canonid1file" = "$canonfile1" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "canonid1file: $canonid1file != $canonfile1"
|
|
Panu Matilainen |
5b4d98 |
+test "$canonid1debug" = "$canondebug1" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "canonid1debug: $canonid1debug != $canondebug1"
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
id2file="./usr/lib/debug/.build-id/${id2:0:2}/${id2:2}"
|
|
Panu Matilainen |
5b4d98 |
-canonid2file=$(readlink -f ${id1file})
|
|
Panu Matilainen |
5b4d98 |
-canonfile2=$(readlink -f ./usr/local/bin/hello)
|
|
Panu Matilainen |
5b4d98 |
-canonid2debug=$(readlink -f ${id1file}.debug)
|
|
Panu Matilainen |
5b4d98 |
-canondebug2=$(readlink -f ./usr/lib/debug/usr/local/bin/hello.debug)
|
|
Panu Matilainen |
5b4d98 |
+canonid2file=$(readlink -f ${id2file})
|
|
Panu Matilainen |
5b4d98 |
+canonfile2=$(readlink -f $hello2_file)
|
|
Panu Matilainen |
5b4d98 |
+canonid2debug=$(readlink -f ${id2file}.debug)
|
|
Panu Matilainen |
5b4d98 |
+canondebug2=$(readlink -f $hello2_file_debug)
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
-test "$canonid2file" = "$canonfile2" || exit 1
|
|
Panu Matilainen |
5b4d98 |
-test "$canonid2debug" = "$canondebug2" || exit 1
|
|
Panu Matilainen |
5b4d98 |
+test "$canonid2file" = "$canonfile2" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "canonid2: $canonid2file != $canonfile2"
|
|
Panu Matilainen |
5b4d98 |
+test "$canonid2debug" = "$canondebug2" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "canonid2debug: $canonid2debug" != "$canondebug2"
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
# Both .debug files should point to the dwz multi file.
|
|
Panu Matilainen |
5b4d98 |
# It would be nice to also test that they contain the correct dwz build-id
|
|
Panu Matilainen |
5b4d98 |
# but that is a bit hard to grep out of the section data.
|
|
Panu Matilainen |
5b4d98 |
-multiref1=$(readelf --string-dump=.gnu_debugaltlink ./usr/lib/debug/usr/local/bin/hello.debug | grep '[ 0]' | cut -c13-)
|
|
Panu Matilainen |
5b4d98 |
-multiref2=$(readelf --string-dump=.gnu_debugaltlink ./usr/lib/debug/usr/local/bin/hello2.debug | grep '[ 0]' | cut -c13-)
|
|
Panu Matilainen |
5b4d98 |
+multiref1=$(readelf --string-dump=.gnu_debugaltlink $hello_file_debug \
|
|
Panu Matilainen |
5b4d98 |
+ | grep '[ 0]' | cut -c13-)
|
|
Panu Matilainen |
5b4d98 |
+multiref2=$(readelf --string-dump=.gnu_debugaltlink $hello2_file_debug \
|
|
Panu Matilainen |
5b4d98 |
+ | grep '[ 0]' | cut -c13-)
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
-test "$multiref1" = "$multiref2" || exit 1
|
|
Panu Matilainen |
5b4d98 |
+test "$multiref1" = "$multiref2" || echo "multiref: $multiref1 != $multiref2"
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
canonmultiref=$(readlink -f $(dirname $canondebug1)/$multiref1)
|
|
Panu Matilainen |
5b4d98 |
-canonmultifile=$(readlink -f ./usr/lib/debug/.dwz/hello2-1.0-1.*)
|
|
Panu Matilainen |
5b4d98 |
+canonmultifile=$(readlink -f $hello_multi_file)
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
-test "$canonmultiref" = "$canonmultifile" || exit 1
|
|
Panu Matilainen |
5b4d98 |
+test "$canonmultiref" = "$canonmultifile" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "canonmultiref: $canonmultiref" != "$canonmultifile"
|
|
Panu Matilainen |
5b4d98 |
],
|
|
Panu Matilainen |
5b4d98 |
[0],
|
|
Panu Matilainen |
5b4d98 |
[],
|
|
Panu Matilainen |
5b4d98 |
diff --git a/tests/rpmbuildid.at b/tests/rpmbuildid.at
|
|
Panu Matilainen |
5b4d98 |
index 1da6302..ede1181 100644
|
|
Panu Matilainen |
5b4d98 |
--- a/tests/rpmbuildid.at
|
|
Panu Matilainen |
5b4d98 |
+++ b/tests/rpmbuildid.at
|
|
Panu Matilainen |
5b4d98 |
@@ -54,7 +54,8 @@ hello debuginfo build-id files: 0
|
|
Panu Matilainen |
5b4d98 |
AT_CLEANUP
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
# ------------------------------
|
|
Panu Matilainen |
5b4d98 |
-# Check if rpmbuild "alldebug" generates debuginfo buildid symlinks
|
|
Panu Matilainen |
5b4d98 |
+# Check if rpmbuild "alldebug" generates debuginfo buildid symlinks.
|
|
Panu Matilainen |
5b4d98 |
+# Without unique debug file names.
|
|
Panu Matilainen |
5b4d98 |
AT_SETUP([rpmbuild buildid alldebug])
|
|
Panu Matilainen |
5b4d98 |
AT_KEYWORDS([build] [debuginfo] [buildid])
|
|
Panu Matilainen |
5b4d98 |
AT_CHECK([
|
|
Panu Matilainen |
5b4d98 |
@@ -69,6 +70,7 @@ run rpmbuild \
|
|
Panu Matilainen |
5b4d98 |
--macros=${abs_top_builddir}/macros:${abs_top_builddir}/tests/testing/usr/local/lib/rpm/platform/%{_target_cpu}-%{_target_os}/macros:${top_srcdir}/macros.debug \
|
|
Panu Matilainen |
5b4d98 |
--rcfile=${abs_top_builddir}/rpmrc \
|
|
Panu Matilainen |
5b4d98 |
--define="_build_id_links alldebug" \
|
|
Panu Matilainen |
5b4d98 |
+ --undefine "_unique_debug_names" \
|
|
Panu Matilainen |
5b4d98 |
--quiet -ba "${abs_srcdir}"/data/SPECS/hello.spec
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
# There should be zero build-id files in the main package
|
|
Panu Matilainen |
5b4d98 |
@@ -114,7 +116,100 @@ test "$canon_main_file" = "$canon_main_id_file" \
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
# And check the same for the debug file.
|
|
Panu Matilainen |
5b4d98 |
debug_file=./usr/lib/debug/usr/local/bin/hello.debug
|
|
Panu Matilainen |
5b4d98 |
-test -f "${debug_file}" || echo "No debug file ${debug_file}"
|
|
Panu Matilainen |
5b4d98 |
+test -f ${debug_file} || echo "No debug file ${debug_file}"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# Extract the build-id from the .debug file
|
|
Panu Matilainen |
5b4d98 |
+id_debug=$(file $debug_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test ${id_main} = ${id_debug} || echo "unequal main and debug id"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+id_debug_file="./usr/lib/debug/.build-id/${id_debug:0:2}/${id_debug:2}.debug"
|
|
Panu Matilainen |
5b4d98 |
+test -L "$id_debug_file" || echo "No build-id file $id_debug_file"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+canon_debug_file=$(readlink -f ${debug_file})
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test -f "$canon_debug_file" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "Cannot resolve debug file ${debug_file} -> ${canon_debug_file}"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+canon_debug_id_file=$(readlink -f ${id_debug_file})
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test -f "$canon_debug_id_file" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "Cannot resolve debug build-id file ${id_debug_file} -> ${canon_debug_id_file}"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test "$canon_debug_file" = "$canon_debug_id_file" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "debug and build-id not linked"
|
|
Panu Matilainen |
5b4d98 |
+],
|
|
Panu Matilainen |
5b4d98 |
+[0],
|
|
Panu Matilainen |
5b4d98 |
+[hello build-id files: 0
|
|
Panu Matilainen |
5b4d98 |
+hello debuginfo build-id files: 3
|
|
Panu Matilainen |
5b4d98 |
+],
|
|
Panu Matilainen |
5b4d98 |
+[ignore])
|
|
Panu Matilainen |
5b4d98 |
+AT_CLEANUP
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# ------------------------------
|
|
Panu Matilainen |
5b4d98 |
+# Check if rpmbuild "alldebug" generates debuginfo buildid symlinks.
|
|
Panu Matilainen |
5b4d98 |
+# With unique debug file names.
|
|
Panu Matilainen |
5b4d98 |
+AT_SETUP([rpmbuild buildid alldebug unique debug names])
|
|
Panu Matilainen |
5b4d98 |
+AT_KEYWORDS([build] [debuginfo] [buildid])
|
|
Panu Matilainen |
5b4d98 |
+AT_CHECK([
|
|
Panu Matilainen |
5b4d98 |
+rm -rf ${TOPDIR}
|
|
Panu Matilainen |
5b4d98 |
+AS_MKDIR_P(${TOPDIR}/SOURCES)
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# Setup sources
|
|
Panu Matilainen |
5b4d98 |
+cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz "${abs_srcdir}"/data/SOURCES/hello-1.0-modernize.patch ${TOPDIR}/SOURCES
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# Build, contains one ELF which should have a buildid.
|
|
Panu Matilainen |
5b4d98 |
+run rpmbuild \
|
|
Panu Matilainen |
5b4d98 |
+ --macros=${abs_top_builddir}/macros:${abs_top_builddir}/tests/testing/usr/local/lib/rpm/platform/%{_target_cpu}-%{_target_os}/macros:${top_srcdir}/macros.debug \
|
|
Panu Matilainen |
5b4d98 |
+ --rcfile=${abs_top_builddir}/rpmrc \
|
|
Panu Matilainen |
5b4d98 |
+ --define="_build_id_links alldebug" \
|
|
Panu Matilainen |
5b4d98 |
+ --define="_unique_debug_names 1" \
|
|
Panu Matilainen |
5b4d98 |
+ --quiet -ba "${abs_srcdir}"/data/SPECS/hello.spec
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# There should be zero build-id files in the main package
|
|
Panu Matilainen |
5b4d98 |
+# Main and debug should be in the debuginfo package,
|
|
Panu Matilainen |
5b4d98 |
+# plus the .build-id/xx subdir, 3 in total.
|
|
Panu Matilainen |
5b4d98 |
+echo -n "hello build-id files: "
|
|
Panu Matilainen |
5b4d98 |
+run rpm -ql -p "${TOPDIR}"/RPMS/*/hello-1.0-1.*.rpm \
|
|
Panu Matilainen |
5b4d98 |
+ | grep /.build-id/ | wc --lines
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+echo -n "hello debuginfo build-id files: "
|
|
Panu Matilainen |
5b4d98 |
+run rpm -ql -p "${TOPDIR}"/RPMS/*/hello-debuginfo-1.0-1.*.rpm \
|
|
Panu Matilainen |
5b4d98 |
+ | grep /.build-id/ | wc --lines
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# Extract the both packages to check the build-id files link to the
|
|
Panu Matilainen |
5b4d98 |
+# main and .debug files.
|
|
Panu Matilainen |
5b4d98 |
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello-1.0-1.*.rpm \
|
|
Panu Matilainen |
5b4d98 |
+ | cpio -diu
|
|
Panu Matilainen |
5b4d98 |
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello-debuginfo-1.0-1.*.rpm \
|
|
Panu Matilainen |
5b4d98 |
+ | cpio -diu
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# Check there is a build-id symlink for the main file.
|
|
Panu Matilainen |
5b4d98 |
+main_file=./usr/local/bin/hello
|
|
Panu Matilainen |
5b4d98 |
+test -f "${main_file}" || echo "No main file ${main_file}"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# Extract the build-id from the main file
|
|
Panu Matilainen |
5b4d98 |
+id_main=$(file $main_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+id_main_file="./usr/lib/debug/.build-id/${id_main:0:2}/${id_main:2}"
|
|
Panu Matilainen |
5b4d98 |
+test -L "$id_main_file" || echo "No build-id file $id_main_file"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+canon_main_file=$(readlink -f ${main_file})
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test -f "$canon_main_file" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "Cannot resolve main file ${main_file} -> ${canon_main_file}"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+canon_main_id_file=$(readlink -f ${id_main_file})
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test -f "$canon_main_id_file" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "Cannot resolve main build-id file ${id_main_file} -> ${canon_main_id_file}"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test "$canon_main_file" = "$canon_main_id_file" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "main and build-id file not linked"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# And check the same for the debug file.
|
|
Panu Matilainen |
5b4d98 |
+debug_file=./usr/lib/debug/usr/local/bin/hello-*.debug
|
|
Panu Matilainen |
5b4d98 |
+test -f ${debug_file} || echo "No debug file ${debug_file}"
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
# Extract the build-id from the .debug file
|
|
Panu Matilainen |
5b4d98 |
id_debug=$(file $debug_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
@@ -146,6 +241,7 @@ AT_CLEANUP
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
# ------------------------------
|
|
Panu Matilainen |
5b4d98 |
# Check if rpmbuild "separate" generates main and debuginfo buildid symlinks
|
|
Panu Matilainen |
5b4d98 |
+# Without unique debug file names
|
|
Panu Matilainen |
5b4d98 |
AT_SETUP([rpmbuild buildid separate])
|
|
Panu Matilainen |
5b4d98 |
AT_KEYWORDS([build] [debuginfo] [buildid])
|
|
Panu Matilainen |
5b4d98 |
AT_CHECK([
|
|
Panu Matilainen |
5b4d98 |
@@ -160,6 +256,7 @@ run rpmbuild \
|
|
Panu Matilainen |
5b4d98 |
--macros=${abs_top_builddir}/macros:${abs_top_builddir}/tests/testing/usr/local/lib/rpm/platform/%{_target_cpu}-%{_target_os}/macros:${top_srcdir}/macros.debug \
|
|
Panu Matilainen |
5b4d98 |
--rcfile=${abs_top_builddir}/rpmrc \
|
|
Panu Matilainen |
5b4d98 |
--define="_build_id_links separate" \
|
|
Panu Matilainen |
5b4d98 |
+ --undefine "_unique_debug_names" \
|
|
Panu Matilainen |
5b4d98 |
--quiet -ba "${abs_srcdir}"/data/SPECS/hello.spec
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
# There should be one build-id files in the main and debuginfo package
|
|
Panu Matilainen |
5b4d98 |
@@ -204,7 +301,99 @@ test "$canon_main_file" = "$canon_main_id_file" \
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
# And check the same for the debug file.
|
|
Panu Matilainen |
5b4d98 |
debug_file=./usr/lib/debug/usr/local/bin/hello.debug
|
|
Panu Matilainen |
5b4d98 |
-test -f "${debug_file}" || echo "No debug file ${debug_file}"
|
|
Panu Matilainen |
5b4d98 |
+test -f ${debug_file} || echo "No debug file ${debug_file}"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# Extract the build-id from the .debug file
|
|
Panu Matilainen |
5b4d98 |
+id_debug=$(file $debug_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test ${id_main} = ${id_debug} || echo "unequal main and debug id"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+id_debug_file="./usr/lib/debug/.build-id/${id_debug:0:2}/${id_debug:2}.debug"
|
|
Panu Matilainen |
5b4d98 |
+test -L "$id_debug_file" || echo "No build-id file $id_debug_file"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+canon_debug_file=$(readlink -f ${debug_file})
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test -f "$canon_debug_file" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "Cannot resolve debug file ${debug_file} -> ${canon_debug_file}"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+canon_debug_id_file=$(readlink -f ${id_debug_file})
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test -f "$canon_debug_id_file" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "Cannot resolve debug build-id file ${id_debug_file} -> ${canon_debug_id_file}"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test "$canon_debug_file" = "$canon_debug_id_file" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "debug and build-id not linked"
|
|
Panu Matilainen |
5b4d98 |
+],
|
|
Panu Matilainen |
5b4d98 |
+[0],
|
|
Panu Matilainen |
5b4d98 |
+[hello build-id files: 2
|
|
Panu Matilainen |
5b4d98 |
+hello debuginfo build-id files: 2
|
|
Panu Matilainen |
5b4d98 |
+],
|
|
Panu Matilainen |
5b4d98 |
+[ignore])
|
|
Panu Matilainen |
5b4d98 |
+AT_CLEANUP
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# ------------------------------
|
|
Panu Matilainen |
5b4d98 |
+# Check if rpmbuild "separate" generates main and debuginfo buildid symlinks
|
|
Panu Matilainen |
5b4d98 |
+# With unique debug file names
|
|
Panu Matilainen |
5b4d98 |
+AT_SETUP([rpmbuild buildid separate unique debug names])
|
|
Panu Matilainen |
5b4d98 |
+AT_KEYWORDS([build] [debuginfo] [buildid])
|
|
Panu Matilainen |
5b4d98 |
+AT_CHECK([
|
|
Panu Matilainen |
5b4d98 |
+rm -rf ${TOPDIR}
|
|
Panu Matilainen |
5b4d98 |
+AS_MKDIR_P(${TOPDIR}/SOURCES)
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# Setup sources
|
|
Panu Matilainen |
5b4d98 |
+cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz "${abs_srcdir}"/data/SOURCES/hello-1.0-modernize.patch ${TOPDIR}/SOURCES
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# Build, contains one ELF which should have a buildid.
|
|
Panu Matilainen |
5b4d98 |
+run rpmbuild \
|
|
Panu Matilainen |
5b4d98 |
+ --macros=${abs_top_builddir}/macros:${abs_top_builddir}/tests/testing/usr/local/lib/rpm/platform/%{_target_cpu}-%{_target_os}/macros:${top_srcdir}/macros.debug \
|
|
Panu Matilainen |
5b4d98 |
+ --rcfile=${abs_top_builddir}/rpmrc \
|
|
Panu Matilainen |
5b4d98 |
+ --define="_build_id_links separate" \
|
|
Panu Matilainen |
5b4d98 |
+ --define="_unique_debug_names 1" \
|
|
Panu Matilainen |
5b4d98 |
+ --quiet -ba "${abs_srcdir}"/data/SPECS/hello.spec
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# There should be one build-id files in the main and debuginfo package
|
|
Panu Matilainen |
5b4d98 |
+# plus the .build-id/xx subdir, 2 in total.
|
|
Panu Matilainen |
5b4d98 |
+echo -n "hello build-id files: "
|
|
Panu Matilainen |
5b4d98 |
+run rpm -ql -p "${TOPDIR}"/RPMS/*/hello-1.0-1.*.rpm \
|
|
Panu Matilainen |
5b4d98 |
+ | grep /.build-id/ | wc --lines
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+echo -n "hello debuginfo build-id files: "
|
|
Panu Matilainen |
5b4d98 |
+run rpm -ql -p "${TOPDIR}"/RPMS/*/hello-debuginfo-1.0-1.*.rpm \
|
|
Panu Matilainen |
5b4d98 |
+ | grep /.build-id/ | wc --lines
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# Extract the both packages to check the build-id files link to the
|
|
Panu Matilainen |
5b4d98 |
+# main and .debug files.
|
|
Panu Matilainen |
5b4d98 |
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello-1.0-1.*.rpm \
|
|
Panu Matilainen |
5b4d98 |
+ | cpio -diu
|
|
Panu Matilainen |
5b4d98 |
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello-debuginfo-1.0-1.*.rpm \
|
|
Panu Matilainen |
5b4d98 |
+ | cpio -diu
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# Check there is a build-id symlink for the main file.
|
|
Panu Matilainen |
5b4d98 |
+main_file=./usr/local/bin/hello
|
|
Panu Matilainen |
5b4d98 |
+test -f "${main_file}" || echo "No main file ${main_file}"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# Extract the build-id from the main file
|
|
Panu Matilainen |
5b4d98 |
+id_main=$(file $main_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+id_main_file="./usr/lib/.build-id/${id_main:0:2}/${id_main:2}"
|
|
Panu Matilainen |
5b4d98 |
+test -L "$id_main_file" || echo "No build-id file $id_main_file"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+canon_main_file=$(readlink -f ${main_file})
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test -f "$canon_main_file" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "Cannot resolve main file ${main_file} -> ${canon_main_file}"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+canon_main_id_file=$(readlink -f ${id_main_file})
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test -f "$canon_main_id_file" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "Cannot resolve main build-id file ${id_main_file} -> ${canon_main_id_file}"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test "$canon_main_file" = "$canon_main_id_file" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "main and build-id file not linked"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# And check the same for the debug file.
|
|
Panu Matilainen |
5b4d98 |
+debug_file=./usr/lib/debug/usr/local/bin/hello-*.debug
|
|
Panu Matilainen |
5b4d98 |
+test -f ${debug_file} || echo "No debug file ${debug_file}"
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
# Extract the build-id from the .debug file
|
|
Panu Matilainen |
5b4d98 |
id_debug=$(file $debug_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
@@ -236,6 +425,7 @@ AT_CLEANUP
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
# ------------------------------
|
|
Panu Matilainen |
5b4d98 |
# Check if rpmbuild "compat" generates main and debuginfo buildid symlinks
|
|
Panu Matilainen |
5b4d98 |
+# Without unique debug file names
|
|
Panu Matilainen |
5b4d98 |
AT_SETUP([rpmbuild buildid compat])
|
|
Panu Matilainen |
5b4d98 |
AT_KEYWORDS([build] [debuginfo] [buildid])
|
|
Panu Matilainen |
5b4d98 |
AT_CHECK([
|
|
Panu Matilainen |
5b4d98 |
@@ -250,6 +440,7 @@ run rpmbuild \
|
|
Panu Matilainen |
5b4d98 |
--macros=${abs_top_builddir}/macros:${abs_top_builddir}/tests/testing/usr/local/lib/rpm/platform/%{_target_cpu}-%{_target_os}/macros:${top_srcdir}/macros.debug \
|
|
Panu Matilainen |
5b4d98 |
--rcfile=${abs_top_builddir}/rpmrc \
|
|
Panu Matilainen |
5b4d98 |
--define="_build_id_links compat" \
|
|
Panu Matilainen |
5b4d98 |
+ --undefine "_unique_debug_names" \
|
|
Panu Matilainen |
5b4d98 |
--quiet -ba "${abs_srcdir}"/data/SPECS/hello.spec
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
# There should be one build-id files in the main and debuginfo package.
|
|
Panu Matilainen |
5b4d98 |
@@ -295,7 +486,112 @@ test "$canon_main_file" = "$canon_main_id_file" \
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
# And check the same for the debug file.
|
|
Panu Matilainen |
5b4d98 |
debug_file=./usr/lib/debug/usr/local/bin/hello.debug
|
|
Panu Matilainen |
5b4d98 |
-test -f "${debug_file}" || echo "No debug file ${debug_file}"
|
|
Panu Matilainen |
5b4d98 |
+test -f ${debug_file} || echo "No debug file ${debug_file}"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# Extract the build-id from the .debug file
|
|
Panu Matilainen |
5b4d98 |
+id_debug=$(file $debug_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test ${id_main} = ${id_debug} || echo "unequal main and debug id"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+id_debug_file="./usr/lib/debug/.build-id/${id_debug:0:2}/${id_debug:2}.debug"
|
|
Panu Matilainen |
5b4d98 |
+test -L "$id_debug_file" || echo "No build-id file $id_debug_file"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+canon_debug_file=$(readlink -f ${debug_file})
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test -f "$canon_debug_file" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "Cannot resolve debug file ${debug_file} -> ${canon_debug_file}"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+canon_debug_id_file=$(readlink -f ${id_debug_file})
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test -f "$canon_debug_id_file" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "Cannot resolve debug build-id file ${id_debug_file} -> ${canon_debug_id_file}"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test "$canon_debug_file" = "$canon_debug_id_file" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "debug and build-id not linked"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# The compat link should also point to the same (indirectly).
|
|
Panu Matilainen |
5b4d98 |
+id_compat_file="./usr/lib/debug/.build-id/${id_main:0:2}/${id_main:2}"
|
|
Panu Matilainen |
5b4d98 |
+test -L "$id_compat_file" || echo "No build-id compat file $id_compat_file"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+canon_compat_file=$(readlink -f ${id_compat_file})
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test -f "$canon_compat_file" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "Cannot resolve compat file ${id_compat_file} -> ${canon_compat_file}"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test "$canon_compat_file" = "$canon_main_file" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "compat and build-id not linked"
|
|
Panu Matilainen |
5b4d98 |
+],
|
|
Panu Matilainen |
5b4d98 |
+[0],
|
|
Panu Matilainen |
5b4d98 |
+[hello build-id files: 2
|
|
Panu Matilainen |
5b4d98 |
+hello debuginfo build-id files: 3
|
|
Panu Matilainen |
5b4d98 |
+],
|
|
Panu Matilainen |
5b4d98 |
+[ignore])
|
|
Panu Matilainen |
5b4d98 |
+AT_CLEANUP
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# ------------------------------
|
|
Panu Matilainen |
5b4d98 |
+# Check if rpmbuild "compat" generates main and debuginfo buildid symlinks
|
|
Panu Matilainen |
5b4d98 |
+# With unique debug file names
|
|
Panu Matilainen |
5b4d98 |
+AT_SETUP([rpmbuild buildid compat unique debug names])
|
|
Panu Matilainen |
5b4d98 |
+AT_KEYWORDS([build] [debuginfo] [buildid])
|
|
Panu Matilainen |
5b4d98 |
+AT_CHECK([
|
|
Panu Matilainen |
5b4d98 |
+rm -rf ${TOPDIR}
|
|
Panu Matilainen |
5b4d98 |
+AS_MKDIR_P(${TOPDIR}/SOURCES)
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# Setup sources
|
|
Panu Matilainen |
5b4d98 |
+cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz "${abs_srcdir}"/data/SOURCES/hello-1.0-modernize.patch ${TOPDIR}/SOURCES
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# Build, contains one ELF which should have a buildid.
|
|
Panu Matilainen |
5b4d98 |
+run rpmbuild \
|
|
Panu Matilainen |
5b4d98 |
+ --macros=${abs_top_builddir}/macros:${abs_top_builddir}/tests/testing/usr/local/lib/rpm/platform/%{_target_cpu}-%{_target_os}/macros:${top_srcdir}/macros.debug \
|
|
Panu Matilainen |
5b4d98 |
+ --rcfile=${abs_top_builddir}/rpmrc \
|
|
Panu Matilainen |
5b4d98 |
+ --define="_build_id_links compat" \
|
|
Panu Matilainen |
5b4d98 |
+ --define="_unique_debug_names 1" \
|
|
Panu Matilainen |
5b4d98 |
+ --quiet -ba "${abs_srcdir}"/data/SPECS/hello.spec
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# There should be one build-id files in the main and debuginfo package.
|
|
Panu Matilainen |
5b4d98 |
+# the debuginfo package has one extra main build-id compat symlink
|
|
Panu Matilainen |
5b4d98 |
+# plus the .build-id/xx subdir, 2 in total in main, 3 in total in debug
|
|
Panu Matilainen |
5b4d98 |
+echo -n "hello build-id files: "
|
|
Panu Matilainen |
5b4d98 |
+run rpm -ql -p "${TOPDIR}"/RPMS/*/hello-1.0-1.*.rpm \
|
|
Panu Matilainen |
5b4d98 |
+ | grep /.build-id/ | wc --lines
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+echo -n "hello debuginfo build-id files: "
|
|
Panu Matilainen |
5b4d98 |
+run rpm -ql -p "${TOPDIR}"/RPMS/*/hello-debuginfo-1.0-1.*.rpm \
|
|
Panu Matilainen |
5b4d98 |
+ | grep /.build-id/ | wc --lines
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# Extract the both packages to check the build-id files link to the
|
|
Panu Matilainen |
5b4d98 |
+# main and .debug files.
|
|
Panu Matilainen |
5b4d98 |
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello-1.0-1.*.rpm \
|
|
Panu Matilainen |
5b4d98 |
+ | cpio -diu
|
|
Panu Matilainen |
5b4d98 |
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello-debuginfo-1.0-1.*.rpm \
|
|
Panu Matilainen |
5b4d98 |
+ | cpio -diu
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# Check there is a build-id symlink for the main file.
|
|
Panu Matilainen |
5b4d98 |
+main_file=./usr/local/bin/hello
|
|
Panu Matilainen |
5b4d98 |
+test -f "${main_file}" || echo "No main file ${main_file}"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# Extract the build-id from the main file
|
|
Panu Matilainen |
5b4d98 |
+id_main=$(file $main_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+id_main_file="./usr/lib/.build-id/${id_main:0:2}/${id_main:2}"
|
|
Panu Matilainen |
5b4d98 |
+test -L "$id_main_file" || echo "No build-id file $id_main_file"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+canon_main_file=$(readlink -f ${main_file})
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test -f "$canon_main_file" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "Cannot resolve main file ${main_file} -> ${canon_main_file}"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+canon_main_id_file=$(readlink -f ${id_main_file})
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test -f "$canon_main_id_file" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "Cannot resolve main build-id file ${id_main_file} -> ${canon_main_id_file}"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+test "$canon_main_file" = "$canon_main_id_file" \
|
|
Panu Matilainen |
5b4d98 |
+ || echo "main and build-id file not linked"
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
+# And check the same for the debug file.
|
|
Panu Matilainen |
5b4d98 |
+debug_file=./usr/lib/debug/usr/local/bin/hello-*debug
|
|
Panu Matilainen |
5b4d98 |
+test -f ${debug_file} || echo "No debug file ${debug_file}"
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
# Extract the build-id from the .debug file
|
|
Panu Matilainen |
5b4d98 |
id_debug=$(file $debug_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
@@ -784,8 +1080,12 @@ rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello-1.0-1.*.rpm \
|
|
Panu Matilainen |
5b4d98 |
hello_file=./usr/local/bin/hello
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
# Extract the build-id from the main file
|
|
Panu Matilainen |
5b4d98 |
+test -f $hello_file || echo "No $hello_file"
|
|
Panu Matilainen |
5b4d98 |
id1=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
+# Make sure we generate a new one
|
|
Panu Matilainen |
5b4d98 |
+rm $hello_file
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
# Build the "next" release, which has no changes except for the release update.
|
|
Panu Matilainen |
5b4d98 |
run rpmbuild --quiet \
|
|
Panu Matilainen |
5b4d98 |
--macros=${abs_top_builddir}/macros:${abs_top_builddir}/tests/testing/usr/local/lib/rpm/platform/%{_target_cpu}-%{_target_os}/macros:${top_srcdir}/macros.debug \
|
|
Panu Matilainen |
5b4d98 |
@@ -797,6 +1097,7 @@ rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello-1.0-2.*.rpm \
|
|
Panu Matilainen |
5b4d98 |
| cpio -diu --quiet
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
# Extract the build-id from the main file
|
|
Panu Matilainen |
5b4d98 |
+test -f $hello_file || echo "No $hello_file"
|
|
Panu Matilainen |
5b4d98 |
id2=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
if test "$id1" == "$id2"; then echo "equal $id1"; else echo "unequal"; fi
|
|
Panu Matilainen |
5b4d98 |
@@ -823,6 +1124,7 @@ run rpmbuild --quiet \
|
|
Panu Matilainen |
5b4d98 |
--macros=${abs_top_builddir}/macros:${abs_top_builddir}/tests/testing/usr/local/lib/rpm/platform/%{_target_cpu}-%{_target_os}/macros:${top_srcdir}/macros.debug \
|
|
Panu Matilainen |
5b4d98 |
--rcfile=${abs_top_builddir}/rpmrc \
|
|
Panu Matilainen |
5b4d98 |
--undefine="_unique_build_ids" \
|
|
Panu Matilainen |
5b4d98 |
+ --undefine="_unique_debug_names" \
|
|
Panu Matilainen |
5b4d98 |
-ba "${abs_srcdir}"/data/SPECS/hello.spec
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello-1.0-1.*.rpm \
|
|
Panu Matilainen |
5b4d98 |
@@ -831,19 +1133,25 @@ rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello-1.0-1.*.rpm \
|
|
Panu Matilainen |
5b4d98 |
hello_file=./usr/local/bin/hello
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
# Extract the build-id from the main file
|
|
Panu Matilainen |
5b4d98 |
+test -f $hello_file || echo "No $hello_file"
|
|
Panu Matilainen |
5b4d98 |
id1=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
+# Make sure we generate a new one
|
|
Panu Matilainen |
5b4d98 |
+rm $hello_file
|
|
Panu Matilainen |
5b4d98 |
+
|
|
Panu Matilainen |
5b4d98 |
# Build the "next" release, which has no changes except for the release update.
|
|
Panu Matilainen |
5b4d98 |
run rpmbuild --quiet \
|
|
Panu Matilainen |
5b4d98 |
--macros=${abs_top_builddir}/macros:${abs_top_builddir}/tests/testing/usr/local/lib/rpm/platform/%{_target_cpu}-%{_target_os}/macros:${top_srcdir}/macros.debug \
|
|
Panu Matilainen |
5b4d98 |
--rcfile=${abs_top_builddir}/rpmrc \
|
|
Panu Matilainen |
5b4d98 |
--undefine="_unique_build_ids" \
|
|
Panu Matilainen |
5b4d98 |
+ --undefine="_unique_debug_names" \
|
|
Panu Matilainen |
5b4d98 |
-ba "${abs_srcdir}"/data/SPECS/hello-r2.spec
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello-1.0-2.*.rpm \
|
|
Panu Matilainen |
5b4d98 |
| cpio -diu --quiet
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
# Extract the build-id from the main file
|
|
Panu Matilainen |
5b4d98 |
+test -f $hello_file || echo "No $hello_file"
|
|
Panu Matilainen |
5b4d98 |
id2=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
if test "$id1" == "$id2"; then echo "equal"; else echo "unequal $id1 $id2"; fi
|
|
Panu Matilainen |
5b4d98 |
--
|
|
Panu Matilainen |
5b4d98 |
2.9.3
|
|
Panu Matilainen |
5b4d98 |
|