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