- fix a few instances of $patch when just patch was ment - fix and speed up patch/list - mail patch author when applied - use mountdist in apatch/undo Reference: /n/atom/patch/applied2013/apatch20130625 Date: Wed Jun 26 03:38:15 CES 2013 Signed-off-by: quanstro@quanstro.net --- /rc/bin/apatch/applied Thu Jan 1 00:00:00 1970 +++ /rc/bin/apatch/applied Wed Jun 26 03:36:42 2013 @@ -0,0 +1,14 @@ +#!/bin/rc + +if(~ $#* 0){ + echo 'usage: apatch/applied patch-name ...' >[1=2] + exit usage +} +. /rc/bin/apatch/defs +mountfs +mountdist -w +must mkdir -p /n/dist/dist/patch +{ + for(i) + echo $i +} >> /n/dist/dist/patch/applied --- /rc/bin/apatch/apply Wed Jun 26 03:36:43 2013 +++ /rc/bin/apatch/apply Wed Jun 26 03:36:43 2013 @@ -12,18 +12,18 @@ errs=/tmp/apply.$pid if($patch/·apply $* |[2] tee $errs){ - if(test -d $PD/$patch.*){ + if(test -d $PD/$*.*){ echo '#you could:' echo rm -rf $PD/$patch.* } $patch/applied $1 echo patch has been applied. emailing... @{cd $PD/applied/$1 && $patch/diffemail ; echo ------; cat $errs} | - mail -s 'applied patch: '^$PD/applied/$1 $M + mail -s 'applied patch: '^$PD/applied/$1 $M `{cat $PD/applied/email|grep -v '^-$'} rm -f $errs } -if(test -x /sys/lib/dist/update){ - echo '#run this to update the replica db.' - echo '# /sys/lib/dist/update' -} +# if(test -x /sys/lib/dist/update){ +# echo '#run this to update the replica db.' +# echo '# /sys/lib/dist/update' +# } --- /rc/bin/apatch/create Wed Jun 26 03:36:44 2013 +++ /rc/bin/apatch/create Wed Jun 26 03:36:45 2013 @@ -1,6 +1,6 @@ #!/bin/rc -rfork e +rfork e . /rc/bin/apatch/defs fn xchmod { @@ -169,11 +169,14 @@ if(! test -s $d/readme) fail no description given -# add the patch name to the applied list, so that it is not pull -# when it's $patch/Applied in the future. +# add the patch name to the applied list, so it is not pulled +# if apatch/applied in the future. must mkdir -p /dist/apatch echo $patch >> /dist/apatch/applied echo $d locally applied. + +# @{cd $PD/$1 && $patch/diffemails} | +# mail -s 'new patch: '^$PD/$1 $M fn sigexit sigint --- /rc/bin/apatch/defs Wed Jun 26 03:36:46 2013 +++ /rc/bin/apatch/defs Wed Jun 26 03:36:46 2013 @@ -1,6 +1,6 @@ P=atom S=atom -M=(sources@9atom.org) +M=(sources@9atom.org sources@labs.coraid.com) MS=sources@9atom.org PD=/n/$P/patch SD=/n/$S/plan9 --- /rc/bin/apatch/list Wed Jun 26 03:36:47 2013 +++ /rc/bin/apatch/list Wed Jun 26 03:36:48 2013 @@ -3,38 +3,47 @@ rfork e . /rc/bin/apatch/defs mountfs - cd $PD || fail no $PD -all=no -verb=no -while(! ~ $#* 0 && ~ $1 -*){ - if(~ $1 *a*) - all=yes - if(~ $1 *v*) - verb=yes - shift +args='dirs' +flagfmt='a,v' +if(! eval `'' {aux/getflags $*}){ + aux/usage + exit usage } dirs=$* if(~ $#dirs 0){ - dirs=(`{ - for(p in `{ls -tr | grep -v '\.[0-9]+$'}){ - if(test -d $p){ - if(~ $all yes || ! grep -s '^'^$p^'$' $SD^/dist/$patch/applied) - echo $p + q = `{ls -tr | grep -v '\.[0-9]+$'} + p = () + for(i in $q) + test -d $i && p = ($p $i) + if(~ $#flaga 1) + dirs = $p + if not{ + dirs=`{echo $p | awk ' + BEGIN{ + file="' ^ $SD/dist/patch/applied ^ '" + while(getline < file > 0) + tab[$0] = 1 + } + { + for(i = 0; i < NF; i++) + if(tab[$i] == 0) + print $i } + ' } - }) +whatis dirs + } } echo dirs >[1=2] - for(i in $dirs){ if($patch/okay $i){ dt=`{ls -ld $i | awk '{print $7, $8, $9}'} - if(~ $verb yes){ - if(grep -s '^'^$i^'$' $SD^/dist/$patch/applied) + if(~ $#flagv 1){ + if(grep -s '^'^$i^'$' $SD^/dist/patch/applied) echo applied: $i if not echo name: $i @@ -48,7 +57,7 @@ echo } if not{ - if(grep -s '^'^$i^'$' $SD^/dist/$patch/applied) + if(grep -s '^'^$i^'$' $SD^/dist/patch/applied) echo $dt applied $i: `{grep . <$i/readme | sed 1q} if not echo $dt $i: `{grep . <$i/readme | sed 1q} --- /rc/bin/apatch/undo Wed Jun 26 03:36:49 2013 +++ /rc/bin/apatch/undo Wed Jun 26 03:36:49 2013 @@ -5,9 +5,8 @@ exit usage } . /rc/bin/apatch/defs -mountfs - -test -e /n/dist/386 || bind / /n/dist || fail no dist +mountfs -a +mountdist -w d=/n/dist/dist/$patch/$1 must cd $d @@ -23,5 +22,5 @@ } } -cat files | sed 's/^/xxx /' |rc +applyxxx < files rm -rf /n/dist/dist/$patch/$1