aboutsummaryrefslogtreecommitdiff
path: root/conv
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-07-18 18:49:13 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-07-18 18:49:37 +0200
commit123687a5aa3482b5ba9ca86179526c94422b409d (patch)
tree83fa480a7727cd67eb5840e7555d984478c53afd /conv
parent830afa08f95e2026f97b62d22484c27d42c104b1 (diff)
downloadpatches-123687a5aa3482b5ba9ca86179526c94422b409d.tar.gz
Add savepatch, xpkg scripts
Diffstat (limited to 'conv')
-rwxr-xr-xconv84
1 files changed, 0 insertions, 84 deletions
diff --git a/conv b/conv
deleted file mode 100755
index 39781d7..0000000
--- a/conv
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/bin/sh
-
-# conv -- convert git diff -p output to pkgsrc patch
-
-set -f
-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 | {
-if [ x"$1" = x"-i" ]; then
- # read patch before proceeding
- patch=`cat`
-
- # get patch directory
- dir=$2
- if [ -z "$2" ]; then
- echo -n 'Package name: ' >/dev/tty
- read dir </dev/tty
- fi
- dir=~/patches/$dir
- mkdir -p $dir
-
- # get patch name
- name=$3
- if [ -z "$3" ]; then
- echo -n 'Patch name: ' >/dev/tty
- read name </dev/tty
- fi
-
- case $name in
- patch-*) ;;
- *) name=patch-$name ;;
- esac
-
- # write patch if it doesn't already exist
- if [ -e $dir/$name ]; then
- f=`mktemp -t ${0##*/}` || exit 1
- printf '%s\n' "$patch" > $f
- echo "error: $dir/$name already exists; saving to $f" 1>&2
- exit 1
- else
- printf '%s\n' "$patch" > $dir/$name
- echo $dir/$name 1>&2
- fi
-else
- cat
-fi
-}