From 763e138b3dc2c5b68aa7edf8d3e9e520380495d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Mon, 26 Jul 2021 22:21:40 +0200 Subject: Add pkgdiffex script --- bin/pkgdiffex | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 bin/pkgdiffex (limited to 'bin/pkgdiffex') diff --git a/bin/pkgdiffex b/bin/pkgdiffex new file mode 100755 index 0000000..d2fea2b --- /dev/null +++ b/bin/pkgdiffex @@ -0,0 +1,38 @@ +#!/bin/sh + +# pkgdiffex -- diff files against existing patches + +if [ $# -eq 0 ]; then + echo "usage: ${0##*/} file [...]" 1>&2 + exit 1 +fi + +i=0 +while [ $((++i)) -le $# ]; do + o=${1%.orig}.orig + if [ ! -f "$o" ]; then + echo "${0##*/}: file $o does not exist" 1>&2 + exit 1 + fi + shift + set -- "$@" "$o" +done + +cmd=cat +for o in "$@"; do + mv "${o%.orig}" "${o%.orig}".new # f -> f.new + cp "$o" "$o"inal # f.orig +> f.original + cp "$o" "${o%.orig}" # f.orig +> f +done + +ls "$(whereispatch -i)"/patch-* | while read -r patch; do + pkgpatch <$patch +done + +for o in "$@"; do + mv "${o%.orig}" "$o" # f -> f.orig + mv "${o%.orig}".new "${o%.orig}" # f.new -> f + pkgdiff "${o%.orig}" | $cmd + mv "$o"inal "$o" # f.original -> f.orig + cmd='sed -n 2,$p' +done -- cgit v1.2.3