diff options
author | John Ankarström <john@ankarstrom.se> | 2021-07-18 18:49:13 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-07-18 18:49:37 +0200 |
commit | 123687a5aa3482b5ba9ca86179526c94422b409d (patch) | |
tree | 83fa480a7727cd67eb5840e7555d984478c53afd /convpatch | |
parent | 830afa08f95e2026f97b62d22484c27d42c104b1 (diff) | |
download | patches-123687a5aa3482b5ba9ca86179526c94422b409d.tar.gz |
Add savepatch, xpkg scripts
Diffstat (limited to 'convpatch')
-rwxr-xr-x | convpatch | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/convpatch b/convpatch new file mode 100755 index 0000000..2ebbcd8 --- /dev/null +++ b/convpatch @@ -0,0 +1,44 @@ +#!/bin/sh -f + +# convpatch -- convert git diff -p output to pkgsrc patch + +IFS=' +' + +{ + echo '$NetBSD$' + echo + + # get patch description + if [ x"$1" = x"-i" ]; then + f=`mktemp -t ${0##*/}` || exit 1 + echo 'Edit patch description...' > $f + </dev/tty >/dev/tty vi $f + c=`cat $f` + if [ x"$c" != x"Edit patch description..." ]; then + printf '%s\n\n' "$c" + fi + rm $f + fi + + sed ' + /^diff/d; + /^index/d; + s/^--- .*/&/; + ' +} | +while read -r line; do + case "$line" in + diff*) ;; + index*) ;; + '--- a/'*) + file=${line#--- a/} + echo -n "--- $file.orig " + file=$(git rev-parse --show-toplevel)/$file + echo "$(stat -x "$file")" | sed -n 's/^Access: //p' ;; + '+++ b/'*) + echo "+++ ${line#+++ b/}" ;; + *) + echo "$line" ;; + esac +done |