[Rpm-maint] [PATCH 2/2] Test split debuginfo packages with RemovePathPostfixes.

Mark Wielaard mark at klomp.org
Fri Jul 28 21:24:26 UTC 2017


If split debuginfo code doesn't know about RemovePathPostfixes it fails:

error: Installed (but unpackaged) file(s) found:
   /usr/lib/debug/bin/hello.foobar-1.0-1.x86_64.debug

Signed-off-by: Mark Wielaard <mark at klomp.org>
---
 tests/Makefile.am                                  |  1 +
 .../data/SPECS/test-subpackages-pathpostfixes.spec | 39 ++++++++++++
 tests/rpmbuild.at                                  | 71 ++++++++++++++++++++++
 3 files changed, 111 insertions(+)
 create mode 100644 tests/data/SPECS/test-subpackages-pathpostfixes.spec

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 687992f..03cdea9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -66,6 +66,7 @@ EXTRA_DIST += data/SPECS/testdoc.spec
 EXTRA_DIST += data/SPECS/sigpipe.spec
 EXTRA_DIST += data/SPECS/test-subpackages.spec
 EXTRA_DIST += data/SPECS/test-subpackages-exclude.spec
+EXTRA_DIST += data/SPECS/test-subpackages-pathpostfixes.spec
 EXTRA_DIST += data/SOURCES/hello-1.0-modernize.patch
 EXTRA_DIST += data/SOURCES/hello-1.0.tar.gz
 EXTRA_DIST += data/SOURCES/hello-2.0.tar.gz
diff --git a/tests/data/SPECS/test-subpackages-pathpostfixes.spec b/tests/data/SPECS/test-subpackages-pathpostfixes.spec
new file mode 100644
index 0000000..19b3b9e
--- /dev/null
+++ b/tests/data/SPECS/test-subpackages-pathpostfixes.spec
@@ -0,0 +1,39 @@
+Name:           test
+Version:        1.0
+Release:        1
+Summary:        Test
+
+License:        Public Domain
+URL:            https://fedoraproject.org
+Source:         hello.c
+
+%description
+%{summary}.
+
+%package test2
+RemovePathPostfixes: .foobar
+Summary: Test2.
+%description test2
+
+%prep
+%autosetup -c -D -T
+cp -a %{S:0} .
+
+%build
+gcc -g hello.c -o hello
+cp hello.c hello2.c
+gcc -g hello2.c -o hello.foobar
+
+%install
+mkdir -p %{buildroot}/bin
+install -D -p -m 0755 -t %{buildroot}/bin hello
+# Install as hello.foobar, but we want the postfix removed in the package...
+install -D -p -m 0755 -t %{buildroot}/bin hello.foobar
+
+%files
+/bin/hello
+
+%files test2
+/bin/hello.foobar
+
+%changelog
diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at
index cbe653d..7864477 100644
--- a/tests/rpmbuild.at
+++ b/tests/rpmbuild.at
@@ -1232,3 +1232,74 @@ No hello3 debug
 ],
 [ignore])
 AT_CLEANUP
+
+# ------------------------------
+# Check that defining _debuginfo_subpackages works with RemovePathPostfixes.
+AT_SETUP([rpmbuild debuginfo subpackages multiple excluded])
+AT_KEYWORDS([build] [debuginfo] [debugsubpackage] [debugsource])
+AT_CHECK([
+rm -rf ${TOPDIR}
+AS_MKDIR_P(${TOPDIR}/SOURCES)
+
+# Setup sources
+cp "${abs_srcdir}"/data/SOURCES/hello.c ${TOPDIR}/SOURCES
+
+run rpmbuild --quiet \
+  --macros=${abs_top_builddir}/macros:${abs_top_builddir}/tests/testing/usr/local/lib/rpm/platform/%{_target_cpu}-%{_target_os}/macros:${top_srcdir}/macros.debug \
+  --rcfile=${abs_top_builddir}/rpmrc \
+  --define "_unique_debug_names 1" \
+  --define "_unique_debug_srcs 1" \
+  --define "_debugsource_packages 1" \
+  --define "_debuginfo_subpackages 1" \
+  -ba "${abs_srcdir}"/data/SPECS/test-subpackages-pathpostfixes.spec
+
+# Check that there are 2 debuginfo packages.
+ls ${abs_builddir}/testing/build/RPMS/*/*debuginfo*rpm | wc --lines
+
+# First contains hello.debug
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-1.0-1.*.rpm \
+  | cpio -diu --quiet
+# Extract the debug name from the exe (.gnu_debuglink section, first string)
+debug_name=$(readelf -p .gnu_debuglink ./bin/hello | grep hello | cut -c13-)
+
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-debuginfo-1.0-1.*.rpm \
+  | cpio -diu --quiet
+if test -f ./usr/lib/debug/bin/$debug_name; then
+  echo "hello debug exists"
+else
+  echo "No hello: $debug_name"
+fi
+
+# remove it, we are going to check the other debuginfo package.
+rm ./bin/hello
+rm ./usr/lib/debug/bin/$debug_name
+orig_debugname=$debugname
+
+# Second contains hello.foobar.debug but NOT hello.debug
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-test2-1.0-1.*.rpm \
+  | cpio -diu --quiet
+# Extract the debug name from the exe (.gnu_debuglink section, first string)
+debug_name=$(readelf -p .gnu_debuglink ./bin/hello | grep hello | cut -c13-)
+
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-test2-debuginfo-1.0-1.*.rpm \
+  | cpio -diu --quiet
+if test -f ./usr/lib/debug/bin/$debug_name; then
+  echo "hello.foobar debug exists"
+else
+  echo "No hello2: $debug_name"
+fi
+
+if test -f ./usr/lib/debug/bin/$orig_debugname; then
+  echo "$orig_debugname exists"
+else
+  echo "No hello.debug"
+fi
+],
+[0],
+[2
+hello debug exists
+hello.foobar debug exists
+No hello.debug
+],
+[ignore])
+AT_CLEANUP
-- 
1.8.3.1



More information about the Rpm-maint mailing list