Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions pkg/build/pipelines/strip.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,22 @@ inputs:
pipeline:
- working-directory: ${{targets.contextdir}}
runs: |
scanelf --recursive --nobanner --osabi --etype "ET_DYN,ET_EXEC" . \
| while read type osabi filename; do
check() { "$@" || { echo "[strip] FATAL: '$*' failed $?"; exit 1; }; }

scanout=$(mktemp)
check scanelf --recursive --nobanner --etype "ET_DYN,ET_EXEC" --format "%I %a" -o "$scanout" .

count=0
while read osabi arch filename; do
# Skip foreign binaries
case "${{build.arch}}" in
x86_64) [ "$arch" = "EM_X86_64" ] || continue;;
aarch64) [ "$arch" = "EM_AARCH64" ] || continue;;
esac
[ "$osabi" != "STANDALONE" ] || continue
# scanelf may have picked up a temp file so verify that file still exists
strip ${{inputs.opts}} "${filename}" || [ ! -e "$filename" ]
done
check strip ${{inputs.opts}} "$filename"
count=$((count+1))
done < "$scanout"

echo "[strip] stripped $count ${{build.arch}} binaries in $PWD"
rm -f "$scanout"
Loading