summaryrefslogtreecommitdiff
path: root/src/repo-diff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-03-05 09:56:56 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-03-05 09:56:56 -0500
commitfe83da6541b3996829e9890e4db62b8229cbef14 (patch)
tree3c087aa4da9591cb6c635220bdf6f35477e70483 /src/repo-diff
parent696c05516039b7b93381811451d393b16a8653d1 (diff)
parentc808635fca24c2329c63e397accb1d21a6c05e37 (diff)
Merge branch 'fauno-merge' into master
Conflicts: src/treepkg
Diffstat (limited to 'src/repo-diff')
-rwxr-xr-xsrc/repo-diff54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/repo-diff b/src/repo-diff
new file mode 100755
index 0000000..bfa1968
--- /dev/null
+++ b/src/repo-diff
@@ -0,0 +1,54 @@
+#!/usr/bin/env bash
+# Shows a diff between repo databases
+
+if test $# -eq 0; then
+ printf "$(gettext "Compares two repo databases using distro/repo/architecture format
+
+Usage:
+\t%s arch/core/i686 parabola/core/i686
+
+Shortcuts:
+\tarch \texpands to archlinux repo url repo
+\tparabola\texpands to parabola repo url\n")" ${0##*/}
+ exit 0
+fi
+
+b() { bsdtar ztf $1 | cut -d "/" -f1 | sort -u ; }
+n() { echo "$1".db | tr "/" "-"; }
+
+# hopefully simple way to convert
+# parabola/libre/i686
+# to
+# http://repo.parabolagnulinux.org/libre/os/i686/libre.db
+# add more distros here
+g() {
+ echo "$1" | sed -e "s,^\([^/]\+\)/\([^/]\+\)/\([^/]\+\)$,\1/\2/os/\3/\2.db," \
+ -e "s,^parabola/,http://repo.parabolagnulinux.org/," \
+ -e "s,^arch\(linux\)\?/,http://mirrors.kernel.org/archlinux/,"
+}
+
+mkdir ${0##*/}.$$
+pushd ${0##*/}.$$ >/dev/null
+
+d=""
+for i in $1 $2; do
+ n=$(n "$i")
+
+ test -z "$n" && exit 1
+
+ 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
+ diff -auN "${d[@]}"
+} >../${n}.diff
+
+popd >/dev/null
+rm -r ${0##*/}.$$
+
+printf "$(gettext "Difference save on %s")\n" ${n}.diff