[Rpm-maint] [PATCH] Warn and create empty debugsource package if there are no sources.
Mark Wielaard
mark at klomp.org
Fri Jul 28 13:29:52 UTC 2017
Signed-off-by: Mark Wielaard <mark at klomp.org>
---
scripts/find-debuginfo.sh | 13 +++++++++++++
tests/rpmbuild.at | 33 +++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+)
diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
index d8725ad..9b3815a 100755
--- a/scripts/find-debuginfo.sh
+++ b/scripts/find-debuginfo.sh
@@ -573,6 +573,19 @@ if [ -n "$srcout" ]; then
find src/debug -mindepth 1 -maxdepth 1
) | sed 's,^,/usr/,' >> "$srcout"
fi
+ if [ ! -s "$srcout" ]; then
+ echo >&2 "*** WARNING: No source files found. Creating empty debugsource package"
+ # Create the empty directory.
+ # See also debugedit invocation. 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}"
+ fi
+ mkdir -p "${RPM_BUILD_ROOT}${debug_dest_name}"
+ echo "$debug_dest_name" > "$srcout"
+ fi
fi
# Append to $1 only the lines from stdin not already in the file.
diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at
index 3f41652..2359c63 100644
--- a/tests/rpmbuild.at
+++ b/tests/rpmbuild.at
@@ -900,3 +900,36 @@ ls ./usr/src/debug/test-1.0*/
],
[ignore])
AT_CLEANUP
+
+# ------------------------------
+# Check that defining _debugsource_packages creates -debugsource package
+# doesn't break when there are no source files (found).
+AT_SETUP([rpmbuild debugsource no source files])
+AT_KEYWORDS([build] [debuginfo] [debugsource])
+AT_CHECK([
+rm -rf ${TOPDIR}
+AS_MKDIR_P(${TOPDIR}/SOURCES)
+
+# Setup sources
+cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz "${abs_srcdir}"/data/SOURCES/hello-1.0-modernize.patch ${TOPDIR}/SOURCES
+
+# Build a package that doesn't use -g.
+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 "_debugsource_packages 1" \
+ -ba "${abs_srcdir}"/data/SPECS/hello.spec
+
+# Unpack the debugsource rpm so we can check the sources are (not) there.
+rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello-debugsource-1.0-1.*.rpm \
+ | cpio -diu --quiet
+
+# There should be just one empty directory (strip off nvra).
+find ./usr/src/debug/* | cut -f1 -d-
+
+],
+[0],
+[./usr/src/debug/hello
+],
+[ignore])
+AT_CLEANUP
--
1.8.3.1
More information about the Rpm-maint
mailing list