kernel.spec: allow to package some binaries as unstripped

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2161464
Upstream Status: RHEL only
ARK commit 9cc9fe68f41bf0ca97ad7235f4735dc7a22943fc

Some binaries (tests) don't work properly without symbols.
Add a macro that allows to package their unstripped version.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
This commit is contained in:
Jan Stancek 2023-02-08 08:31:29 -05:00
parent 3419415054
commit 9a8d282fb0
1 changed files with 16 additions and 0 deletions

View File

@ -29,6 +29,18 @@
%global _with_cross 1
%endif
# RPM macros strip everything in BUILDROOT, either with __strip
# or find-debuginfo.sh. Make use of __spec_install_post override
# and save/restore binaries we want to package as unstripped.
%define buildroot_unstripped %{_builddir}/root_unstripped
%define buildroot_save_unstripped() \
(cd %{buildroot}; cp -rav --parents -t %{buildroot_unstripped}/ %1 || true) \
%{nil}
%define __restore_unstripped_root_post \
echo "Restoring unstripped artefacts %{buildroot_unstripped} -> %{buildroot}" \
cp -rav %{buildroot_unstripped}/. %{buildroot}/ \
%{nil}
# The kernel's %%install section is special
# Normally the %%install section starts by cleaning up the BUILD_ROOT
# like so:
@ -1597,6 +1609,9 @@ cd ..
###
%build
rm -rf %{buildroot_unstripped} || true
mkdir -p %{buildroot_unstripped}
%if %{with_sparse}
%define sparse_mflags C=1
%endif
@ -2491,6 +2506,7 @@ find Documentation -type d | xargs chmod u+w
%{__arch_install_post}\
%{__os_install_post}\
%{__remove_unwanted_dbginfo_install_post}\
%{__restore_unstripped_root_post}\
%{__modsign_install_post}
###