patch(1): remove bell labs patch scripts

bell labs is dead, and nobody is listening; 9front
has our own patch submission proces.
This commit is contained in:
Ori Bernstein 2022-05-22 17:27:31 +00:00
parent 23f8872bc1
commit a59e61a6a4
14 changed files with 0 additions and 588 deletions

View file

@ -1,8 +0,0 @@
#!/bin/rc
if(~ $#* 0){
echo 'usage: patch/applied patch-name...' >[1=2]
exit usage
}
patch/move applied $*

View file

@ -1,79 +0,0 @@
#!/bin/rc
rfork e
if(! ~ $#* 1){
echo 'usage: patch/apply patch-name' >[1=2]
exit usage
}
if(! test -d /n/sources/patch){
rfork n
9fs sources
}
if(! test -d /n/sources/patch/$1){
echo 'no such patch' /n/sources/patch/$1 >[1=2]
exit nopatch
}
builtin cd /n/sources/patch/$1 || exit nopatch
if(! patch/okay .){
echo 'bad patch: '$status >[1=2]
exit badpatch
}
if(! echo >.tmp || ! rm .tmp){
echo no write permission >[1=2]
exit 'no write permission'
}
echo -n merge... >[1=2]
fn xxx {
if(! test -f $1)
cp $2 $2.new
if not
ape/diff3 -m $1 $2.orig $2 >$2.new
if(grep -s '^<<<<' $2.new){
echo conflicts merging $1';' see `{pwd}^/$2.new >[1=2]
touch failed
}
}
rm -f failed
cat files | sed 's/^/xxx /' | rc
if(test -f failed){
echo exiting without changes >[1=2]
exit failed
}
echo -n backup... >[1=2]
fn xxx {
# echo cp $1 $2.backup
cp $1 $2.backup
}
cat files | sed 's/^/xxx /' |rc
echo -n copy... >[1=2]
fn xxx {
# echo cp $2.new $1
cp $2.new $1 || touch failed
}
cat files | sed 's/^/xxx /' | rc
fn xxx {
# echo cp $2.backup $1
cp $2.backup $1
}
if(test -f failed){
echo copying failed, restoring backups >[1=2]
cat files | sed 's/^/xxx /' | rc
exit failed
}
echo >[1=2]
echo to update sources: >[1=2]
cat files | awk '{print " update " $1 }' >[1=2]

View file

@ -1,85 +0,0 @@
#!/bin/rc
rfork e
fn xchmod {
chmod $* >[2]/dev/null
}
if(~ $#* 0 1 2){
echo 'usage: patch/create name email file... [< description]' >[1=2]
exit usage
}
if(! echo $1 | grep -s '^[a-z_0-9.\-]+$'){
echo 'bad name: [a-z0-9._\-]+ only' >[1=2]
exit usage
}
if(! echo $2 | grep -s '^(-|[A-Za-z0-9.\-+]+@[A-Za-z0-9.\-+]+)$'){
echo 'bad email: [a-z0-9.-+] only; use ''-'' to not leave an email address.' >[1=2]
exit usage
}
if(! test -d /n/sources/patch){
rfork n
9fs sources
}
patch=$1
email=$2
shift
shift
d=/n/sources/patch/$patch
if(! mkdir $d){
echo mkdir $d failed >[1=2]
exit mkdir
}
if(! ~ $email -){
echo $email >$d/email
}
xchmod o-w $d
>$d/readme
>$d/files
>$d/notes
for(i in $*){
i=`{cleanname -d `{pwd} $i}
if(! test -f $i){
echo error: cannot find $i >[1=2]
rm -rf $d
exit oops
}
short=`{basename $i}
uniq=$short
n=0
while(test -f $d/$uniq){
uniq=$short.$n
n=`{echo 1+$n | hoc}
}
cp $i $d/$uniq
if(test -f /n/sources/plan9/$i){
if(cmp -s /n/sources/plan9/$i $i)
echo warning: new file $i does not differ from sources >[1=2]
cp /n/sources/plan9/$i $d/$uniq.orig
}
if not
echo warning: new file $i not on sources >[1=2]
echo $i $uniq >>$d/files
}
@{builtin cd $d && xchmod ug+rw * && xchmod a+r *}
if(~ `{cat /proc/$pid/fd | awk 'NR==2{print $NF}'} */dev/cons && test -w /dev/consctl){
>/dev/consctl {
echo holdon
cat >$d/readme
}
}
if not
cat >$d/readme
if(! test -s $d/readme){
echo 'no description given; aborting' >[1=2]
rm -rf $d
exit oops
}
echo $d

View file

@ -1,45 +0,0 @@
#!/bin/rc
# patch/diff [-w] patch-name
rfork e
fn usage {
echo 'usage: patch/diff [-bmnwz] patch-name' >[1=2]
exit usage
}
dopts=(-c)
while (! ~ $#* 0 && ~ $1 -*) {
switch ($1) {
case -[bmnw]
dopts=($dopts $1)
case -z
dopts=()
case *
usage
}
shift
}
if(! ~ $#* 1)
usage
if(! test -d /n/sources/patch){
rfork n
9fs sources
}
if(! test -d /n/sources/patch/$1){
echo 'no such patch' /n/sources/patch/$1 >[1=2]
exit nopatch
}
builtin cd /n/sources/patch/$1 || exit nopatch
if(! patch/okay .){
echo 'bad patch: '$status >[1=2]
exit badpatch
}
d=/n/sources/patch/$1
fn xxx {
echo $1
diff $dopts $2.orig $d/$2 | sed 's/^/ /'
}
cat files | sed 's/^/xxx /' | rc

View file

@ -1,54 +0,0 @@
#!/bin/rc
rfork e
if(! test -d /n/sources/patch){
rfork n
9fs sources
}
pref=''
builtin cd /n/sources/patch || {
echo 'can''t cd /n/sources/patch' >[1=2]
exit no-sources
}
if(~ $1 applied saved sorry maybe){
pref=$1^'/'
shift
}
if(~ $#* 0)
*=(`{
if(~ $pref *?*)
builtin cd $pref
ls -t | grep -v '^(applied|saved|sorry|maybe)$'
})
trunc=(sed 5q)
if(~ $#* 1)
trunc=cat
{
for(i in $*){
i=$pref^$i
if(test -f $i/origls)
cat $i/origls | awk '{$NF="'$i'"; print}'
if not
ls -ld $i
if(patch/okay $i){
if(test -r $i/email)
echo from `{cat $i/email}
cat $i/files | awk '{print " " $1}'
cat $i/readme | sed 's/^/ /' | $trunc
if(test -f $i/notes){
echo
cat $i/notes
}
}
if not
echo ' 'bad patch: $status >[1=2]
echo
}
} >/tmp/patchtmp.$pid
cat /tmp/patchtmp.$pid
rm -f /tmp/patchtmp.$pid

View file

@ -1,31 +0,0 @@
#!/bin/rc
# patch/move target patch-tree... - move patch tree(s) to target dir
rfork e
pats=/n/sources/patch
if(~ $#* 0 1){
echo 'usage: patch/move dst patch-name...' >[1=2]
exit usage
}
if(! test -d $pats){
rfork n
9fs sources
}
cd $pats
dst=$1
shift
for(src){
patbase = `{basename $src}
patdest = $dst/$patbase
if (~ $dst $src $patbase)
echo $0: skipping $src >[1=2]
if not if(! test -d $src)
echo $0: no such patch $pats/$src >[1=2]
if not if(test -d $patdest)
echo $0: already have $pats/$patdest >[1=2]
if not
ls -ldp $src >$src/origls &&
mkdir $patdest && dircp $src $patdest && rm -rf $src &&
test -s $patdest/email && patch/notify $patdest
}

View file

@ -1,35 +0,0 @@
#!/bin/rc
rfork e
if(! ~ $#* 1){
echo 'usage: patch/note patch-name' >[1=2]
exit usage
}
if(! test -d /n/sources/patch){
rfork n
9fs sources
}
if(! test -d /n/sources/patch/$1){
echo 'no such patch' /n/sources/patch/$1 >[1=2]
exit nopatch
}
builtin cd /n/sources/patch/$1 || exit nopatch
if(! patch/okay .){
echo 'bad patch: '$status >[1=2]
exit badpatch
}
if(~ `{cat /proc/$pid/fd | awk 'NR==2{print $NF}'} */dev/cons && ~ `{ls -l /dev/consctl | awk '{print $1}'} *w*){
>/dev/consctl {
echo holdon
{echo `{date} `{cat /dev/user}
cat |sed 's/^/ /'; echo } >>notes
}
}
if not
{echo `{date} `{cat /dev/user}
cat |sed 's/^/ /'; echo } >>notes

View file

@ -1,9 +0,0 @@
#!/bin/rc
# patch/notify
rfork e
for(i)
# don't flood sys when merely shuffling patches around
if (~ $i applied/* saved/* sorry/*) {
patch/list $i | mail -s 'patch/list '^$i sys \
`{cat /n/sources/patch/$i/email}
}

View file

@ -1,14 +0,0 @@
#!/bin/rc
rfork e
if(! ~ $#* 1){
echo usage: patch/okay dir >[1=2]
exit usage
}
i=$1
if(! test -s $i/files || ! test -s $i/readme)
exit 'missing files'
if(grep -v '^/[_a-zA-Z0-9.\-+/:]+ [_a-zA-Z0-9.\-+:]+$' $i/files)
exit 'bad file list'
exit 0

View file

@ -1,19 +0,0 @@
#!/bin/rc
rfork e
if(~ $#* 0){
echo 'usage: patch/remove patch-name...' >[1=2]
exit usage
}
if(! test -d /n/sources/patch){
rfork n
9fs sources
}
for(i){
if(! test -d /n/sources/patch/$i)
echo 'no such patch' /n/sources/patch/$i >[1=2]
if not
rm -rf /n/sources/patch/$i
}

View file

@ -1,8 +0,0 @@
#!/bin/rc
if(~ $#* 0){
echo 'usage: patch/save patch-name...' >[1=2]
exit usage
}
patch/move saved $*

View file

@ -1,8 +0,0 @@
#!/bin/rc
if(~ $#* 0){
echo 'usage: patch/sorry patch-name...' >[1=2]
exit usage
}
patch/move sorry $*

View file

@ -1,35 +0,0 @@
#!/bin/rc
rfork e
if(! ~ $#* 1){
echo 'usage: patch/undo patch-name' >[1=2]
exit usage
}
if(! test -d /n/sources/patch){
rfork n
9fs sources
}
if(! test -d /n/sources/patch/$1){
echo 'no such patch' /n/sources/patch/$1 >[1=2]
exit nopatch
}
d=$1
builtin cd /n/sources/patch/$1 || exit nopatch
if(! patch/okay .){
echo 'bad patch: '$status >[1=2]
exit badpatch
}
fn xxx {
if(cmp $2.new $1){
echo cp /n/sources/patch/$d/$2.backup $1
cp $2.backup $1
}
if not
echo $1 has changed since patch was applied! >[1=2]
}
cat files | sed 's/^/xxx /' |rc