blob: 5a3a53c576a1ad083ac2f9f3ee8cbb2aa537b3ad [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 ; \
56 CUR_VER=`dpkg-parsechangelog | grep '^Version: ' | awk '{print $$2}'`; \
57 if dpkg --compare-versions $$NEW_VER gt $$CUR_VER; then \
58 echo "New version. Will update changelog and build source package" ; \
59 dch -v $$NEW_VER -D $$distro --force-distribution \
60 -u low "New version based on ${GIT_VERSION} (${GIT_URL})" ; \
61 else \
62 if dpkg --compare-versions $$NEW_VER ne $$CUR_VER; then \
63 echo "ERROR: Cannot rebuild source package, because new version is earlier \
64than the one specified in changelog ($$NEW_VER < $$CUR_VER)" ; \
65 exit 1; \
66 fi ; \
67 echo "Same version, just rebuild source package" ; \
68 fi ; \
69 ${DEBUILD} ; \
70done
71
Alexander Afanasyev2c3726b2014-05-26 06:29:36 -070072dput: source-build
Alexander Afanasyevc5103862014-05-07 19:24:25 -070073 \
74cd "work" ; \
75for distro in ${DISTROS}; do \
Alexander Afanasyev4ae71852014-07-22 13:44:40 -070076 dput -f "${PPA}" "${NAME}_${VERSION}-ppa${PPA_VERSION}~$$distro""_source.changes" ; \
Alexander Afanasyevc5103862014-05-07 19:24:25 -070077done ; \
78\
79cd .. ; \
80NEW_VER="${VERSION}-ppa${PPA_VERSION}~DISTRO"; \
81CUR_VER=`dpkg-parsechangelog | grep '^Version: ' | awk '{print $$2}'`; \
82if dpkg --compare-versions $$NEW_VER gt $$CUR_VER; then \
83 dch -v $$NEW_VER -D DISTRO --force-distribution \
84 -u low "New version based on ${GIT_VERSION} (${GIT_URL})" ; \
85fi
86
87clean:
88 @rm -Rf work