Alexander Afanasyev | c510386 | 2014-05-07 19:24:25 -0700 | [diff] [blame^] | 1 | # PPA archive |
| 2 | PPA=ppa:named-data/ppa |
| 3 | |
| 4 | # List of target distributions |
| 5 | DISTROS=precise saucy trusty |
| 6 | |
| 7 | DEBUILD=debuild -S -sa |
| 8 | |
| 9 | all: _phony |
| 10 | |
| 11 | _phony: |
| 12 | |
| 13 | distro: work/${NAME} |
| 14 | |
| 15 | work/${NAME}: |
| 16 | \ |
| 17 | mkdir work || true ; \ |
| 18 | cd work ; \ |
| 19 | git clone --recursive "${GIT_URL}" "${NAME}" ; \ |
| 20 | cd "${NAME}" ; \ |
| 21 | git checkout "${GIT_VERSION}" ; \ |
| 22 | git archive --format=tar.gz --prefix=${NAME}_${VERSION}/ \ |
| 23 | -o ../${NAME}_${VERSION}.orig.tar.gz HEAD |
| 24 | |
| 25 | build: distro |
| 26 | \ |
| 27 | if test -z "$$DEBEMAIL" -o -z "$$DEBFULLNAME"; then \ |
| 28 | echo "DEBFULLNAME and DEBEMAIL environmental variable should be set" ; \ |
| 29 | echo "For example:" ; \ |
| 30 | echo "export DEBEMAIL=\"my@emailaddress.com\"" ; \ |
| 31 | echo "export DEBFULLNAME=\"Full Name\"" ;\ |
| 32 | exit 1; \ |
| 33 | fi |
| 34 | \ |
| 35 | cd "work/${NAME}" ; \ |
| 36 | for distro in ${DISTROS}; do \ |
| 37 | NEW_VER="${VERSION}-ppa${PPA_VERSION}~$$distro"; \ |
| 38 | rm -Rf debian ; cp -r ../../debian . ; \ |
| 39 | sed -i -e "s/DISTRO/$$distro/g" debian/changelog ; \ |
| 40 | if [ -f "debian/control.$$distro" ]; then \ |
| 41 | mv "debian/control.$$distro" debian/control ; \ |
| 42 | fi ; \ |
| 43 | CUR_VER=`dpkg-parsechangelog | grep '^Version: ' | awk '{print $$2}'`; \ |
| 44 | if dpkg --compare-versions $$NEW_VER gt $$CUR_VER; then \ |
| 45 | echo "New version. Will update changelog and build source package" ; \ |
| 46 | dch -v $$NEW_VER -D $$distro --force-distribution \ |
| 47 | -u low "New version based on ${GIT_VERSION} (${GIT_URL})" ; \ |
| 48 | else \ |
| 49 | if dpkg --compare-versions $$NEW_VER ne $$CUR_VER; then \ |
| 50 | echo "ERROR: Cannot rebuild source package, because new version is earlier \ |
| 51 | than the one specified in changelog ($$NEW_VER < $$CUR_VER)" ; \ |
| 52 | exit 1; \ |
| 53 | fi ; \ |
| 54 | echo "Same version, just rebuild source package" ; \ |
| 55 | fi ; \ |
| 56 | ${DEBUILD} ; \ |
| 57 | done |
| 58 | |
| 59 | dput: build |
| 60 | \ |
| 61 | cd "work" ; \ |
| 62 | for distro in ${DISTROS}; do \ |
| 63 | dput "${PPA}" "${NAME}_${VERSION}-ppa${PPA_VERSION}~$$distro""_source.changes" ; \ |
| 64 | done ; \ |
| 65 | \ |
| 66 | cd .. ; \ |
| 67 | NEW_VER="${VERSION}-ppa${PPA_VERSION}~DISTRO"; \ |
| 68 | CUR_VER=`dpkg-parsechangelog | grep '^Version: ' | awk '{print $$2}'`; \ |
| 69 | if dpkg --compare-versions $$NEW_VER gt $$CUR_VER; then \ |
| 70 | dch -v $$NEW_VER -D DISTRO --force-distribution \ |
| 71 | -u low "New version based on ${GIT_VERSION} (${GIT_URL})" ; \ |
| 72 | fi |
| 73 | |
| 74 | clean: |
| 75 | @rm -Rf work |