[Rpm-maint] [PATCH 1/2] Test split debuginfo packages with excluded files.
Mark Wielaard
mark at klomp.org
Fri Jul 28 21:24:25 UTC 2017
If split debuginfo code doesn't know about excluded files it fails:
error: Installed (but unpackaged) file(s) found:
/usr/lib/debug/bin/hello3-1.0-1.x86_64.debug
Signed-off-by: Mark Wielaard <mark at klomp.org>
---
tests/Makefile.am | 1 +
tests/data/SPECS/test-subpackages-exclude.spec | 42 ++++++++++++++++
tests/rpmbuild.at | 66 ++++++++++++++++++++++++++
3 files changed, 109 insertions(+)
create mode 100644 tests/data/SPECS/test-subpackages-exclude.spec
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7b69ba0..687992f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -65,6 +65,7 @@ EXTRA_DIST += data/SPECS/prefixtest.spec
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/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-exclude.spec b/tests/data/SPECS/test-subpackages-exclude.spec
new file mode 100644
index 0000000..e93b10b
--- /dev/null
+++ b/tests/data/SPECS/test-subpackages-exclude.spec
@@ -0,0 +1,42 @@
+Name: test
+Version: 1.0
+Release: 1
+Summary: Test
+
+License: Public Domain
+URL: https://fedoraproject.org
+Source: hello.c
+
+%description
+%{summary}.
+
+%package test2
+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 hello2
+cp hello.c hello3.c
+gcc -g hello3.c -o hello3
+
+%install
+mkdir -p %{buildroot}/bin
+install -D -p -m 0755 -t %{buildroot}/bin hello
+install -D -p -m 0755 -t %{buildroot}/bin hello2
+# Install it, but then exclude it...
+install -D -p -m 0755 -t %{buildroot}/bin hello3
+
+%files
+/bin/hello
+
+%files test2
+/bin/hello2
+%exclude /bin/hello3
+
+%changelog
diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at
index e2008da..cbe653d 100644
--- a/tests/rpmbuild.at
+++ b/tests/rpmbuild.at
@@ -1166,3 +1166,69 @@ hello3 debug exists
],
[ignore])
AT_CLEANUP
+
+# ------------------------------
+# Check that defining _debuginfo_subpackages works with excluded files.
+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-exclude.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
+
+# Second contains hello2.debug but NOT hello3.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/hello2 | 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 "hello2 debug exists"
+else
+ echo "No hello2: $debug_name"
+fi
+
+if test -f ./usr/lib/debug/bin/hello3*; then
+ echo "hello3 debug exists"
+else
+ echo "No hello3 debug"
+fi
+],
+[0],
+[2
+hello debug exists
+hello2 debug exists
+No hello3 debug
+],
+[ignore])
+AT_CLEANUP
--
1.8.3.1
More information about the Rpm-maint
mailing list