Skip to content

Commit

Permalink
Honor _enable_debug_packages when processing files
Browse files Browse the repository at this point in the history
If the automatic creation of debuginfo packages is switched off via the
__debug_package macro don't touch debuginfo packages that are
declared in the spec file. If the packager created those on their own we
should not mess with them.

Also don't generate buildid files.

Resolves: rpm-software-management#3057
  • Loading branch information
ffesti committed Aug 28, 2024
1 parent 65fa582 commit 1e77f71
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 4 deletions.
12 changes: 8 additions & 4 deletions build/files.c
Original file line number Diff line number Diff line change
Expand Up @@ -2588,7 +2588,7 @@ static rpmRC processPackageFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags,
{
/* Check build-ids and add build-ids links for files to package list. */
const char *arch = headerGetString(pkg->header, RPMTAG_ARCH);
if (!rstreq(arch, "noarch")) {
if (rpmExpandNumeric("%{?__debug_package}") && !rstreq(arch, "noarch")) {
/* Go through the current package list and generate a files list. */
ARGV_t idFiles = NULL;
if (generateBuildIDs (&fl, &idFiles) != 0) {
Expand Down Expand Up @@ -3072,15 +3072,19 @@ rpmRC processBinaryFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags,
Package deplink = NULL; /* create requires to this package */
/* The debugsource package, if it exists, that the debuginfo package(s)
should Recommend. */
Package dbgsrcpkg = findDebugsourcePackage(spec);
Package dbgsrcpkg = NULL;
int processDebug = rpmExpandNumeric("%{?__debug_package}");

#ifdef HAVE_LIBDW
elf_version (EV_CURRENT);
#endif
check_fileList = newStringBuf();
buildroot = rpmGenPath(spec->rootDir, spec->buildRoot, NULL);

if (rpmExpandNumeric("%{?_debuginfo_subpackages}")) {

if (processDebug)
dbgsrcpkg = findDebugsourcePackage(spec);

if (processDebug && rpmExpandNumeric("%{?_debuginfo_subpackages}")) {
maindbg = findDebuginfoPackage(spec);
if (maindbg) {
/* move debuginfo package to back */
Expand Down
55 changes: 55 additions & 0 deletions tests/data/SPECS/hello-debuginfo.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# To whom it may concern:
# DO NOT COPY THIS SPEC or its derivates to your testcase. That is,
# unless your test-case actually requires running a compiler and
# inspecting it's output. Everybody else should use a simple noarch
# package which can be built under runroot in the test-suite.

Summary: hello -- hello, world rpm
Name: hello
Version: 1.0
Release: 1
Group: Utilities
License: GPL
SourceLicense: GPL, ASL 1.0
Distribution: RPM test suite.
URL: http://rpm.org
Source0: hello-1.0.tar.gz
Patch0: hello-1.0-modernize.patch
Prefix: /usr
%global _enable_debug_packages 0

%description
Simple rpm demonstration.

%prep
%setup -q
%patch -p1 -b .modernize 0

%build
make

%install
mkdir -p $RPM_BUILD_ROOT/usr/local/bin
make DESTDIR=$RPM_BUILD_ROOT install
mkdir -p %{buildroot}/usr/lib/debug
touch %{buildroot}/usr/lib/debug/test.txt

%files
%defattr(-,root,root)
%doc FAQ
#%readme README
#%license COPYING
%attr(0751,root,root) /usr/local/bin/hello

%package debuginfo
Summary: debuginfo

%description debuginfo
description

%files debuginfo
/usr/lib/debug/test.txt

%changelog
* Tue Oct 20 1998 Jeff Johnson <[email protected]>
- create.
26 changes: 26 additions & 0 deletions tests/rpmbuild.at
Original file line number Diff line number Diff line change
Expand Up @@ -2413,6 +2413,32 @@ No hello.debug
[ignore])
RPMTEST_CLEANUP

AT_SETUP([manual debuginfo package])
AT_KEYWORDS([build debuginfo])
RPMTEST_CHECK([
RPMDB_INIT

runroot rpmbuild --quiet -bb \
/data/SPECS/hello-debuginfo.spec
],
[0],
[ignore],
[ignore])

RPMTEST_CHECK([

runroot rpm -qpl /build/RPMS/*/hello-1.0-1.*.rpm
runroot rpm -qpl /build/RPMS/*/hello-debuginfo-1.0-1.*.rpm
],
[0],
[/usr/local/bin/hello
/usr/local/share/doc/hello-1.0
/usr/local/share/doc/hello-1.0/FAQ
/usr/lib/debug/test.txt
],
[ignore])
RPMTEST_CLEANUP

AT_SETUP([explicit %_enable_debug_package on noarch])
AT_KEYWORDS([build debuginfo])
RPMTEST_CHECK([
Expand Down

0 comments on commit 1e77f71

Please sign in to comment.