tazwok diff tazwok @ rev 215
Various bugfixes; Rework check-for-lib-update part; ensure cook command keep consistency of wok database; speed-up check-incoming
author | Antoine Bodin <gokhlayeh@slitaz.org> |
---|---|
date | Tue Feb 01 20:53:16 2011 +0100 (2011-02-01) |
parents | 80a7e1f31fee |
children | 21527e69d8c5 |
line diff
1.1 --- a/tazwok Mon Jan 31 05:23:59 2011 +0100 1.2 +++ b/tazwok Tue Feb 01 20:53:16 2011 +0100 1.3 @@ -104,6 +104,9 @@ 1.4 # Basically, get theses files from the net if they are missing. 1.5 dep_db=$INCOMING_REPOSITORY/wok-depends.txt 1.6 wan_db=$INCOMING_REPOSITORY/wok-wanted.txt 1.7 + [ -f $dep_db ] || touch $dep_db 1.8 + [ -f $wan_db ] || touch $wan_db 1.9 + [ -f $PACKAGES_REPOSITORY/cookorder.txt ] || touch $PACKAGES_REPOSITORY/cookorder.txt 1.10 1.11 # Check commons directories, create them if user is root. 1.12 if test $(id -u) = 0 ; then 1.13 @@ -199,9 +202,9 @@ 1.14 { 1.15 [ "$WANTED" ] && return 1.16 look_for_cookopt !remove_src && return 1.17 - if [ ! -d $WOK/$PACKAGE/install ] && [ "$_pkg" ] && [ -d "$_pkg" ]; then 1.18 + if [ ! -d $WOK/$PACKAGE/install ] && [ "$src" ] && [ -d "$src/_pkg" ]; then 1.19 check_for_var_modification _pkg src || return 1.20 - mv "$_pkg" $WOK/$PACKAGE/install 1.21 + mv "$src/_pkg" $WOK/$PACKAGE/install 1.22 fi 1.23 1.24 # Don't remove sources if a package use src variable in his 1.25 @@ -284,7 +287,7 @@ 1.26 unset MISSING_PACKAGE remove_later 1.27 rwanted=$(look_for_rwanted) 1.28 1.29 - for pkg in $(scan $BUILD_DEPENDS $DEPENDS --look_for=dep --with_dev --with_args | \ 1.30 + for pkg in $(scan $PACKAGE --look_for=bdep --with_dev | \ 1.31 fgrep -v $(for i in $(look_for_rwanted) $PACKAGE; do echo " -e $i"; done)) 1.32 do 1.33 1.34 @@ -610,8 +613,6 @@ 1.35 } 1.36 1.37 # Regenerate every package that wants a PACKAGE compiled 1.38 -# /!\ 1.39 - 1.40 refresh_packages_from_compile() 1.41 { 1.42 # make tazwok genpkg happy 1.43 @@ -623,13 +624,16 @@ 1.44 [ "${genlist/ $i }" = "$genlist" ] && continue 1.45 genlist=" $i${genlist/ $i / }" 1.46 done 1.47 - for i in $genlist; do 1.48 - tazwok genpkg $i --SLITAZ_VERSION=$SLITAZ_VERSION \ 1.49 - --undigest=$undigest --SLITAZ_DIR=$SLITAZ_DIR 1.50 - done 1.51 - 1.52 - # Still needs tazwok genpkg for this package 1.53 - rm -rf $WOK/$PACKAGE/taz 1.54 + if [ "$genlist" ]; then 1.55 + local PACKAGE SOURCE VERSION EXTRAVERSION CATEGORY SHORT_DESC \ 1.56 + MAINTAINER WEB_SITE WGET_URL DEPENDS BUILD_DEPENDS WANTED \ 1.57 + PACKED_SIZE UNPACKED_SIZE COOK_OPT PROVIDE CONFIG_FILES TAGS \ 1.58 + src _pkg DESTDIR CONFIG_SITE RECEIPT LOG 1.59 + for PACKAGE in $genlist; do 1.60 + set_common_path 1.61 + gen_package 1.62 + done 1.63 + fi 1.64 } 1.65 1.66 # Copy all generic files (locale, pixmaps, .desktop). We use standard paths, 1.67 @@ -862,34 +866,31 @@ 1.68 done > files.list 1.69 1.70 # Next, check if something has changed in lib files. 1.71 - if [ ! "$cook_rdep" ]; then 1.72 - report step "Look for changes in libraries" 1.73 - 1.74 - # Find the most recent previous files.list. 1.75 - # /!\ need some work to check only for minor update (not micro) 1.76 - if grep -q ^$PACKAGE$ $INCOMING_REPOSITORY/packages.txt 2>/dev/null; then 1.77 - files_list_dir=$PACKAGES_INCOMING 1.78 - elif grep -q ^$PACKAGE$ $PACKAGES_REPOSITORY/packages.txt 2>/dev/null; then 1.79 - files_list_dir=$PACKAGES_REPOSITORY 1.80 - elif [ "$undigest" ] && grep -q ^$PACKAGE$ $SLITAZ_DIR/$SLITAZ_VERSION/packages-incoming/packages.txt 2>/dev/null; then 1.81 - files_list_dir=$SLITAZ_DIR/$SLITAZ_VERSION/packages-incoming 1.82 - elif [ "$undigest" ] && grep -q ^$PACKAGE$ $SLITAZ_DIR/$SLITAZ_VERSION/packages/packages.txt 2>/dev/null; then 1.83 - files_list_dir=$SLITAZ_DIR/$SLITAZ_VERSION/packages 1.84 - fi 1.85 - 1.86 - # If founded, generate libs.list (new and previous) 1.87 - if [ "$files_list_dir" ] && [ -f $files_list_dir/files.list.lzma ]; then 1.88 - grep -e '\.so$' -e '\.so.[0-9]' files.list >> $tmp/libs.list.new 1.89 - if [ -f $tmp/libs.list.new ]; then 1.90 - lzma d $files_list_dir/files.list.lzma $tmp/files.list 2>/dev/null 1.91 - grep ^$PACKAGE: $tmp/files.list >> $tmp/libs.list.previous 1.92 - 1.93 - # If something as changed in libs path/names, plan recook of all 1.94 - # reverse build depends. 1.95 - [ "$(diff -q $tmp/libs.list.old $tmp/libs.list.previous 2>/dev/null)" ] && cook_rdep=yes 1.96 - rm $tmp/libs.list.new $tmp/files.list $tmp/libs.list.old 2>/dev/null 1.97 - unset files_list_dir 1.98 - fi 1.99 + if fgrep -q '.so' files.list; then 1.100 + report step "Look for major/minor update in libraries" 1.101 + for rep in $INCOMING_REPOSITORY $PACKAGES_REPOSITORY \ 1.102 + $([ "$undigest" ] && echo SLITAZ_DIR/$SLITAZ_VERSION/packages-incoming && \ 1.103 + echo $SLITAZ_DIR/$SLITAZ_VERSION/packages); do 1.104 + prev_VERSION=$(get_pkg_version $rep) 1.105 + [ "$prev_VERSION" ] && pkg_file=$rep/$PACKAGE-$prev_VERSION.tazpkg && break 1.106 + done 1.107 + if [ "$pkg_file" ]; then 1.108 + get_pkg_files $pkg_file 1.109 + cd $WOK/$PACKAGE/taz/$PACKAGE-$VERSION 1.110 + fgrep ".so" files.list | egrep -v "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*" | \ 1.111 + while read lib; do 1.112 + fgrep -q "$lib" $pkg_files_dir/files.list && continue 1.113 + echo "A minor/major update in libraries is detected, planning re-cook of reverse-depends of $PACKAGE." 1.114 + for rdep in $(scan $PACKAGE --look_for=rdep | use_wanted); do 1.115 + [ "$rdep" = "${WANTED:-$PACKAGE}" ] && continue 1.116 + grep -q ^$rdep$ $PACKAGES_REPOSITORY/blocked \ 1.117 + $PACKAGES_REPOSITORY/cooklist && continue 1.118 + echo $rdep >> $PACKAGES_REPOSITORY/cooklist 1.119 + done 1.120 + regen_cooklist=yes 1.121 + break 1.122 + done 1.123 + rm -r $pkg_files_dir 1.124 fi 1.125 report end-step 1.126 fi 1.127 @@ -955,10 +956,6 @@ 1.128 } 1.129 1.130 ######################################################################## 1.131 -######################## START OF NEW FUNCTIONS ######################## 1.132 -######################################################################## 1.133 - 1.134 -######################################################################## 1.135 # This section contains functions used by several other functions 1.136 # bellow. 1.137 ######################## 1.138 @@ -1030,12 +1027,12 @@ 1.139 erase_package_info 1.140 else 1.141 if [ "$pkg" -nt "packages.list" ]; then 1.142 - updated_pkg="$updated_pkg $pkg" 1.143 + updated_pkg="$updated_pkg 1.144 +$PACKAGE $pkg" 1.145 fi 1.146 fi 1.147 done 1.148 - 1.149 - for pkg in $updated_pkg; do 1.150 + echo "$updated_pkg" | sed 1d | while read PACKAGE pkg; do 1.151 erase_package_info 1.152 get_packages_info 1.153 done 1.154 @@ -1058,7 +1055,8 @@ 1.155 # 1.156 # Packages : unknow 1.157 # Date : $(date +%Y-%m-%d\ \%H:%M:%S) 1.158 -#" > packages.txt 1.159 +# 1.160 +" > packages.txt 1.161 else 1.162 sed -e 's/^# Packages :.*/# Packages : unknow/' \ 1.163 -e "s/# Date :.*/# Date : $(date +%Y-%m-%d\ \%H:%M:%S)/" \ 1.164 @@ -1094,14 +1092,18 @@ 1.165 echo "Getting datas from $PACKAGE" 1.166 1.167 cat >> $pkg_repository/packages.txt << _EOT_ 1.168 - 1.169 $PACKAGE 1.170 $VERSION$EXTRAVERSION 1.171 $SHORT_DESC 1.172 _EOT_ 1.173 - [ "$PACKED_SIZE" ] && cat >> $pkg_repository/packages.txt << _EOT_ 1.174 + if [ "$PACKED_SIZE" ]; then 1.175 + cat >> $pkg_repository/packages.txt << _EOT_ 1.176 $PACKED_SIZE ($UNPACKED_SIZE installed) 1.177 + 1.178 _EOT_ 1.179 + else 1.180 + echo "" >> $pkg_repository/packages.txt 1.181 + fi 1.182 1.183 # Packages.desc is used by Tazpkgbox <tree>. 1.184 echo "$PACKAGE | $VERSION$EXTRAVERSION | $SHORT_DESC | $CATEGORY | $WEB_SITE" >> $pkg_repository/packages.desc 1.185 @@ -1185,6 +1187,7 @@ 1.186 echo -e $PACKAGE"\t "$DEPENDS" \t "$BUILD_DEPENDS' ' >> $dep_db 1.187 fi 1.188 done 1.189 + sort_db 1.190 report close-bloc 1.191 } 1.192 1.193 @@ -1196,7 +1199,7 @@ 1.194 [ "$WANTED" ] || continue 1.195 echo -e $PACKAGE"\t"$WANTED >> $tmp/wan_db 1.196 done 1.197 - if [ "$(diff -q $tmp/wan_db $wan_db)" ]; then 1.198 + if ! [ -f $wan_db ] || [ "$(diff -q $tmp/wan_db $wan_db)" ]; then 1.199 mv -f $tmp/wan_db $wan_db 1.200 plan_regen_cookorder=yes 1.201 else 1.202 @@ -1204,10 +1207,27 @@ 1.203 fi 1.204 } 1.205 1.206 +update_wan_db() 1.207 +{ 1.208 + local PACKAGE 1.209 + for RECEIPT in $(fgrep WANTED $WOK/*/receipt | \ 1.210 + fgrep $PACKAGE | cut -f1 -d ':'); do 1.211 + WANTED= 1.212 + source $RECEIPT 1.213 + [ "$WANTED" ] || continue 1.214 + wan_info=$(echo -e $PACKAGE"\t"$WANTED >> $tmp/wan_db) 1.215 + [ "$wan_info" = "$(grep -m1 ^$PACKAGE$'\t' $wan_db 2>/dev/null)" ] && return 1.216 + sed "/^$PACKAGE\t/d" -i $wan_db 1.217 + echo "$dep_info" >> $wan_db 1.218 + plan_regen_cookorder=yes 1.219 + plan_sort_wandb=yes 1.220 + done 1.221 +} 1.222 + 1.223 update_dep_db() 1.224 { 1.225 dep_info=$(echo -e $PACKAGE"\t "$DEPENDS" \t "$BUILD_DEPENDS' ') 1.226 - [ "$dep_info" = "$(grep -m1 ^$PACKAGE$'\t' $dep_db)" ] && return 1.227 + [ "$dep_info" = "$(grep -m1 ^$PACKAGE$'\t' $dep_db 2>/dev/null)" ] && return 1.228 sed "/^$PACKAGE\t/d" -i $dep_db 1.229 echo "$dep_info" >> $dep_db 1.230 plan_regen_cookorder=yes 1.231 @@ -1357,6 +1377,30 @@ 1.232 echo $PACKAGE-dev 1.233 } 1.234 1.235 +with_dev() 1.236 +{ 1.237 + for PACKAGE in $(cat); do 1.238 + echo $PACKAGE 1.239 + look_for_dev 1.240 + done 1.241 +} 1.242 + 1.243 +with_wanted() 1.244 +{ 1.245 + for PACKAGE in $(cat); do 1.246 + echo $PACKAGE 1.247 + look_for_wanted 1.248 + done 1.249 +} 1.250 + 1.251 +use_wanted() 1.252 +{ 1.253 +for input in $(cat); do 1.254 + { grep ^$input$'\t' $wan_db || echo $input 1.255 + } | sed 's/.*\t//' 1.256 +done 1.257 +} 1.258 + 1.259 ######################################################################## 1.260 # SCAN 1.261 ######################## 1.262 @@ -1369,11 +1413,6 @@ 1.263 1.264 scan() 1.265 { 1.266 - # With some commands we don't want report (list output). 1.267 - if [ "$COMMAND" = gen-cooklist ] || [ "$COMMAND" = build-depends ]; then 1.268 - report(){ : ; } 1.269 - fi 1.270 - 1.271 # Get packages in argument. 1.272 local PACKAGE pkg_list= 1.273 for arg in $@; do 1.274 @@ -1384,7 +1423,7 @@ 1.275 # Get options. 1.276 [ "$pkg_list" ] || return 1.277 local cooklist= look_for= with_dev= with_wanted= with_args= log_command="$0 $@" \ 1.278 - get_options_list="look_for with_dev with_wanted with_args cooklist" 1.279 + get_options_list="look_for with_dev with_wanted with_args cooklist use_wanted" 1.280 get_options 1.281 1.282 # Cooklist is a special case where we need to modify a little 1.283 @@ -1403,38 +1442,9 @@ 1.284 echo $PACKAGE >> $tmp/dep 1.285 } 1.286 fi 1.287 - 1.288 + 1.289 [ "$with_dev" ] && filter=with_dev 1.290 [ "$with_wanted" ] && filter=with_wanted 1.291 - 1.292 - ############################################################## 1.293 - # ADD TO LISTS PROPOSAL ###################################### 1.294 - ############################################################## 1.295 - # 1.296 - with_dev() 1.297 - { 1.298 - for PACKAGE in $(cat); do 1.299 - echo $PACKAGE 1.300 - look_for_dev 1.301 - done 1.302 - } 1.303 - 1.304 - with_wanted() 1.305 - { 1.306 - for PACKAGE in $(cat); do 1.307 - echo $PACKAGE 1.308 - look_for_wanted 1.309 - done 1.310 - } 1.311 - 1.312 - use_wanted() 1.313 - { 1.314 - for PACKAGE in $(cat); do 1.315 - { grep ^$PACKAGE$'\t' $wan_db || echo $PACKAGE 1.316 - } | sed 's/.*\t//' 1.317 - done 1.318 - } 1.319 - 1.320 if [ "$filter" ]; then 1.321 pkg_list=$(echo $pkg_list | $filter) 1.322 scan_pkg() 1.323 @@ -1447,7 +1457,7 @@ 1.324 look_for_$look_for 1.325 } 1.326 fi 1.327 - 1.328 + touch $tmp/dep 1.329 for PACKAGE in $pkg_list; do 1.330 [ "$with_args" ] && append_to_dep 1.331 scan_pkg 1.332 @@ -1465,7 +1475,7 @@ 1.333 done 1.334 if [ "$cooklist" ]; then 1.335 mv $tmp/dep $tmp/cooklist 1.336 - else 1.337 + else 1.338 cat $tmp/dep | sort -u 1.339 fi 1.340 rm -f $tmp/dep $tmp/list 1.341 @@ -1560,6 +1570,10 @@ 1.342 report end-step 1.343 1.344 [ -s $tmp/checked ] || [ -s $tmp/cooklist ] || return 1.345 + if [ "$(sed 1!d $PACKAGES_REPOSITORY/cookorder.txt)" = "#PlanSort" ]; then 1.346 + sed 1d -i $PACKAGES_REPOSITORY/cookorder.txt 1.347 + plan_regen_cookorder=yes 1.348 + fi 1.349 1.350 # Core toolchain should not be cooked unless cook-toolchain is used. 1.351 if ! [ -f /etc/config.site.tmptoolchain ] ; then 1.352 @@ -1587,6 +1601,7 @@ 1.353 1.354 sort_cooklist() 1.355 { 1.356 + report step "Sorting cooklist" 1.357 if [ -f "$tmp/checked" ]; then 1.358 rm -f $tmp/cooklist 1.359 cat $tmp/checked | while read PACKAGE; do 1.360 @@ -1598,13 +1613,11 @@ 1.361 sed "/^$PACKAGE/d" -i $tmp/cooklist 1.362 done 1.363 fi 1.364 - 1.365 - [ -s $tmp/cooklist ] || return 1.366 - report step "Sorting cooklist" 1.367 + 1.368 for PACKAGE in $(cat $tmp/cooklist); do 1.369 WANTED="$(look_for_wanted)" 1.370 [ "$WANTED" ] || continue 1.371 - if grep -q ^$WANTED$ $PACKAGES_REPOSITORY/broken $tmp/cooklist.tmp; then 1.372 + if grep -q ^$WANTED$ $PACKAGES_REPOSITORY/broken $tmp/cooklist; then 1.373 sed "/^$PACKAGE$/d" -i $tmp/cooklist 1.374 elif [ ! -d $WOK/$WANTED/install ]; then 1.375 sed "/^$PACKAGE$/d" -i $tmp/cooklist 1.376 @@ -1651,11 +1664,8 @@ 1.377 $(cat $PACKAGES_REPOSITORY/cooklist)" >&2 1.378 return 1.379 fi 1.380 + pkg="$(cut -f 1 -d '|' $INCOMING_REPOSITORY/packages.desc)" 1.381 if ! [ "$forced" ]; then 1.382 - rm -f $WOK/*/md5 1.383 - pkg="$({ grep ^[a-zA-Z0-9] $PACKAGES_REPOSITORY/packages.txt 1.384 - grep ^[a-zA-Z0-9] $INCOMING_REPOSITORY/packages.txt 1.385 - } | sort -u)" 1.386 cooklist=$PACKAGES_REPOSITORY/cooklist 1.387 gen_cook_list 1.388 if [ -s $PACKAGES_REPOSITORY/cooklist ]; then 1.389 @@ -1665,7 +1675,7 @@ 1.390 fi 1.391 report step "Moving incoming packages to main repository" 1.392 unset EXTRAVERSION 1.393 - for PACKAGE in $(cut -f 1 -d '|' $INCOMING_REPOSITORY/packages.desc); do 1.394 + for PACKAGE in $pkg; do 1.395 prev_VERSION=$(get_pkg_version $PACKAGES_REPOSITORY) 1.396 VERSION=$(get_pkg_version $INCOMING_REPOSITORY) 1.397 remove_previous_package $PACKAGES_REPOSITORY 1.398 @@ -1753,24 +1763,9 @@ 1.399 [ -s $tmp/cooklist ] && sed "/^$PACKAGE$/d" -i $tmp/cooklist 1.400 1.401 if compile_package; then 1.402 + remove_src 1.403 refresh_packages_from_compile 1.404 gen_package 1.405 - remove_src 1.406 - 1.407 - # Plan recook of reverse build depends if gen_package has detect 1.408 - # a change in libraries. 1.409 - if [ "$cook_rdep" ]; then 1.410 - report step "Look for packages which need a refresh" 1.411 - for rdep in $(scan $PACKAGE --look_for=rdep); do 1.412 - sed "/^$rdep$/d" -i $PACKAGES_REPOSITORY/broken 1.413 - if [ -f $WOK/$rdep/receipt ] && ! grep -q ^$rdep$ $tmp/cooklist; then 1.414 - echo "Add $rdep in cooklist to avoid broke caused by library update in $PACKAGE" 1.415 - echo $rdep >> $tmp/cooklist 1.416 - regen_cooklist=yes 1.417 - fi 1.418 - done 1.419 - report end-step 1.420 - fi 1.421 1.422 # Update packages-incoming repository. 1.423 store_pkgname=$PACKAGE 1.424 @@ -1956,6 +1951,7 @@ 1.425 build-depends) 1.426 # List dependencies to rebuild wok, or only a package 1.427 get_tazwok_config 1.428 + report(){ : ; } 1.429 if [ "$PACKAGE" = toolchain-cooklist ]; then 1.430 scan "$SLITAZ_TOOLCHAIN $SLITAZ_TOOLCHAIN_EXTRA" \ 1.431 --cooklist 1.432 @@ -1968,9 +1964,10 @@ 1.433 fi 1.434 ;; 1.435 gen-cooklist) 1.436 + check_root 1.437 get_options_list="pkg" 1.438 get_tazwok_config 1.439 - check_root 1.440 + report(){ : ; } 1.441 if ! [ "$pkg" ]; then 1.442 cooklist=${LIST:-$PACKAGES_REPOSITORY/cooklist} 1.443 fi 1.444 @@ -2279,6 +2276,14 @@ 1.445 get_tazwok_config 1.446 source_lib report 1.447 report start 1.448 + update_wan_db 1.449 + check_for_commit 1.450 + [ "$plan_sort_depdb" ] && sort -o $dep_db $dep_db && unset plan_sort_depdb 1.451 + [ "$plan_sort_wandb" ] && sort -o $wan_db $wan_db && unset plan_sort_wandb 1.452 + if [ "$plan_regen_cookorder" ]; then 1.453 + grep -q "^#" $PACKAGES_REPOSITORY/cookorder.txt || \ 1.454 + sed 1i"#PlanSort" -i $PACKAGES_REPOSITORY/cookorder.txt 1.455 + fi 1.456 cook 1.457 ;; 1.458 sort-cooklist)