diff options
author | John Ankarström <john@ankarstrom.se> | 2021-06-07 01:23:39 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-06-07 01:23:39 +0200 |
commit | 10afde33e2d3281c1cd807b978480bef19026351 (patch) | |
tree | 7284d907f64c0bccddd5bdb049e0f785c7ff1147 | |
download | patches-10afde33e2d3281c1cd807b978480bef19026351.tar.gz |
Add 'sum' and 'conv' utilities
-rwxr-xr-x | conv | 28 | ||||
-rwxr-xr-x | sum | 14 |
2 files changed, 42 insertions, 0 deletions
@@ -0,0 +1,28 @@ +#!/bin/sh + +# conv -- convert git diff -p output to pkgsrc patch + +IFS=' +' + +echo '$NetBSD' +echo +sed ' + /^diff/d; + /^index/d; + s/^--- .*/&/; +' | +while read line; do + case "$line" in + diff*) ;; + index*) ;; + '--- a/'*) + file=${line#--- a/} + echo -n "--- $file.orig " + echo "$(stat -x "$file")" | sed -n 's/^Access: //p' ;; + '+++ b/'*) + echo "+++ ${line#+++ b/}" ;; + *) + echo "$line" ;; + esac +done @@ -0,0 +1,14 @@ +#!/bin/sh + +# checksum -- create checksum for local patch + +[ -z "$1" ] && { echo usage: $0 patch 1>&2; exit 1; } + +localpath=`readlink -f "$1"` +globalpath=/usr/pkgsrc/${localpath#/home/john/patches/} + +[ -e "$globalpath" ] && { echo error: "$globalpath" exists 1>&2; exit 1; } +doas cp "$localpath" "$globalpath" +cd "$(dirname "$globalpath")" +doas make makepatchsum +doas rm "$globalpath" |