blob: 90429d4a22ec991d856da46d522323f0c4a77733 [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
7DEBUILD=debuild -S -sa
8
9all: _phony
10
11_phony:
12
13distro: work/${NAME}
14
15work/${NAME}:
16 \
17mkdir work || true ; \
18cd work ; \
19git clone --recursive "${GIT_URL}" "${NAME}" ; \
20cd "${NAME}" ; \
21git checkout "${GIT_VERSION}" ; \
22git archive --format=tar.gz --prefix=${NAME}_${VERSION}/ \
23 -o ../${NAME}_${VERSION}.orig.tar.gz HEAD
24
25build: distro
26 \
27if test -z "$$DEBEMAIL" -o -z "$$DEBFULLNAME"; then \
28 echo "DEBFULLNAME and DEBEMAIL environmental variable should be set" ; \
29 echo "For example:" ; \
30 echo "export DEBEMAIL=\"my@emailaddress.com\"" ; \
31 echo "export DEBFULLNAME=\"Full Name\"" ;\
32 exit 1; \
33fi
34 \
35cd "work/${NAME}" ; \
36for distro in ${DISTROS}; do \
37 NEW_VER="${VERSION}-ppa${PPA_VERSION}~$$distro"; \
38 rm -Rf debian ; cp -r ../../debian . ; \
39 sed -i -e "s/DISTRO/$$distro/g" debian/changelog ; \
40 if [ -f "debian/control.$$distro" ]; then \
41 mv "debian/control.$$distro" debian/control ; \
42 fi ; \
43 CUR_VER=`dpkg-parsechangelog | grep '^Version: ' | awk '{print $$2}'`; \
44 if dpkg --compare-versions $$NEW_VER gt $$CUR_VER; then \
45 echo "New version. Will update changelog and build source package" ; \
46 dch -v $$NEW_VER -D $$distro --force-distribution \
47 -u low "New version based on ${GIT_VERSION} (${GIT_URL})" ; \
48 else \
49 if dpkg --compare-versions $$NEW_VER ne $$CUR_VER; then \
50 echo "ERROR: Cannot rebuild source package, because new version is earlier \
51than the one specified in changelog ($$NEW_VER < $$CUR_VER)" ; \
52 exit 1; \
53 fi ; \
54 echo "Same version, just rebuild source package" ; \
55 fi ; \
56 ${DEBUILD} ; \
57done
58
59dput: build
60 \
61cd "work" ; \
62for distro in ${DISTROS}; do \
63 dput "${PPA}" "${NAME}_${VERSION}-ppa${PPA_VERSION}~$$distro""_source.changes" ; \
64done ; \
65\
66cd .. ; \
67NEW_VER="${VERSION}-ppa${PPA_VERSION}~DISTRO"; \
68CUR_VER=`dpkg-parsechangelog | grep '^Version: ' | awk '{print $$2}'`; \
69if dpkg --compare-versions $$NEW_VER gt $$CUR_VER; then \
70 dch -v $$NEW_VER -D DISTRO --force-distribution \
71 -u low "New version based on ${GIT_VERSION} (${GIT_URL})" ; \
72fi
73
74clean:
75 @rm -Rf work