1

OS RedHat 8.4

I know that having %debug_package macro in a spec file will generate debuginfo for a package, and will produce mypackage-debuginfo-<VERSION>.<ARCH> rpm. However the funny thing is that spec file I have does not have this macro and yet the debuginfo is built.

However, at the top of the spec file there is a few global variables:

%global _hardened_build 1
%global sysrepo 0
%undefine _missing_build_ids_terminate_build
%define _unpackaged_files_terminate_build 0

I wonder if one of them enables %debug_package macro?

chutz
  • 7,569
  • 1
  • 28
  • 57
Mark
  • 209
  • 1
  • 4
  • 10

1 Answers1

1

TL;DR: Add the following line to your specfile:

%global debug_package %{nil}

You didn't mention what OS this is, but my experience is that debuginfo is generated automatically for binary packages, and you have to specifically disable it for non-noarch packages.

How to disable is documented here: https://docs.fedoraproject.org/en-US/packaging-guidelines/Debuginfo/#_useless_or_incomplete_debuginfo_packages_due_to_other_reasons

If you wish to disable generation of the useless debuginfo package while waiting for improvements to find-debuginfo.sh or if it's unlikely that it could be enhanced to produce a good debuginfo for your package (for example no architecture dependent files, but package is not noarch because of the installation paths it uses), use %global debug_package %{nil} in the specfile, and be sure to add a comment next to it explaining why it was done.

And if it doesn't work on your version, you can dig through the output of the following command:

rpm --showrc

On my Rocky 8.5 version I see that the debug_package macro is the one defining the extra package, so setting that to %{nil} effectively disables it. You can also see how noarch packages have no debuginfo.

$ rpm --showrc| sed -ne '/^-13: debug_package/,/^-/p'
-13: debug_package
%ifnarch noarch
%global __debug_package 1
%_debuginfo_template
%{?_debugsource_packages:%_debugsource_template}
%endif
%{nil}
-13: defined    %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
chutz
  • 7,569
  • 1
  • 28
  • 57