summaryrefslogtreecommitdiff
path: root/src/repo-diff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-05-01 17:46:32 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2017-05-04 14:28:08 -0400
commit2ae5371f347603d34a7ccc33681e612db338d11e (patch)
tree2ecb5b05dcb1ffc2defb31c7f64d6720435f13e5 /src/repo-diff
parentbb97cfc85d9b711b517985abbd9832bff9c4b37a (diff)
Have everything use a main() function, where it isn't too tricky to convert
"Ignore space change" is essential to making sense of this patch.
Diffstat (limited to 'src/repo-diff')
-rwxr-xr-xsrc/repo-diff50
1 files changed, 27 insertions, 23 deletions
diff --git a/src/repo-diff b/src/repo-diff
index 10b617c..ab7aaed 100755
--- a/src/repo-diff
+++ b/src/repo-diff
@@ -30,11 +30,6 @@ usage() {
flag 'parabola' 'expands to Parabola GNU/Linux-libre repo url'
}
-if test $# -eq 0; then
- usage
- exit 0
-fi
-
b() { bsdtar ztf "$1" | cut -d "/" -f1 | sort -u ; }
n() { echo "$1".db | tr "/" "-"; }
@@ -49,28 +44,37 @@ g() {
-e "s,^arch\(linux\)\?/,http://mirrors.kernel.org/archlinux/,"
}
-mkdir ${0##*/}.$$
-pushd ${0##*/}.$$ >/dev/null
+main() {
+ if test $# -eq 0; then
+ usage
+ exit 0
+ fi
+
+ mkdir ${0##*/}.$$
+ pushd ${0##*/}.$$ >/dev/null
-d=""
-for i in $1 $2; do
- n=$(n "$i")
+ d=""
+ for i in $1 $2; do
+ n=$(n "$i")
- test -z "$n" && exit 1
+ 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
+ d+=" ${n}.orig"
+ done
-{
- printf "$(gettext "Difference between %s and %s")\n---\n" $1 $2
- which diffstat &>/dev/null && diff -auN "${d[@]}" | diffstat
- diff -auN "${d[@]}"
-} >../${n}.diff
+ {
+ printf "$(gettext "Difference between %s and %s")\n---\n" $1 $2
+ which diffstat &>/dev/null && diff -auN "${d[@]}" | diffstat
+ diff -auN "${d[@]}"
+ } >../${n}.diff
-popd >/dev/null
-rm -r ${0##*/}.$$
+ popd >/dev/null
+ rm -r ${0##*/}.$$
+
+ print "Difference save on %s" "${n}.diff"
+}
-print "Difference save on %s" "${n}.diff"
+main "$@"