cookutils rev 35
cooker: improve commits checking and have a summary
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Fri May 06 21:14:20 2011 +0200 (2011-05-06) |
parents | abfe01fcd176 |
children | c042c0f4c34d |
files | cooker |
line diff
1.1 --- a/cooker Fri May 06 19:12:33 2011 +0200 1.2 +++ b/cooker Fri May 06 21:14:20 2011 +0200 1.3 @@ -65,7 +65,7 @@ 1.4 # Some message goes in activity but log verbose output when checking for commits 1.5 # into a log file. 1.6 log_commits() { 1.7 - tee -a $LOGS/commits.log 1.8 + sed '/^.\//'d | sed '/^.hg/'d | tee -a $LOGS/commits.log 1.9 } 1.10 1.11 # Log broken packages 1.12 @@ -78,6 +78,19 @@ 1.13 rm -f $command && touch $command 1.14 } 1.15 1.16 +# Summary for commits. 1.17 +commits_summary() { 1.18 + msg="from revision $cur to $new" 1.19 + [ "$new" == "$cur" ] && msg="revision $new" 1.20 + echo "Will cook $msg" 1.21 + separator 1.22 + echo -e "\nSummary for commits" 1.23 + separator 1.24 + echo "Hg wok revision : $cur" 1.25 + echo "Pulled revision : $new" 1.26 + echo "Check date : $(date '+%Y-%m-%d %H:%M')" 1.27 +} 1.28 + 1.29 # Scan packages build deps an fill up cookorder list. 1.30 cook_order_scan() { 1.31 touch $cooklist $cookorder 1.32 @@ -159,14 +172,14 @@ 1.33 separator 1.34 time=$(($(date +%s) - $time)) 1.35 pkgs=$(cat $cooklist | wc -l) 1.36 - echo -e "\nSummary" 1.37 + echo -e "\nSummary for cookorder" 1.38 separator 1.39 cat << EOT 1.40 Ordered packages : $pkgs 1.41 Scans executed : $scan 1.42 Scan duration : ${time}s 1.43 EOT 1.44 - separator && echo "" 1.45 + separator 1.46 } 1.47 1.48 # Remove blocked (faster this way than grepping before). 1.49 @@ -339,35 +352,31 @@ 1.50 echo "hg:pull" > $command 1.51 cd ${wok}-hg && hg pull -u | log_commits 1.52 new=$(hg head --template '{rev}\n') 1.53 - echo "Hg wok revision : $cur" | log_commits 1.54 - echo "Pulled revision : $new" | log_commits 1.55 - echo "Check date : $(date '+%Y-%m-%d %H:%M')" | log_commits 1.56 1.57 # Sync build wok with rsync so we dont take care about removing old 1.58 # files as before. 1.59 if [ "$new" -gt "$cur" ]; then 1.60 echo "Changes found from: $cur to $new" | log 1.61 - echo "Syncing build wok with Hg wok..." 1.62 - #cp -a ${wok}-hg/* $wok 1.63 - #cp -a ${wok}-hg/.hg $wok 1.64 - rsync -r -t -c -l -u -D -E --delete ${wok}-hg/ $wok/ | log_commits 1.65 + echo "Syncing build wok with Hg wok..." | log_commits 1.66 + rsync -r -t -c -l -u -v -D -E --delete ${wok}-hg/ $wok/ | \ 1.67 + sed '/^$/'d | log_commits 1.68 else 1.69 echo "No revision changes: $cur vs $new" | log 1.70 separator | log_commits 1.71 empty_command && echo "" && exit 0 1.72 fi 1.73 1.74 - # Get modifications 1.75 + # Get and display modifications. 1.76 cd ${wok}-hg 1.77 cur=$(($cur + 1)) 1.78 - msg="from revision $cur to $new" 1.79 - [ "$new" == "$cur" ] && msg="revision: $new" 1.80 - echo -e "Will cook $msg\n" 1.81 + commits_summary | log_commits 1.82 + 1.83 rm -f $commits.tmp && touch $commits.tmp 1.84 for rev in $(seq $cur $new); do 1.85 - pkg=$(hg log --rev=$rev --template "{files}\n" | cut -d "/" -f 1) 1.86 + #log=$(hg log --rev=$rev --template "{files}\t{desc}\n") 1.87 + log=$(hg log --rev=$rev --template "{files}\n" | cut -d "/" -f 1) 1.88 for file in $log; do 1.89 - echo "Commited file: $file" log_commits 1.90 + echo "Commited pkg : $file" | log_commits 1.91 echo $file >> $commits.tmp 1.92 done 1.93 done 1.94 @@ -375,8 +384,9 @@ 1.95 # Keep previews commit and discard duplicate lines 1.96 cat $commits $commits.tmp | sed /"^$"/d > $commits.new 1.97 uniq $commits.new > $commits && rm $commits.* 1.98 - echo "Packages to cook: $(cat $commits | wc -l)" | log 1.99 - separator && echo "" | log_commits 1.100 + echo "Packages to cook : $(cat $commits | wc -l)" | log_commits 1.101 + separator | log_commits 1.102 + echo "" 1.103 strip_blocked 1.104 cook_order | tee $LOGS/cookorder.log 1.105 cook_commits && empty_command ;;