summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorAndrew Shadura <andrew@shadura.me>2015-08-20 16:03:22 +0200
committerAndrew Shadura <andrew@shadura.me>2015-08-20 16:03:22 +0200
commita6842a40e99bdb047c83ce2006364ec89b0108df (patch)
tree7a386f1a0a06e43893914e3a554adc06bf8c1a2b /debian
parentb954557c470d7fe2a0e43ad04bcfec879408e5f4 (diff)
Add get-orig-source.
Diffstat (limited to 'debian')
-rwxr-xr-xdebian/get-orig-source.sh15
-rwxr-xr-xdebian/rules7
2 files changed, 21 insertions, 1 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
diff --git a/debian/rules b/debian/rules
index 4d1de0f..e9cfccc 100755
--- a/debian/rules
+++ b/debian/rules
@@ -14,4 +14,9 @@ override_dh_auto_clean:
override_dh_installchangelogs:
dh_installchangelogs -X docs
-.PHONY: override_dh_auto_build override_dh_auto_clean override_dh_installchangelogs
+get-orig-source:
+ @d=$$(readlink -e $(MAKEFILE_LIST)); \
+ cd $${d%/*}/..; \
+ debian/get-orig-source.sh $(CURDIR)
+
+.PHONY: override_dh_auto_build override_dh_auto_clean override_dh_installchangelogs get-orig-source