From: Jan Stancek <jstancek@xxxxxxxxxx> kernel.spec: allow to package some binaries as unstripped 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@xxxxxxxxxx> diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template index blahblah..blahblah 100755 --- a/redhat/kernel.spec.template +++ b/redhat/kernel.spec.template @@ -32,6 +32,18 @@ %global buildroot %{_buildrootdir}/%{NAME}-%{VERSION}-%{RELEASE}.%{_build_cpu} %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: @@ -1649,6 +1661,9 @@ cd .. ### %build +rm -rf %{buildroot_unstripped} || true +mkdir -p %{buildroot_unstripped} + %if %{with_sparse} %define sparse_mflags C=1 %endif @@ -2583,6 +2598,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} ### -- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2286 _______________________________________________ kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue