summaryrefslogtreecommitdiffstats
path: root/bin/diffoscope_distribution_test.sh
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2016-04-25 15:22:53 +0200
committerHolger Levsen <holger@layer-acht.org>2016-04-25 15:33:58 +0200
commit1dc7cb84075d627295abb951c201b16f0699f7f6 (patch)
tree47cf5ca4bba957b9a07c14cca1d18c405cfe863b /bin/diffoscope_distribution_test.sh
parent54968b6673a5c13961d87f61a9852511b270ac44 (diff)
downloadjenkins.debian.net-1dc7cb84075d627295abb951c201b16f0699f7f6.tar.xz
refactor to make script more generally useful
Diffstat (limited to 'bin/diffoscope_distribution_test.sh')
-rwxr-xr-xbin/diffoscope_distribution_test.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/bin/diffoscope_distribution_test.sh b/bin/diffoscope_distribution_test.sh
new file mode 100755
index 00000000..cbb7207d
--- /dev/null
+++ b/bin/diffoscope_distribution_test.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+# Copyright 2014-2016 Holger Levsen <holger@layer-acht.org>
+# released under the GPLv=2
+
+DEBUG=false
+. /srv/jenkins/bin/common-functions.sh
+common_init "$@"
+
+check_pypi() {
+ TMPPYPI=$(mktemp -t diffoscope-distribution-XXXXXXXX)
+ # the following two lines are a bit fragile…
+ curl https://pypi.python.org/pypi/diffoscope/ -o $TMPPYPI
+ DIFFOSCOPE_IN_PYPI=$(grep "<title>" $TMPPYPI | cut -d ">" -f2- | cut -d ":" -f1 |cut -d " " -f2)
+ rm -f $TMPPYPI > /dev/null
+ echo
+ echo
+ if [ "$DIFFOSCOPE_IN_DEBIAN" = "$DIFFOSCOPE_IN_PYPI" ] ; then
+ echo "Yay. diffoscope in Debian has the same version as on PyPI: $DIFFOSCOPE_IN_DEBIAN"
+ elif dpkg --compare-versions "$DIFFOSCOPE_IN_DEBIAN" gt "$DIFFOSCOPE_IN_PYPI" ; then
+ echo "Fail: diffoscope in Debian: $DIFFOSCOPE_IN_DEBIAN"
+ echo "Fail: diffoscope in PyPI: $DIFFOSCOPE_IN_PYPI"
+ exit 1
+ else
+ echo "diffoscope in Debian: $DIFFOSCOPE_IN_DEBIAN"
+ echo "diffoscope in PyPI: $DIFFOSCOPE_IN_PYPI"
+ echo
+ echo "Failure is the default action…"
+ exit 1
+ fi
+}
+
+#
+# main
+#
+DIFFOSCOPE_IN_DEBIAN=$(rmadison diffoscope|egrep '(unstable|sid)'| awk '{print $3}' || true)
+
+case $1 in
+ pypi)
+ DISTRIBUTION=$1
+ check_pypi
+ ;;
+ *)
+ echo "Unsupported distribution."
+ exit 1
+ ;;
+esac
+
+
+