diff options
author | Ori Bernstein <ori@eigenstate.org> | 2022-05-22 17:27:31 +0000 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2022-05-22 17:27:31 +0000 |
commit | a59e61a6a4e11e0256da0d209afa38ccacd460a2 (patch) | |
tree | 549dfadf95e33c523a8d097e000e687f496e2686 /rc/bin | |
parent | 23f8872bc10fbe9ffd2b0067db1f91d8eaaabb40 (diff) |
patch(1): remove bell labs patch scripts
bell labs is dead, and nobody is listening; 9front
has our own patch submission proces.
Diffstat (limited to 'rc/bin')
-rwxr-xr-x | rc/bin/patch/applied | 8 | ||||
-rwxr-xr-x | rc/bin/patch/apply | 79 | ||||
-rwxr-xr-x | rc/bin/patch/create | 85 | ||||
-rwxr-xr-x | rc/bin/patch/diff | 45 | ||||
-rwxr-xr-x | rc/bin/patch/list | 54 | ||||
-rwxr-xr-x | rc/bin/patch/move | 31 | ||||
-rwxr-xr-x | rc/bin/patch/note | 35 | ||||
-rwxr-xr-x | rc/bin/patch/notify | 9 | ||||
-rwxr-xr-x | rc/bin/patch/okay | 14 | ||||
-rwxr-xr-x | rc/bin/patch/remove | 19 | ||||
-rwxr-xr-x | rc/bin/patch/save | 8 | ||||
-rwxr-xr-x | rc/bin/patch/sorry | 8 | ||||
-rwxr-xr-x | rc/bin/patch/undo | 35 |
13 files changed, 0 insertions, 430 deletions
diff --git a/rc/bin/patch/applied b/rc/bin/patch/applied deleted file mode 100755 index e4bb2a5cf..000000000 --- a/rc/bin/patch/applied +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/rc - -if(~ $#* 0){ - echo 'usage: patch/applied patch-name...' >[1=2] - exit usage -} - -patch/move applied $* diff --git a/rc/bin/patch/apply b/rc/bin/patch/apply deleted file mode 100755 index 16b71c84a..000000000 --- a/rc/bin/patch/apply +++ /dev/null @@ -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] - diff --git a/rc/bin/patch/create b/rc/bin/patch/create deleted file mode 100755 index 55e659a00..000000000 --- a/rc/bin/patch/create +++ /dev/null @@ -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 diff --git a/rc/bin/patch/diff b/rc/bin/patch/diff deleted file mode 100755 index 944b5231b..000000000 --- a/rc/bin/patch/diff +++ /dev/null @@ -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 diff --git a/rc/bin/patch/list b/rc/bin/patch/list deleted file mode 100755 index 2e7328fd6..000000000 --- a/rc/bin/patch/list +++ /dev/null @@ -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 diff --git a/rc/bin/patch/move b/rc/bin/patch/move deleted file mode 100755 index 60dfb952c..000000000 --- a/rc/bin/patch/move +++ /dev/null @@ -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 -} diff --git a/rc/bin/patch/note b/rc/bin/patch/note deleted file mode 100755 index 858e2f63f..000000000 --- a/rc/bin/patch/note +++ /dev/null @@ -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 - diff --git a/rc/bin/patch/notify b/rc/bin/patch/notify deleted file mode 100755 index 14c07169c..000000000 --- a/rc/bin/patch/notify +++ /dev/null @@ -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} - } diff --git a/rc/bin/patch/okay b/rc/bin/patch/okay deleted file mode 100755 index df7813d50..000000000 --- a/rc/bin/patch/okay +++ /dev/null @@ -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 diff --git a/rc/bin/patch/remove b/rc/bin/patch/remove deleted file mode 100755 index 94a91f8f0..000000000 --- a/rc/bin/patch/remove +++ /dev/null @@ -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 -} diff --git a/rc/bin/patch/save b/rc/bin/patch/save deleted file mode 100755 index ffec9d8b9..000000000 --- a/rc/bin/patch/save +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/rc - -if(~ $#* 0){ - echo 'usage: patch/save patch-name...' >[1=2] - exit usage -} - -patch/move saved $* diff --git a/rc/bin/patch/sorry b/rc/bin/patch/sorry deleted file mode 100755 index 5f0930c22..000000000 --- a/rc/bin/patch/sorry +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/rc - -if(~ $#* 0){ - echo 'usage: patch/sorry patch-name...' >[1=2] - exit usage -} - -patch/move sorry $* diff --git a/rc/bin/patch/undo b/rc/bin/patch/undo deleted file mode 100755 index 701f17b1c..000000000 --- a/rc/bin/patch/undo +++ /dev/null @@ -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 - |