diff --git a/scripts/Build-Tools b/scripts/Build-Tools index fc26c912f..b0e6de073 100755 --- a/scripts/Build-Tools +++ b/scripts/Build-Tools @@ -58,27 +58,11 @@ if [ $toolsdir = tools.cross ]; then mkdir -p build/$ROCKCFG_ID/root/var/adm/logs fi -# Subversion has really big ".svn" subdirs. This has much better performance -# than the "find ... ! -path '*/.svn*' ! -path '*/CVS*' ..." used earlier -# in the x="$( .. )" statement. - -tmp1=`mktemp` tmp2=`mktemp` -echo config/$config/. package/. scripts/. misc/. architecture/. target/. > $tmp1 - -while ! cmp -s $tmp1 $tmp2 -do - cat $tmp1 > $tmp2 - find $( cat $tmp2 ) -maxdepth 1 -type d | \ - egrep -v '/(\.svn|CVS)$' 2> /dev/null | sort -u > $tmp1 -done - -x="$( find $( cat $tmp2 ) -mindepth 1 -maxdepth 1 \ - ! -name '*.cache' ! -name 'CVS' ! -name '.svn' \ +x="$( bash scripts/xfind.sh config/$config/. package/. scripts/. \ + misc/. architecture/. target/. ! -name '*.cache' \ -newer build/$ROCKCFG_ID/$toolsdir/.lastupdate \ -printf 'Found new/updated file: %p\n' 2> /dev/null )" -rm -f $tmp1 $tmp2 - if [ "$x" ] ; then echo_header Found $( echo "$x" | wc -l ) new/updated \ files in source tree: @@ -188,7 +172,7 @@ if [ ! -f build/$ROCKCFG_ID/$toolsdir/.lastupdate ] ; then } # while read script ; do . $script - done < <( find package/. target/$target/. misc/. -name 'wrappers.in' ) + done < <( bash scripts/xfind.sh package/. target/$target/. misc/. -name 'wrappers.in' ) # echo_status "Building $toolsdir/wrapper/strip_wrapper." cat << 'EOT' > build/$ROCKCFG_ID/$toolsdir/wrapper/strip_wrapper.$$ @@ -274,10 +258,10 @@ EOT # Create Parse-Config Collection # echo_status "Creating $toolsdir/lib/parse-config." - find architecture/$arch/. package/. target/$target/. misc/ \ + bash scripts/xfind.sh \ + architecture/$arch/. package/. target/$target/. misc/ -type f \ '(' -name 'parse-config' -o -name 'parse-config-*' ')' \ '(' ! -name 'parse-config-x' -o ! -name 'parse-config-*-x' ')' \ - ! -path '*/\.svn/*' -type f \ -printf '%f\t%p\n' | sort | awk '{ $1="."; print; }' \ > build/$ROCKCFG_ID/$toolsdir/lib/parse-config.$$ mv build/$ROCKCFG_ID/$toolsdir/lib/parse-config.$$ \ diff --git a/scripts/Cleanup b/scripts/Cleanup index f5db17d63..92fdd6fa9 100755 --- a/scripts/Cleanup +++ b/scripts/Cleanup @@ -115,15 +115,14 @@ done # Remove temp/backup files # -find Documentation/. architecture/. misc/. package/. scripts/. target/. \ - ! -path '*/\.svn/*' -type f \ - \( -name '*~' -o -name 'a.out' -o -name 'core.*' -o -name 'core' \) | \ - xargs rm -vf +bash scripts/xfind.sh Documentation/. architecture/. misc/. \ + package/. scripts/. target/. -type f \( -name '*~' -o \ + -name 'a.out' -o -name 'core.*' -o -name 'core' \) | xargs rm -vf # Print warnings for 'liggering' files # -find Documentation/. architecture/. misc/. package/. scripts/. target/. \ - ! -path '*/\.svn/*' ! -name '\.svn' -a \( \ +bash scripts/xfind.sh Documentation/. architecture/. misc/. \ + package/. scripts/. target/. \ \( \ \( -name 'DEADJOE' -o -name '*-[xX]' -o -name '.[^.]*' \ -o -name '*.orig' -o -name '*.rej' -o -name '*#*' \ @@ -138,6 +137,6 @@ find Documentation/. architecture/. misc/. package/. scripts/. target/. \ \) -o \( \ \( ! -type d ! -type f \) \ -printf 'WARNING: Dangerous file: %p\n' \ - \) \) + \) exit 0 diff --git a/scripts/Create-CopyPatch b/scripts/Create-CopyPatch index 651d9656e..4bc230a1c 100755 --- a/scripts/Create-CopyPatch +++ b/scripts/Create-CopyPatch @@ -32,8 +32,8 @@ echo -n > copy.patch [ $# = 0 ] && set Documentation/. architecture/. misc/. \ package/. scripts/. target/. -find $* -type f ! -name "*~" ! -path "*/.svn*" | sed 's,/\./,/,g' | \ -egrep -v '/CVS/|/Create-CopyPatch$|/sourceforge/' | \ +bash scripts/xfind.sh $* -type f ! -name "*~" \ + ! -name Create-CopyPatch | sed 's,/\./,/,g' | \ while read filename do grep -q -- '--- NO-ROCK-COPYRIGHT-NOTE ---' $filename && continue diff --git a/scripts/Create-ErrList b/scripts/Create-ErrList index 7c3d0751a..4ac6b5458 100755 --- a/scripts/Create-ErrList +++ b/scripts/Create-ErrList @@ -193,7 +193,7 @@ for stagelevel in $( echo $stages | tr -d '[]' | sed 's,.,& ,g' ) ; do [ -f "$pkgdir/$pkg" ] && this_is_error=0 fi if [ $onlyupdated != 0 -a $this_is_error != 0 ] ; then - [ "$( find package/*/$pkg download/*/$pkg -newer "$logdir/$stagelevel-$pkg.err" )" ] || this_is_error=0 + [ "$( bash scripts/xfind.sh package/*/$pkg download/*/$pkg -newer "$logdir/$stagelevel-$pkg.err" )" ] || this_is_error=0 fi else this_is_error=0 diff --git a/scripts/xfind.sh b/scripts/xfind.sh new file mode 100644 index 000000000..6b31c9e6e --- /dev/null +++ b/scripts/xfind.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# Subversion has really big ".svn" subdirs. This has much better performance +# than the "find ... ! -path '*/.svn*' ! -path '*/CVS*' ..." used earlier +# in various places. + +tmp1=`mktemp` tmp2=`mktemp` + +while [ "$#" -gt 0 ] +do + [ -z "${1##[-(]*}" ] && break + echo $1 >> $tmp1 + shift +done + +while ! cmp -s $tmp1 $tmp2 +do + cat $tmp1 > $tmp2 + find $( cat $tmp2 ) -maxdepth 1 -type d \ + ! -name 'CVS' ! -name '.svn' | sort -u > $tmp1 +done + +find $( cat $tmp2 ) -mindepth 1 -maxdepth 1 \ + ! -name 'CVS' ! -name '.svn' "$@" + +rm -f $tmp1 $tmp2 +