cookutils rev 957
cooker: add command 'outgoing'; modules/deps: add option '--incl'; modules/compressor: skip empty *.a
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Fri Aug 11 05:09:18 2017 +0300 (2017-08-11) |
parents | 7cdd0d3b59b7 |
children | 1c2beca44d34 |
files | cooker modules/compressor modules/deps |
line diff
1.1 --- a/cooker Sat Aug 05 04:41:24 2017 +0300 1.2 +++ b/cooker Fri Aug 11 05:09:18 2017 +0300 1.3 @@ -44,6 +44,7 @@ 1.4 -a | all Find and cook all unbuilt packages. 1.5 -T | tasks List existing cooker tasks. 1.6 -t | task <task> Executing specified task. 1.7 + -o | outgoing Find changes in wok that we can move to wok-hg. 1.8 1.9 EOT 1.10 exit 0 1.11 @@ -303,6 +304,59 @@ 1.12 } 1.13 1.14 1.15 +# Compare wok and wok-hg file $1, display signs: 1.16 +# '+' file added, '-' file removed, '~' file changed, '=' file not changed 1.17 + 1.18 +compare_wok_file() { 1.19 + local f1='n' f2='n' # n: not exists, e: exists 1.20 + [ -e "$wok/$1" ] && f1='e' 1.21 + [ -e "$wok-hg/$1" ] && f2='e' 1.22 + case "$f1$f2" in 1.23 + en) echo "+ $1";; 1.24 + ne) [ -n "$del" ] && echo "- $1";; 1.25 + ee) 1.26 + if cmp -s "$wok/$1" "$wok-hg/$1"; then 1.27 + [ -n "$eq" ] && echo "= $1" 1.28 + else 1.29 + echo "~ $1" 1.30 + fi 1.31 + ;; 1.32 + esac 1.33 +} 1.34 + 1.35 + 1.36 +# Compare wok and wok-hg folder $1; process only: 1.37 +# receipt, description.*txt, all files in the stuff folder 1.38 + 1.39 +compare_wok_folder() { 1.40 + IFS=$'\n' 1.41 + { 1.42 + for i in $wok $wok-hg; do 1.43 + ls $i/$1/receipt 2>/dev/null 1.44 + ls $i/$1/description.*txt 2>/dev/null 1.45 + [ -d $i/$1/stuff ] && find $i/$1/stuff -type f 1.46 + done 1.47 + } | sed "s|$wok/$1/||; s|$wok-hg/$1/||" | sort -u | \ 1.48 + while read file; do 1.49 + compare_wok_file "$1/$file" 1.50 + done 1.51 +} 1.52 + 1.53 + 1.54 +# Compare entire wok 1.55 + 1.56 +compare_wok() { 1.57 + { 1.58 + cd $wok; ls 1.59 + cd $wok-hg; ls 1.60 + } | sort -u | \ 1.61 + while read folder; do 1.62 + result="$(compare_wok_folder $folder)" 1.63 + [ -n "$result" ] && echo -e "$result\n" 1.64 + done 1.65 +} 1.66 + 1.67 + 1.68 # 1.69 # Commands 1.70 # 1.71 @@ -524,6 +578,11 @@ 1.72 . $tasks/$task; task 1.73 footer "Task $task finished" ;; 1.74 1.75 + outgoing|-o) 1.76 + # Find changes in wok that we can move to wok-hg 1.77 + compare_wok 1.78 + ;; 1.79 + 1.80 *) 1.81 # Default is to cook all commits if not yet running. 1.82 [ -n "$1" ] && usage
2.1 --- a/modules/compressor Sat Aug 05 04:41:24 2017 +0300 2.2 +++ b/modules/compressor Fri Aug 11 05:09:18 2017 +0300 2.3 @@ -565,8 +565,9 @@ 2.4 find $fs -name '*.a' -exec $STRIP -d '{}' 2>/dev/null \; 2.5 2.6 # Nullify timestamps of files in ar archives 2.7 + # Skip empty 8-byte archives (hi, musl-libc package) 2.8 whereami=$(pwd) 2.9 - find $fs -name '*.a' -type f | \ 2.10 + find $fs -name '*.a' -type f -size +8c | \ 2.11 while read i; do 2.12 tempdir=$(mktemp -d); cd $tempdir 2.13 ar -x $i; ar -crD $(basename $i) *
3.1 --- a/modules/deps Sat Aug 05 04:41:24 2017 +0300 3.2 +++ b/modules/deps Fri Aug 11 05:09:18 2017 +0300 3.3 @@ -113,7 +113,7 @@ 3.4 *ld-linux.so*);; 3.5 *linux-gate.so*);; 3.6 *) 3.7 - echo "$pkgs" | awk ' 3.8 + echo "$pkgs" | awk -vincl="$incl" ' 3.9 # if both packages exist in list, return the first one only 3.10 function s(pkg1, pkg2) { 3.11 if (index(" "$0" ", " "pkg1" ") && index(" "$0" ", " " pkg2 " ")) 3.12 @@ -151,7 +151,10 @@ 3.13 s("xorg-xcb-util-renderutil-dev", "xcb-util-renderutil-dev"); 3.14 s("eudev-dev", "udev-dev"); 3.15 3.16 - if (! index($0, "glibc-base") && 3.17 + # if called with "--incl": show all deps including glibc-base, 3.18 + # gcc-lib-base, glibc-dev and gcc; otherwise hide them 3.19 + if (incl == "yes" || 3.20 + ! index($0, "glibc-base") && 3.21 ! index($0, "gcc-lib-base") && 3.22 ! index($0, "glibc-dev") && 3.23 $0 != "gcc")