Browse Source

Clifford Wolf:

factored out common find code to optimize not to search .svn dirs


git-svn-id: http://www.rocklinux.org/svn/rock-linux/trunk@1040 c5f82cb5-29bc-0310-9cd0-bff59a50e3bc
rocklinux
Clifford Wolf 23 years ago
parent
commit
f776d19cd2
5 changed files with 41 additions and 31 deletions
  1. +5
    -21
      scripts/Build-Tools
  2. +6
    -7
      scripts/Cleanup
  3. +2
    -2
      scripts/Create-CopyPatch
  4. +1
    -1
      scripts/Create-ErrList
  5. +27
    -0
      scripts/xfind.sh

+ 5
- 21
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.$$ \

+ 6
- 7
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

+ 2
- 2
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

+ 1
- 1
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

+ 27
- 0
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

Loading…
Cancel
Save