From 10afde33e2d3281c1cd807b978480bef19026351 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Mon, 7 Jun 2021 01:23:39 +0200 Subject: Add 'sum' and 'conv' utilities --- conv | 28 ++++++++++++++++++++++++++++ sum | 14 ++++++++++++++ 2 files changed, 42 insertions(+) create mode 100755 conv create mode 100755 sum diff --git a/conv b/conv new file mode 100755 index 0000000..7d5a508 --- /dev/null +++ b/conv @@ -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 diff --git a/sum b/sum new file mode 100755 index 0000000..d6749a1 --- /dev/null +++ b/sum @@ -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" -- cgit v1.2.3