Score:1

rpm: how to disable debuginfo

ro flag

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?

Score:1
cn flag

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}}
ro flag
Thanks a lot, that helped. It was indeed defined in `rpm --showrc` output.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.