Alexander Afanasyev | c510386 | 2014-05-07 19:24:25 -0700 | [diff] [blame] | 1 | # PPA archive |
Alexander Afanasyev | 2811bdd | 2014-05-26 07:24:01 -0700 | [diff] [blame^] | 2 | PPA=ppa:named-data/ppa-dev |
Alexander Afanasyev | c510386 | 2014-05-07 19:24:25 -0700 | [diff] [blame] | 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 | |
Alexander Afanasyev | 2c3726b | 2014-05-26 06:29:36 -0700 | [diff] [blame] | 26 | source-build: |
| 27 | $(MAKE) _build DEBUILD="debuild -S -sa" |
| 28 | |
| 29 | build: |
| 30 | $(MAKE) _build DEBUILD=debuild DISTROS=precise |
| 31 | |
| 32 | install: build |
| 33 | sudo dpkg -i work/*.deb |
| 34 | |
| 35 | _build: distro |
Alexander Afanasyev | c510386 | 2014-05-07 19:24:25 -0700 | [diff] [blame] | 36 | \ |
| 37 | if test -z "$$DEBEMAIL" -o -z "$$DEBFULLNAME"; then \ |
| 38 | echo "DEBFULLNAME and DEBEMAIL environmental variable should be set" ; \ |
| 39 | echo "For example:" ; \ |
| 40 | echo "export DEBEMAIL=\"my@emailaddress.com\"" ; \ |
| 41 | echo "export DEBFULLNAME=\"Full Name\"" ;\ |
| 42 | exit 1; \ |
| 43 | fi |
| 44 | \ |
Alexander Afanasyev | b79a7b7 | 2014-05-08 22:16:35 -0700 | [diff] [blame] | 45 | cd "work/${NAME}_${VERSION}" ; \ |
Alexander Afanasyev | c510386 | 2014-05-07 19:24:25 -0700 | [diff] [blame] | 46 | for distro in ${DISTROS}; do \ |
| 47 | NEW_VER="${VERSION}-ppa${PPA_VERSION}~$$distro"; \ |
| 48 | rm -Rf debian ; cp -r ../../debian . ; \ |
| 49 | sed -i -e "s/DISTRO/$$distro/g" debian/changelog ; \ |
| 50 | if [ -f "debian/control.$$distro" ]; then \ |
| 51 | mv "debian/control.$$distro" debian/control ; \ |
| 52 | fi ; \ |
| 53 | CUR_VER=`dpkg-parsechangelog | grep '^Version: ' | awk '{print $$2}'`; \ |
| 54 | if dpkg --compare-versions $$NEW_VER gt $$CUR_VER; then \ |
| 55 | echo "New version. Will update changelog and build source package" ; \ |
| 56 | dch -v $$NEW_VER -D $$distro --force-distribution \ |
| 57 | -u low "New version based on ${GIT_VERSION} (${GIT_URL})" ; \ |
| 58 | else \ |
| 59 | if dpkg --compare-versions $$NEW_VER ne $$CUR_VER; then \ |
| 60 | echo "ERROR: Cannot rebuild source package, because new version is earlier \ |
| 61 | than the one specified in changelog ($$NEW_VER < $$CUR_VER)" ; \ |
| 62 | exit 1; \ |
| 63 | fi ; \ |
| 64 | echo "Same version, just rebuild source package" ; \ |
| 65 | fi ; \ |
| 66 | ${DEBUILD} ; \ |
| 67 | done |
| 68 | |
Alexander Afanasyev | 2c3726b | 2014-05-26 06:29:36 -0700 | [diff] [blame] | 69 | dput: source-build |
Alexander Afanasyev | c510386 | 2014-05-07 19:24:25 -0700 | [diff] [blame] | 70 | \ |
| 71 | cd "work" ; \ |
| 72 | for distro in ${DISTROS}; do \ |
| 73 | dput "${PPA}" "${NAME}_${VERSION}-ppa${PPA_VERSION}~$$distro""_source.changes" ; \ |
| 74 | done ; \ |
| 75 | \ |
| 76 | cd .. ; \ |
| 77 | NEW_VER="${VERSION}-ppa${PPA_VERSION}~DISTRO"; \ |
| 78 | CUR_VER=`dpkg-parsechangelog | grep '^Version: ' | awk '{print $$2}'`; \ |
| 79 | if dpkg --compare-versions $$NEW_VER gt $$CUR_VER; then \ |
| 80 | dch -v $$NEW_VER -D DISTRO --force-distribution \ |
| 81 | -u low "New version based on ${GIT_VERSION} (${GIT_URL})" ; \ |
| 82 | fi |
| 83 | |
| 84 | clean: |
| 85 | @rm -Rf work |