blob: 73709ec4930c2e04ea4b5607caf43c5a812b86f2 [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
5DISTROS=precise saucy trusty
6
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 Afanasyevc5103862014-05-07 19:24:25 -070021git checkout "${GIT_VERSION}" ; \
Alexander Afanasyevb79a7b72014-05-08 22:16:35 -070022git submodule init ; git submodule update ; \
23cd .. ; \
24tar --exclude .git -czf ${NAME}_${VERSION}.orig.tar.gz ${NAME}_${VERSION}
Alexander Afanasyevc5103862014-05-07 19:24:25 -070025
Alexander Afanasyev2c3726b2014-05-26 06:29:36 -070026source-build:
27 $(MAKE) _build DEBUILD="debuild -S -sa"
28
29build:
30 $(MAKE) _build DEBUILD=debuild DISTROS=precise
31
32install: build
33 sudo dpkg -i work/*.deb
34
35_build: distro
Alexander Afanasyevc5103862014-05-07 19:24:25 -070036 \
37if 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; \
43fi
44 \
Alexander Afanasyevb79a7b72014-05-08 22:16:35 -070045cd "work/${NAME}_${VERSION}" ; \
Alexander Afanasyevc5103862014-05-07 19:24:25 -070046for 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 \
61than 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} ; \
67done
68
Alexander Afanasyev2c3726b2014-05-26 06:29:36 -070069dput: source-build
Alexander Afanasyevc5103862014-05-07 19:24:25 -070070 \
71cd "work" ; \
72for distro in ${DISTROS}; do \
73 dput "${PPA}" "${NAME}_${VERSION}-ppa${PPA_VERSION}~$$distro""_source.changes" ; \
74done ; \
75\
76cd .. ; \
77NEW_VER="${VERSION}-ppa${PPA_VERSION}~DISTRO"; \
78CUR_VER=`dpkg-parsechangelog | grep '^Version: ' | awk '{print $$2}'`; \
79if 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})" ; \
82fi
83
84clean:
85 @rm -Rf work