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}}