summaryrefslogtreecommitdiff
path: root/debian/get-orig-source.sh
blob: 4265069799917d07dcdd51c27668e7061b1498f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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