summaryrefslogtreecommitdiff
path: root/debian/get-orig-source.sh
diff options
context:
space:
mode:
Diffstat (limited to 'debian/get-orig-source.sh')
-rwxr-xr-xdebian/get-orig-source.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/debian/get-orig-source.sh b/debian/get-orig-source.sh
new file mode 100755
index 0000000..4265069
--- /dev/null
+++ b/debian/get-orig-source.sh
@@ -0,0 +1,15 @@
+#!/bin/sh -e
+
+GH_PROJECT=Eugeny/reconfigure
+PY_NAME=reconfigure
+
+# receive the list of changesets where the version changed, take only the first one
+GIT_REV=$(GET -o links https://github.com/${GH_PROJECT}/commits/master/${PY_NAME}/__init__.py 2>/dev/null 2>/dev/null | grep -o "https://github.com/${GH_PROJECT}/tree/.*/${PY_NAME}/__init__.py" -m 1 | sed -e 's=^.*tree/\([0-9a-f]*\)/.*=\1=g')
+
+GIT_REV_SHORT=$(echo ${GIT_REV} | grep -E -o '.{8}' | head -n1)
+
+VERSION=$(GET https://raw.githubusercontent.com/${GH_PROJECT}/${GIT_REV}/${PY_NAME}/__init__.py 2>/dev/null | grep -E -o '[[:digit:]]+\.[[:digit:]]+(\.[[:digit:]]+)?')
+
+PACKAGE=$(dpkg-parsechangelog -S Source)
+
+GET https://github.com/${GH_PROJECT}/archive/${GIT_REV}.tar.gz > ${PACKAGE}_${VERSION}+git${GIT_REV_SHORT}.orig.tar.gz