]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
improved enable-mkbuild-section
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Sun, 3 May 2009 21:32:28 +0000 (21:32 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Sun, 3 May 2009 21:32:28 +0000 (21:32 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@807 04377dda-e619-0410-9926-eae83683ac58

trunk/utils/enable-mkbuild-section

index 0889f1abffdd21de68c2b47656c5e30409352ce3..17efd77313340093486aef7ad064b40f47017f42 100755 (executable)
 #
 
 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