Skip to content

Commit 326e802

Browse files
author
Herton R. Krzesinski
committed
Merge: kernel.spec: allow to package some binaries as unstripped
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/2041 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> Approved-by: Herton R. Krzesinski <herton@redhat.com> Approved-by: Prarit Bhargava <prarit@redhat.com> Approved-by: Patrick Talbert <ptalbert@redhat.com> Approved-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2 parents 01f91cc + db92129 commit 326e802

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

redhat/kernel.spec.template

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@
2929
%global _with_cross 1
3030
%endif
3131

32+
# RPM macros strip everything in BUILDROOT, either with __strip
33+
# or find-debuginfo.sh. Make use of __spec_install_post override
34+
# and save/restore binaries we want to package as unstripped.
35+
%define buildroot_unstripped %{_builddir}/root_unstripped
36+
%define buildroot_save_unstripped() \
37+
(cd %{buildroot}; cp -rav --parents -t %{buildroot_unstripped}/ %1 || true) \
38+
%{nil}
39+
%define __restore_unstripped_root_post \
40+
echo "Restoring unstripped artefacts %{buildroot_unstripped} -> %{buildroot}" \
41+
cp -rav %{buildroot_unstripped}/. %{buildroot}/ \
42+
%{nil}
43+
3244
# The kernel's %%install section is special
3345
# Normally the %%install section starts by cleaning up the BUILD_ROOT
3446
# like so:
@@ -1692,6 +1704,9 @@ cd ..
16921704
###
16931705
%build
16941706

1707+
rm -rf %{buildroot_unstripped} || true
1708+
mkdir -p %{buildroot_unstripped}
1709+
16951710
%if %{with_sparse}
16961711
%define sparse_mflags C=1
16971712
%endif
@@ -2549,6 +2564,7 @@ for dir in bpf bpf/no_alu32 bpf/progs; do
25492564
xargs -0 cp -t %{buildroot}%{_libexecdir}/kselftests/$dir || true
25502565
done
25512566
ln -sr %{buildroot}%{_libexecdir}/kselftests/bpf/bpftool %{buildroot}%{_libexecdir}/kselftests/bpf/no_alu32/bpftool
2567+
%buildroot_save_unstripped "usr/libexec/kselftests/bpf/test_progs"
25522568
popd
25532569
export -n BPFTOOL
25542570
%endif
@@ -2636,6 +2652,7 @@ find Documentation -type d | xargs chmod u+w
26362652
%{__arch_install_post}\
26372653
%{__os_install_post}\
26382654
%{__remove_unwanted_dbginfo_install_post}\
2655+
%{__restore_unstripped_root_post}\
26392656
%{__modsign_install_post}
26402657

26412658
###

0 commit comments

Comments
 (0)