blob: 6d34f9f5e2ad85c5be70358b29bce4721772d169 [file] [log] [blame]
Alexander Afanasyevc5103862014-05-07 19:24:25 -07001# PPA archive
Alexander Afanasyev2811bdd2014-05-26 07:24:01 -07002PPA=ppa:named-data/ppa-dev
Alexander Afanasyevc5103862014-05-07 19:24:25 -07003
4# List of target distributions
Alexander Afanasyevb6c3f5a2015-05-05 20:22:00 +00005DISTROS=precise trusty vivid
Alexander Afanasyevc5103862014-05-07 19:24:25 -07006
Alexander Afanasyevb79a7b72014-05-08 22:16:35 -07007DEBUILD=debuild -S
Alexander Afanasyevc5103862014-05-07 19:24:25 -07008
9all: _phony
10
11_phony:
12
Alexander Afanasyevb79a7b72014-05-08 22:16:35 -070013distro: work/${NAME}_${VERSION}
Alexander Afanasyevc5103862014-05-07 19:24:25 -070014
Alexander Afanasyevb79a7b72014-05-08 22:16:35 -070015work/${NAME}_${VERSION}:
Alexander Afanasyevc5103862014-05-07 19:24:25 -070016 \
17mkdir work || true ; \
18cd work ; \
Alexander Afanasyevb79a7b72014-05-08 22:16:35 -070019git clone "${GIT_URL}" "${NAME}_${VERSION}" ; \
20cd "${NAME}_${VERSION}" ; \
Alexander Afanasyev52c1c052014-09-04 16:13:14 -070021git fetch origin "${GIT_VERSION}"; \
Alexander Afanasyevc5103862014-05-07 19:24:25 -070022git checkout "${GIT_VERSION}" ; \
Alexander Afanasyevb79a7b72014-05-08 22:16:35 -070023git submodule init ; git submodule update ; \
Alexander Afanasyev2d997f72014-10-31 13:10:38 -070024(./waf version || true) ; \
25(./waf distclean || true) ; \
Alexander Afanasyevb79a7b72014-05-08 22:16:35 -070026cd .. ; \
Alexander Afanasyev2d997f72014-10-31 13:10:38 -070027tar --exclude .git --exclude '*.pyc' -cf - ${NAME}_${VERSION} | gzip -n9c > ${NAME}_${VERSION}.orig.tar.gz
Alexander Afanasyevc5103862014-05-07 19:24:25 -070028
Alexander Afanasyev2c3726b2014-05-26 06:29:36 -070029source-build:
30 $(MAKE) _build DEBUILD="debuild -S -sa"
31
32build:
Eric Newberry9ab4a662015-05-28 11:36:41 -070033 $(MAKE) _build DEBUILD=debuild
Alexander Afanasyev2c3726b2014-05-26 06:29:36 -070034
35install: build
36 sudo dpkg -i work/*.deb
37
38_build: distro
Alexander Afanasyevc5103862014-05-07 19:24:25 -070039 \
40if 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; \
46fi
47 \
Alexander Afanasyevb79a7b72014-05-08 22:16:35 -070048cd "work/${NAME}_${VERSION}" ; \
Alexander Afanasyevc5103862014-05-07 19:24:25 -070049for 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 ; \
Eric Newberrydae2bef2015-05-27 14:23:24 -070053 for file in debian/*.$$distro; do \
54 if [ -f $$file ]; then \
55 rename -f "s/\.$$distro$$//" $$file ; \
56 fi ; \
57 done ; \
Alexander Afanasyevc5103862014-05-07 19:24:25 -070058 CUR_VER=`dpkg-parsechangelog | grep '^Version: ' | awk '{print $$2}'`; \
59 if dpkg --compare-versions $$NEW_VER gt $$CUR_VER; then \
60 echo "New version. Will update changelog and build source package" ; \
61 dch -v $$NEW_VER -D $$distro --force-distribution \
62 -u low "New version based on ${GIT_VERSION} (${GIT_URL})" ; \
63 else \
64 if dpkg --compare-versions $$NEW_VER ne $$CUR_VER; then \
65 echo "ERROR: Cannot rebuild source package, because new version is earlier \
66than the one specified in changelog ($$NEW_VER < $$CUR_VER)" ; \
67 exit 1; \
68 fi ; \
69 echo "Same version, just rebuild source package" ; \
70 fi ; \
71 ${DEBUILD} ; \
72done
73
Alexander Afanasyev2c3726b2014-05-26 06:29:36 -070074dput: source-build
Alexander Afanasyevc5103862014-05-07 19:24:25 -070075 \
76cd "work" ; \
77for distro in ${DISTROS}; do \
Alexander Afanasyev4ae71852014-07-22 13:44:40 -070078 dput -f "${PPA}" "${NAME}_${VERSION}-ppa${PPA_VERSION}~$$distro""_source.changes" ; \
Alexander Afanasyevc5103862014-05-07 19:24:25 -070079done ; \
80\
81cd .. ; \
82NEW_VER="${VERSION}-ppa${PPA_VERSION}~DISTRO"; \
83CUR_VER=`dpkg-parsechangelog | grep '^Version: ' | awk '{print $$2}'`; \
84if dpkg --compare-versions $$NEW_VER gt $$CUR_VER; then \
85 dch -v $$NEW_VER -D DISTRO --force-distribution \
86 -u low "New version based on ${GIT_VERSION} (${GIT_URL})" ; \
87fi
88
89clean:
90 @rm -Rf work