summaryrefslogtreecommitdiffstats
path: root/bin/debian-sponsor.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bin/debian-sponsor.sh')
-rwxr-xr-xbin/debian-sponsor.sh68
1 files changed, 68 insertions, 0 deletions
diff --git a/bin/debian-sponsor.sh b/bin/debian-sponsor.sh
new file mode 100755
index 0000000..17191f5
--- /dev/null
+++ b/bin/debian-sponsor.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+
+set -e
+
+DSC="${1}"
+
+case "${DSC}" in
+ *.dsc)
+ ;;
+
+ *)
+ echo "Usage: ${0} DSC"
+ ;;
+esac
+
+SOURCE="$(basename ${DSC} | awk -F_ '{ print $1 }')"
+
+# Download sources
+mkdir -p NEW OLD
+
+cd NEW
+DGET_VERIFY=no dget --insecure -u -d "${DSC}"
+cd "${OLDPWD}"
+
+cd OLD
+apt source --only-source --download-only ${SOURCE}
+cd "${OLDPWD}"
+
+# Compare upstream tarballs
+if [ -e NEW/$(basename OLD/*.orig.tar.*) ]
+then
+ OLD_MD5="$(md5sum OLD/*.orig.tar.* | awk '{ print $1 }')"
+ NEW_MD5="$(md5sum OLD/*.orig.tar.* | awk '{ print $1 }')"
+
+ if [ "${OLD_MD5}" != "${NEW_MD5}" ]
+ then
+ echo "E: upstream tarballs do not match!"
+ echo "E: new version?"
+ fi
+fi
+
+# Unpack upstream
+cd NEW
+dpkg-source -x --skip-debianization *.dsc ${SOURCE}
+cd "${OLDPWD}"
+
+cd OLD
+dpkg-source -x --skip-debianization *.dsc ${SOURCE}
+cd "${OLDPWD}"
+
+# Compare upstream
+set +e
+diff -Naurp OLD/${SOURCE} NEW/${SOURCE} > upstream.diff
+set -e
+
+# Unpack debian
+cd "NEW/${SOURCE}"
+tar xf ../*debian.tar.*
+cd "${OLDPWD}"
+
+cd "OLD/${SOURCE}"
+tar xf ../*debian.tar.*
+cd "${OLDPWD}"
+
+# Compare debian
+set +e
+diff -Naurp OLD/${SOURCE}/debian NEW/${SOURCE}/debian > debian.diff
+set -e