tazwok rev 470
tazwok: rework sorting cookorder triggering to have it works well in all cases
author | Antoine Bodin <gokhlayeh@slitaz.org> |
---|---|
date | Sat Apr 02 14:10:11 2011 +0200 (2011-04-02) |
parents | 6db800ff11fd |
children | 2b0f1826a119 |
files | tazwok |
line diff
1.1 --- a/tazwok Sat Apr 02 13:32:33 2011 +0200 1.2 +++ b/tazwok Sat Apr 02 14:10:11 2011 +0200 1.3 @@ -1458,18 +1458,13 @@ 1.4 1.5 gen_wan_db() 1.6 { 1.7 + rm $wan_db 1.8 for RECEIPT in $(fgrep -l WANTED $WOK/*/receipt); do 1.9 WANTED= 1.10 source $RECEIPT 1.11 [ "$WANTED" ] || continue 1.12 echo -e $PACKAGE"\t"$WANTED >> $tmp/wan_db 1.13 done 1.14 - if ! [ -f $wan_db ] || [ "$(diff -q $tmp/wan_db $wan_db)" ]; then 1.15 - mv -f $tmp/wan_db $wan_db 1.16 - plan_regen_cookorder=yes 1.17 - else 1.18 - rm $tmp/wan_db 1.19 - fi 1.20 } 1.21 1.22 update_wan_db() 1.23 @@ -1479,30 +1474,21 @@ 1.24 grep $'\t'$PACKAGE $wan_db | cut -f 1 | while read wan; do 1.25 echo "$wanted_list" | fgrep -q /$wan/receipt && continue 1.26 sed "/^$wan\t/d" -i $wan_db 1.27 - plan_regen_cookorder=yes 1.28 done 1.29 for RECEIPT in $wanted_list; do 1.30 - WANTED= 1.31 + unset WANTED PACKAGE 1.32 source $RECEIPT 1.33 [ "$WANTED" ] || continue 1.34 - wan_info=$(echo -e $PACKAGE"\t"$WANTED) 1.35 - [ "$wan_info" = "$(grep -m1 ^$PACKAGE$'\t' $wan_db 2>/dev/null)" ] && continue 1.36 sed "/^$PACKAGE\t/d" -i $wan_db 1.37 - echo "$wan_info" >> $wan_db 1.38 - plan_regen_cookorder=yes 1.39 - plan_sort_wandb=yes 1.40 + echo -e $PACKAGE"\t"$WANTED >> $wan_db 1.41 done 1.42 unset wanted_list 1.43 } 1.44 1.45 update_dep_db() 1.46 { 1.47 - dep_info=$(echo -e $PACKAGE"\t "$DEPENDS" \t "$BUILD_DEPENDS' ') 1.48 - [ "$dep_info" = "$(grep -m1 ^$PACKAGE$'\t' $dep_db 2>/dev/null)" ] && return 1.49 sed "/^$PACKAGE\t/d" -i $dep_db 1.50 - echo "$dep_info" >> $dep_db 1.51 - plan_regen_cookorder=yes 1.52 - plan_sort_depdb=yes 1.53 + echo -e $PACKAGE"\t "$DEPENDS" \t "$BUILD_DEPENDS' ' >> $dep_db 1.54 } 1.55 1.56 sort_db() 1.57 @@ -1554,7 +1540,6 @@ 1.58 done 1.59 1.60 tac $tmp/cookorder >> $PACKAGES_REPOSITORY/cookorder.txt 1.61 - unset plan_regen_cookorder 1.62 report end-step 1.63 } 1.64 1.65 @@ -1705,6 +1690,9 @@ 1.66 local cooklist= look_for= with_dev= with_wanted= with_args= log_command="$0 $@" \ 1.67 get_options_list="look_for with_dev with_wanted with_args cooklist use_wanted" 1.68 get_options 1.69 + 1.70 + # Get db md5 to be able to check for changes latter. 1.71 + db_md5=$(md5sum $dep_db $wan_db) 1.72 1.73 # Cooklist is a special case where we need to modify a little 1.74 # scan behavior 1.75 @@ -1753,7 +1741,6 @@ 1.76 echo $PACKAGE >> $tmp/dep 1.77 fi 1.78 } 1.79 - check_db_status=yes 1.80 unset plan_check_for_missing 1.81 fi 1.82 fi 1.83 @@ -1794,14 +1781,11 @@ 1.84 cat $tmp/dep | sort -u 1.85 fi 1.86 rm -f $tmp/dep $tmp/list 1.87 - if [ "$check_db_status" ]; then 1.88 - [ "$plan_sort_depdb" ] && sort -o $dep_db $dep_db && unset plan_sort_depdb 1.89 - [ "$plan_sort_wandb" ] && sort -o $wan_db $wan_db && unset plan_sort_wandb 1.90 - if [ "$plan_regen_cookorder" ] && \ 1.91 - [ "$(sed 1!d $PACKAGES_REPOSITORY/cookorder.txt)" != "#PlanSort" ]; then 1.92 - grep -q "^#" $PACKAGES_REPOSITORY/cookorder.txt || \ 1.93 - sed 1i"#PlanSort" -i $PACKAGES_REPOSITORY/cookorder.txt 1.94 - fi 1.95 + if [ "$db_md5" != "$(md5sum $dep_db $wan_db)" ]; then 1.96 + sort -o $dep_db $dep_db 1.97 + sort -o $wan_db $wan_db 1.98 + grep -q "^#" $PACKAGES_REPOSITORY/cookorder.txt || 1.99 + sed 1i"#PlanSort" -i $PACKAGES_REPOSITORY/cookorder.txt 1.100 fi 1.101 } 1.102 1.103 @@ -1939,10 +1923,8 @@ 1.104 { 1.105 if [ "$(sed 1!d $PACKAGES_REPOSITORY/cookorder.txt)" = "#PlanSort" ]; then 1.106 sed 1d -i $PACKAGES_REPOSITORY/cookorder.txt 1.107 - plan_regen_cookorder=yes 1.108 + sort_db 1.109 fi 1.110 - [ "$plan_sort_depdb" ] && sort -o $dep_db $dep_db && unset plan_sort_depdb 1.111 - [ "$plan_regen_cookorder" ] && sort_db 1.112 report step "Generating cooklist" 1.113 if [ -f "$tmp/checked" ]; then 1.114 rm -f $tmp/cooklist 1.115 @@ -2687,12 +2669,13 @@ 1.116 get_tazwok_config 1.117 source_lib report 1.118 report start 1.119 + db_md5=$(md5sum $dep_db $wan_db) 1.120 update_wan_db 1.121 check_for_commit 1.122 - [ "$plan_sort_depdb" ] && sort -o $dep_db $dep_db && unset plan_sort_depdb 1.123 - [ "$plan_sort_wandb" ] && sort -o $wan_db $wan_db && unset plan_sort_wandb 1.124 - if [ "$plan_regen_cookorder" ]; then 1.125 - [ "$(sed 1!d $PACKAGES_REPOSITORY/cookorder.txt)" = "#PlanSort" ] || \ 1.126 + if [ "$db_md5" != "$(md5sum $dep_db $wan_db)" ]; then 1.127 + sort -o $dep_db $dep_db 1.128 + sort -o $wan_db $wan_db 1.129 + grep -q "^#" $PACKAGES_REPOSITORY/cookorder.txt || 1.130 sed 1i"#PlanSort" -i $PACKAGES_REPOSITORY/cookorder.txt 1.131 fi 1.132 cook