a note system for apatches. users with a 9atom login can now easily comment publicly on patches that have not been applied. the comment will be signed with your 9atom user name. Reference: /n/atom/patch/applied/apatchnote Date: Mon Feb 24 16:24:44 CET 2014 Signed-off-by: quanstro@quanstro.net --- /rc/bin/apatch/note Thu Jan 1 00:00:00 1970 +++ /rc/bin/apatch/note Mon Feb 24 16:23:06 2014 @@ -0,0 +1,25 @@ +#!/bin/rc + +rfork e +. /rc/bin/apatch/defs +mountfs -a +mountdist -w # writable + +test -e /n/dist/lib/patch.skip && bind /dev/null /n/dist/lib/patch.skip +test -e /n/dist/lib/patch.skipfile && bind /dev/null /n/dist/lib/patch.skipfile + +errs=/tmp/apply.$pid +if($patch/·note $* |[2] tee $errs){ + echo noted. emailing... + u=`{cat $PD/$1/email|grep -v '^-$'} + + cu=`{ls -m $PD/$1/notes | sed 's/\[(.*)\].*/\1/g'} + + # gross + if(~ $u quanstro@quanstro.net) + u=() + + @{builtin cd $PD/$1 && $patch/diffemail && echo ------ && cat $errs} | + mail -s 'new note from $cu^: '^$PD/applied/$1 $M $u + rm -f $errs +} --- /rc/bin/apatch/·note Thu Jan 1 00:00:00 1970 +++ /rc/bin/apatch/·note Mon Feb 24 16:23:06 2014 @@ -0,0 +1,49 @@ +#!/bin/rc + +rfork e +. /rc/bin/apatch/defs + +args='patch-name' +flagfmt='' +if(! eval `'' {aux/getflags $*} || ! ~ $#* 1){ + aux/usage + exit usage +} +mountfs -a +mountdist -w # writable + +d=$PD/$1 +if(! $patch/okay $d){ + echo 'bad patch: '$status >[1=2] + exit badpatch +} + +if(test -e /n/dist/lib/patch.skip && grep -s '^'^$1^'$' /n/dist/lib/patch.skip){ + echo patch $1 is a skip. done. >[1=2] + exit '' +} + +oldnotes=() +fn putback sigint { + rm $d/notes + if(! ~ $#oldnotes 0){ + cp -x $oldnotes $d/notes + # chmod +a $d/notes + } +} + +echo /dist/patch/$1 + +if(test -s $d/notes){ + oldnotes = /tmp/oldnotes + must cp -x $d/notes $oldnotes +} +$patch/readfile >> $d/notes +cu=`{ls -m $d/notes | sed 's/\[(.*)\].*/\1/g'} +{ + echo - $cu + echo +} >> $d/notes + +fn putback sigint +