Skip to content
Snippets Groups Projects
Verified Commit 7fc29959 authored by Christian Heusel's avatar Christian Heusel :rocket:
Browse files

dbscripts: make createlinks also work if filename contains spaces

This addresses the problem that so far the for loop recognizes each
filename with a space as different word, i.e.:

$ for f in $(find pkg -type f); do echo "$f"; done
pkg/usr/bin/Surge
XT
Effects
pkg/usr/bin/Surge
XT

while the correct output would have been:
pkg/usr/bin/Surge XT Effects
pkg/usr/bin/Surge XT

We fix this by just passing everything directly via xargs to readelf,
which also removes the loop overhead. This also results in a significant
speedup for packages with a lot of libraries and binaries.

fixes archlinux/infrastructure#524


Signed-off-by: default avatarChristian Heusel <christian@heusel.eu>
parent e87cd39b
No related branches found
No related tags found
No related merge requests found
Pipeline #74368 passed
......@@ -44,9 +44,7 @@ for repo in ${repos[@]}; do
echo "$repo/$arch: $pkgname"
mkdir -p ${tmppkgdir}/pkg
bsdtar -xof $pkg -C ${tmppkgdir}/pkg --include={opt,{,usr/}{lib{,32},{s,}bin}}'/*' 2>/dev/null
for f in $(find ${tmppkgdir}/pkg -type f); do
readelf -d "$f" 2> /dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p'
done | sort -u > ${tmppkgdir}/links
find "${tmppkgdir}/pkg" -type f -print0 | xargs -0 readelf -d 2> /dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p' | sort -u > "${tmppkgdir}/links"
rm -rf ${tmppkgdir}/pkg
fi
done
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment