Skip to content

Commit

Permalink
Use 4.19.1 brp-strip with xargs parallel processing and filtering
Browse files Browse the repository at this point in the history
From: https://github.com/rpm-software-management/rpm/blob/rpm-4.19.1-release/scripts/brp-strip
Added js, rb files to the go filtering in upstream version

Curl brp-strip 4.19.1 and patch it at image build time
  • Loading branch information
jrafanie committed Jan 9, 2024
1 parent 6426786 commit 4f3ca65
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,15 @@ RUN npm install yarn -g

RUN echo "gem: --no-ri --no-rdoc --no-document" > /root/.gemrc

RUN curl -o /usr/lib/rpm/brp-strip https://raw.githubusercontent.com/rpm-software-management/rpm/rpm-4.19.1-release/scripts/brp-strip

RUN chmod +x /usr/lib/rpm/brp-strip

COPY . /build_scripts

RUN cd /usr/lib/rpm/ && \
patch -p2 < /build_scripts/container-assets/Add-js-rb-filtering-on-top-of-4.19.1.patch

RUN gem install bundler

ENTRYPOINT ["/build_scripts/container-assets/user-entrypoint.sh"]
33 changes: 33 additions & 0 deletions container-assets/Add-js-rb-filtering-on-top-of-4.19.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
From 7d0f0d9c34a934327cfdd68e721c250af39a5c13 Mon Sep 17 00:00:00 2001
From: Joe Rafaniello <[email protected]>
Date: Tue, 9 Jan 2024 15:00:25 -0500
Subject: [PATCH] Add js/rb filtering on top of 4.19.1

---
scripts/brp-strip | 3 +++
1 file changed, 3 insertions(+)

diff --git a/scripts/brp-strip b/scripts/brp-strip
index 799bf2bc2..b258debc8 100755
--- a/scripts/brp-strip
+++ b/scripts/brp-strip
@@ -20,6 +20,7 @@ esac

# Below is the explanation of commands in the order of their appearance
# Ignore /usr/lib/debug entries
+# Ignore all js and rb javascript and ruby files
# Ignore all go(guile objects & golang) files
# Consider files with only single link
# Run the file command to find relevant non-stripped binaries, with bundle size of 32
@@ -33,6 +34,8 @@ strip_elf_binaries()

find "$RPM_BUILD_ROOT" -type f \
! -regex "${RPM_BUILD_ROOT}/*usr/lib/debug.*" \
+ ! -name "*.js" \
+ ! -name "*.rb" \
! -name "*.go" -links "${nlinks}" -print0 | \
xargs -0 -r -P${nprocs} -n${MAX_ARGS} sh -c "file \"\$@\" | \
sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped.*/\1/p' | \
--
2.42.0

0 comments on commit 4f3ca65

Please sign in to comment.