- allow for empty files (e.g. only deletions) - multi word exit status is not allowed (okay) Reference: /n/atom/patch/applied2013/apatchdel Date: Sun Jun 23 17:24:18 CES 2013 Signed-off-by: quanstro@quanstro.net --- /rc/bin/apatch/·apply Sun Jun 23 17:23:40 2013 +++ /rc/bin/apatch/·apply Sun Jun 23 17:23:40 2013 @@ -91,7 +91,7 @@ grep -v -f /lib/patch.skipfile files if not cat files -} | sed 's/^/xxx /' | rc +} | sed 's/^../xxx &/' | rc if(! ~ $#applyfailed 0){ echo exiting without changes >[1=2] @@ -106,10 +106,10 @@ } if(test -e /lib/patch.skipfile){ - grep -v -f /lib/patch.skipfile files | sed 's/^/xxx /' | rc + grep -v -f /lib/patch.skipfile files | sed 's/^../xxx &/' | rc } if not { - cat files | sed 's/^/xxx /' | rc + cat files | sed 's/^../xxx &/' | rc } if(~ 0 never){ echo exiting without changes cannot backup: `{cat failed}>[1=2] @@ -131,10 +131,10 @@ #BUG: update /n/dist/$1 permissions by looking at those of $2.orig } if(test -e /lib/patch.skipfile){ - grep -v -f /lib/patch.skipfile files | sed 's/^/xxx /' | rc + grep -v -f /lib/patch.skipfile files | sed 's/^../xxx &/' | rc } if not { - cat files | sed 's/^/xxx /' | rc + cat files | sed 's/^../xxx &/' | rc } fn xxx { @@ -147,10 +147,10 @@ if(~ 0 never){ echo copying failed, restoring backups >[1=2] if(test -e /lib/patch.skipfile){ - grep -v -f /lib/patch.skipfile files | sed 's/^/xxx /' | rc + grep -v -f /lib/patch.skipfile files | sed 's/^../xxx &/' | rc } if not { - cat files | sed 's/^/xxx /' | rc + cat files | sed 's/^../xxx &/' | rc } exit failed } --- /rc/bin/apatch/okay Sun Jun 23 17:23:40 2013 +++ /rc/bin/apatch/okay Sun Jun 23 17:23:40 2013 @@ -9,7 +9,7 @@ i=$1 if(! test -d $i){ echo 'patch: missing patch: '^$i >[1=2] - exit missing patch + exit missing } files=(files removed readme email) @@ -18,7 +18,7 @@ echo 'missing file: '^$i/$f >[1=2] exit 'missing file: '^$i/$f } -if(grep -v '^/[_a-zA-Z0-9.\-+/:·]+ [_a-zA-Z0-9.\-+:·]+$' <$i/files){ +if(grep -v '^|(/[_a-zA-Z0-9.\-+/:·]+ [_a-zA-Z0-9.\-+:·]+)$' <$i/files){ echo $i: bad file list >[1=2] exit 'bad file list' }