aboutsummaryrefslogtreecommitdiff
path: root/bin/pkgdiffex
blob: 2e180fad8f5c2cd91d338b4ffd39dcadb05f136b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh -ef

# pkgdiffex -- diff files against existing patches

IFS='
'
[ x"$1" = x"-q" ] && q=1 || q=
wc=$(pkgwcp pkgdiffex)
cd $wc

trap 'echo "${0##*/}: aborted, working copy saved in $wc" 1>&2;
	trap -' INT QUIT EXIT

origs=$(find . -name '*.orig' -type f)

for o in $origs; do
	mv ${o%.orig} ${o%.orig}.new		# f -> f.new
	cp $o ${o%.orig}			# f.orig -> f (copy)
done

pkgpatchex

echo '$NetBSD$'
for o in $origs; do
	mv ${o%.orig} $o			# f -> f.orig
	mv ${o%.orig}.new ${o%.orig}		# f.new -> f
	pkgdiff ${o%.orig} | sed -n '2,$p'
done

trap -
cd -
rm -r $wc