blob: 9365e3a7baf324fba7deb881cafa8456ff598f69 [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 Afanasyevc5735542014-10-28 12:01:14 -07005DISTROS=precise trusty utopic
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:
Alexander Afanasyevd02dfc62014-07-22 10:55:29 -070033 $(MAKE) _build DEBUILD=debuild DISTROS=trusty
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 ; \
53 if [ -f "debian/control.$$distro" ]; then \
54 mv "debian/control.$$distro" debian/control ; \
55 fi ; \
Alexander Afanasyev3859a9c2014-11-09 16:51:45 -080056 if [ -f "debian/rules.$$distro" ]; then \
57 mv "debian/rules.$$distro" debian/rules ; \
58 fi ; \
Alexander Afanasyevc5103862014-05-07 19:24:25 -070059 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 \
67than 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} ; \
73done
74
Alexander Afanasyev2c3726b2014-05-26 06:29:36 -070075dput: source-build
Alexander Afanasyevc5103862014-05-07 19:24:25 -070076 \
77cd "work" ; \
78for distro in ${DISTROS}; do \
Alexander Afanasyev4ae71852014-07-22 13:44:40 -070079 dput -f "${PPA}" "${NAME}_${VERSION}-ppa${PPA_VERSION}~$$distro""_source.changes" ; \
Alexander Afanasyevc5103862014-05-07 19:24:25 -070080done ; \
81\
82cd .. ; \
83NEW_VER="${VERSION}-ppa${PPA_VERSION}~DISTRO"; \
84CUR_VER=`dpkg-parsechangelog | grep '^Version: ' | awk '{print $$2}'`; \
85if 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})" ; \
88fi
89
90clean:
91 @rm -Rf work