summaryrefslogtreecommitdiff
path: root/src/repo-diff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-04-20 23:05:42 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2017-05-04 14:30:02 -0400
commit7d584af432202470d9d8fefd74a7f7ed044c4ab3 (patch)
tree0db3e165bd055a5f56c1a8548333b0dc87c27774 /src/repo-diff
parent2ae5371f347603d34a7ccc33681e612db338d11e (diff)
random tidy up
Diffstat (limited to 'src/repo-diff')
-rwxr-xr-xsrc/repo-diff29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/repo-diff b/src/repo-diff
index ab7aaed..df5e49b 100755
--- a/src/repo-diff
+++ b/src/repo-diff
@@ -30,8 +30,12 @@ usage() {
flag 'parabola' 'expands to Parabola GNU/Linux-libre repo url'
}
-b() { bsdtar ztf "$1" | cut -d "/" -f1 | sort -u ; }
-n() { echo "$1".db | tr "/" "-"; }
+b() {
+ bsdtar tf "$1" | cut -d "/" -f1 | sort -u
+}
+n() {
+ tr "/" "-" <<<"$1".db
+}
# hopefully simple way to convert
# parabola/libre/i686
@@ -47,11 +51,11 @@ g() {
main() {
if test $# -eq 0; then
usage
- exit 0
+ return 0
fi
- mkdir ${0##*/}.$$
- pushd ${0##*/}.$$ >/dev/null
+ local tmpdir; tmpdir="$(mktemp -d -t "${0##*/}.XXXXXXXXXX")"
+ pushd "$tmpdir" >/dev/null
d=""
for i in $1 $2; do
@@ -59,20 +63,23 @@ main() {
test -z "$n" && exit 1
- wget -O "$n" -nv $(g "$i")
- b "$n" >${n}.orig
+ wget -O "$n" -nv "$(g "$i")"
+ b "$n" > "${n}.orig"
d+=" ${n}.orig"
done
{
- printf "$(gettext "Difference between %s and %s")\n---\n" $1 $2
- which diffstat &>/dev/null && diff -auN "${d[@]}" | diffstat
+ print 'Difference between %s and %s' "$1" "$2"
+ echo '---'
+ if type diffstat &>/dev/null; then
+ diff -auN "${d[@]}" | diffstat
+ fi
diff -auN "${d[@]}"
- } >../${n}.diff
+ } > "../${n}.diff"
popd >/dev/null
- rm -r ${0##*/}.$$
+ rm -r "$tmpdir"
print "Difference save on %s" "${n}.diff"
}