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