blob: 0065298e4a21225374d05e82ad654a1adcb9b16e [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 Afanasyevd02dfc62014-07-22 10:55:29 -07005DISTROS=precise trusty
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 ; \
24cd .. ; \
Alexander Afanasyev03be4502014-07-01 18:42:40 -070025tar --exclude .git -cf - ${NAME}_${VERSION} | gzip -n9c > ${NAME}_${VERSION}.orig.tar.gz
Alexander Afanasyevc5103862014-05-07 19:24:25 -070026
Alexander Afanasyev2c3726b2014-05-26 06:29:36 -070027source-build:
28 $(MAKE) _build DEBUILD="debuild -S -sa"
29
30build:
Alexander Afanasyevd02dfc62014-07-22 10:55:29 -070031 $(MAKE) _build DEBUILD=debuild DISTROS=trusty
Alexander Afanasyev2c3726b2014-05-26 06:29:36 -070032
33install: build
34 sudo dpkg -i work/*.deb
35
36_build: distro
Alexander Afanasyevc5103862014-05-07 19:24:25 -070037 \
38if test -z "$$DEBEMAIL" -o -z "$$DEBFULLNAME"; then \
39 echo "DEBFULLNAME and DEBEMAIL environmental variable should be set" ; \
40 echo "For example:" ; \
41 echo "export DEBEMAIL=\"my@emailaddress.com\"" ; \
42 echo "export DEBFULLNAME=\"Full Name\"" ;\
43 exit 1; \
44fi
45 \
Alexander Afanasyevb79a7b72014-05-08 22:16:35 -070046cd "work/${NAME}_${VERSION}" ; \
Alexander Afanasyevc5103862014-05-07 19:24:25 -070047for distro in ${DISTROS}; do \
48 NEW_VER="${VERSION}-ppa${PPA_VERSION}~$$distro"; \
49 rm -Rf debian ; cp -r ../../debian . ; \
50 sed -i -e "s/DISTRO/$$distro/g" debian/changelog ; \
51 if [ -f "debian/control.$$distro" ]; then \
52 mv "debian/control.$$distro" debian/control ; \
53 fi ; \
54 CUR_VER=`dpkg-parsechangelog | grep '^Version: ' | awk '{print $$2}'`; \
55 if dpkg --compare-versions $$NEW_VER gt $$CUR_VER; then \
56 echo "New version. Will update changelog and build source package" ; \
57 dch -v $$NEW_VER -D $$distro --force-distribution \
58 -u low "New version based on ${GIT_VERSION} (${GIT_URL})" ; \
59 else \
60 if dpkg --compare-versions $$NEW_VER ne $$CUR_VER; then \
61 echo "ERROR: Cannot rebuild source package, because new version is earlier \
62than the one specified in changelog ($$NEW_VER < $$CUR_VER)" ; \
63 exit 1; \
64 fi ; \
65 echo "Same version, just rebuild source package" ; \
66 fi ; \
67 ${DEBUILD} ; \
68done
69
Alexander Afanasyev2c3726b2014-05-26 06:29:36 -070070dput: source-build
Alexander Afanasyevc5103862014-05-07 19:24:25 -070071 \
72cd "work" ; \
73for distro in ${DISTROS}; do \
Alexander Afanasyev4ae71852014-07-22 13:44:40 -070074 dput -f "${PPA}" "${NAME}_${VERSION}-ppa${PPA_VERSION}~$$distro""_source.changes" ; \
Alexander Afanasyevc5103862014-05-07 19:24:25 -070075done ; \
76\
77cd .. ; \
78NEW_VER="${VERSION}-ppa${PPA_VERSION}~DISTRO"; \
79CUR_VER=`dpkg-parsechangelog | grep '^Version: ' | awk '{print $$2}'`; \
80if dpkg --compare-versions $$NEW_VER gt $$CUR_VER; then \
81 dch -v $$NEW_VER -D DISTRO --force-distribution \
82 -u low "New version based on ${GIT_VERSION} (${GIT_URL})" ; \
83fi
84
85clean:
86 @rm -Rf work