From 222d797e78fbbda8ab9815d58f941cddef425dcd Mon Sep 17 00:00:00 2001 From: rhatto Date: Sun, 3 May 2009 21:32:28 +0000 Subject: improved enable-mkbuild-section git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@807 04377dda-e619-0410-9926-eae83683ac58 --- trunk/utils/enable-mkbuild-section | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/trunk/utils/enable-mkbuild-section b/trunk/utils/enable-mkbuild-section index 0889f1a..17efd77 100755 --- a/trunk/utils/enable-mkbuild-section +++ b/trunk/utils/enable-mkbuild-section @@ -17,24 +17,28 @@ # CWD="`pwd`" -BASE="/path/to/mkbuilds" -MATCH="SLACK REQUIRED" # example parameter -ADD_BEFORE="on: build_package" # example section -INCLUDE=" on: slack-required" # example section +BASE="/data/projetos/code/mkbuilds" +MATCH=": manifest_check" # example parameter +ADD_BEFORE=": untar_source" # example section +INCLUDE=" on: manifest_check" # example section cd $BASE -FILES="`grep -R "$MATCH" * | grep -v .svn | grep -v '""' | cut -d : -f 1`" +FILES="` grep -l -R -L -e "$MATCH" * | grep -v .svn`" # match criteria +#FILES="`grep -R "$MATCH" * | grep -v .svn | grep -v '""' | cut -d : -f 1 | uniq`" # unmatch criteria for file in $FILES; do - LINES="`wc -l $file | awk '{ print $1 }'`" - CENTER="`sed = $file | sed 'N;s/\n/\t/' | grep "$ADD_BEFORE" | awk '{ print $1 }'`" - CENTER="`echo $(($CENTER -1))`" - END="`echo $(($LINES - $CENTER))`" - head -n $CENTER $file > $file.new - echo "$INCLUDE" >> $file.new - tail -n $END $file >> $file.new - cat $file.new > $file - rm $file.new + if [ "`basename $file .mkbuild`" != "`basename $file`" ]; then + echo processing $file + LINES="`wc -l $file | awk '{ print $1 }'`" + CENTER="`sed = $file | sed 'N;s/\n/\t/' | grep "$ADD_BEFORE" | awk '{ print $1 }'`" + CENTER="`echo $(($CENTER -1))`" + END="`echo $(($LINES - $CENTER))`" + head -n $CENTER $file > $file.new + echo "$INCLUDE" >> $file.new + tail -n $END $file >> $file.new + cat $file.new > $file + rm $file.new + fi done cd $CWD -- cgit v1.2.3