Provide a function "stripDir" to strip a single directory tree

This commit is contained in:
Eelco Dolstra 2013-08-22 16:18:45 +02:00
parent bfa20c96cc
commit b40a562c9c

View File

@ -275,26 +275,31 @@ export NIX_BUILD_CORES
# Misc. helper functions. # Misc. helper functions.
stripDirs() { stripDir() {
local dirs="$1" local dir="$1"
local stripFlags="$2" local stripFlags="$2"
local dirsNew=
for d in ${dirs}; do if [ -e "$dir" ]; then
if [ -d "$prefix/$d" ]; then header "stripping (with flags $stripFlags) in $dir"
dirsNew="${dirsNew} $prefix/$d " find "$dir" -type f -print0 | xargs -0 ${xargsFlags:--r} strip $stripFlags || true
fi
done
dirs=${dirsNew}
if [ -n "${dirs}" ]; then
header "stripping (with flags $stripFlags) in $dirs"
find $dirs -type f -print0 | xargs -0 ${xargsFlags:--r} strip $stripFlags || true
stopNest stopNest
fi fi
} }
stripDirs() {
local prefix="$1"
local subdirs="$2"
local stripFlags="$3"
for d in $subdirs; do
if [ -d "$prefix/$d" ]; then
stripDir "$prefix/$d" "$stripFlags"
fi
done
}
###################################################################### ######################################################################
# Textual substitution functions. # Textual substitution functions.
@ -806,12 +811,12 @@ fixupPrefix() {
if [ -z "$dontStrip" ]; then if [ -z "$dontStrip" ]; then
stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin} stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin}
if [ -n "$stripDebugList" ]; then if [ -n "$stripDebugList" ]; then
stripDirs "$stripDebugList" "${stripDebugFlags:--S}" stripDirs "$prefix" "$stripDebugList" "${stripDebugFlags:--S}"
fi fi
stripAllList=${stripAllList:-} stripAllList=${stripAllList:-}
if [ -n "$stripAllList" ]; then if [ -n "$stripAllList" ]; then
stripDirs "$stripAllList" "${stripAllFlags:--s}" stripDirs "$prefix" "$stripAllList" "${stripAllFlags:--s}"
fi fi
fi fi