blob: 9d40d3d3f7d049cf09402abfcc12eb76e3c4b14a [file] [log] [blame]
Alexander Afanasyevc5103862014-05-07 19:24:25 -07001# PPA archive
2PPA=ppa:named-data/ppa
3
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
26build: distro
27 \
28if test -z "$$DEBEMAIL" -o -z "$$DEBFULLNAME"; then \
29 echo "DEBFULLNAME and DEBEMAIL environmental variable should be set" ; \
30 echo "For example:" ; \
31 echo "export DEBEMAIL=\"my@emailaddress.com\"" ; \
32 echo "export DEBFULLNAME=\"Full Name\"" ;\
33 exit 1; \
34fi
35 \
Alexander Afanasyevb79a7b72014-05-08 22:16:35 -070036cd "work/${NAME}_${VERSION}" ; \
Alexander Afanasyevc5103862014-05-07 19:24:25 -070037for distro in ${DISTROS}; do \
38 NEW_VER="${VERSION}-ppa${PPA_VERSION}~$$distro"; \
39 rm -Rf debian ; cp -r ../../debian . ; \
40 sed -i -e "s/DISTRO/$$distro/g" debian/changelog ; \
41 if [ -f "debian/control.$$distro" ]; then \
42 mv "debian/control.$$distro" debian/control ; \
43 fi ; \
44 CUR_VER=`dpkg-parsechangelog | grep '^Version: ' | awk '{print $$2}'`; \
45 if dpkg --compare-versions $$NEW_VER gt $$CUR_VER; then \
46 echo "New version. Will update changelog and build source package" ; \
47 dch -v $$NEW_VER -D $$distro --force-distribution \
48 -u low "New version based on ${GIT_VERSION} (${GIT_URL})" ; \
49 else \
50 if dpkg --compare-versions $$NEW_VER ne $$CUR_VER; then \
51 echo "ERROR: Cannot rebuild source package, because new version is earlier \
52than the one specified in changelog ($$NEW_VER < $$CUR_VER)" ; \
53 exit 1; \
54 fi ; \
55 echo "Same version, just rebuild source package" ; \
56 fi ; \
57 ${DEBUILD} ; \
58done
59
60dput: build
61 \
62cd "work" ; \
63for distro in ${DISTROS}; do \
64 dput "${PPA}" "${NAME}_${VERSION}-ppa${PPA_VERSION}~$$distro""_source.changes" ; \
65done ; \
66\
67cd .. ; \
68NEW_VER="${VERSION}-ppa${PPA_VERSION}~DISTRO"; \
69CUR_VER=`dpkg-parsechangelog | grep '^Version: ' | awk '{print $$2}'`; \
70if dpkg --compare-versions $$NEW_VER gt $$CUR_VER; then \
71 dch -v $$NEW_VER -D DISTRO --force-distribution \
72 -u low "New version based on ${GIT_VERSION} (${GIT_URL})" ; \
73fi
74
75clean:
76 @rm -Rf work