]> git.decadent.org.uk Git - odhcp6c.git/commitdiff
Add get-orig-source rule
authorBen Hutchings <ben@decadent.org.uk>
Sun, 21 Feb 2016 21:19:27 +0000 (21:19 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 21 Feb 2016 21:23:21 +0000 (21:23 +0000)
If run from the package git repository, use that to get the upstream
commit; otherwise make a temporary clone of upstream.

debian/rules

index afe0e45b1d5524aa05fed053dc74f0ed7e415023..150e99e617a5c2c78a02e3df2943e8c6abdbc6f7 100755 (executable)
@@ -9,3 +9,17 @@ override_dh_install:
                debian/odhcp6c/etc/ppp/ipv6-up.d/odhcp6c
        install -D -m755 debian/odhcp6c.ppp.ipv6-down \
                debian/odhcp6c/etc/ppp/ipv6-down.d/odhcp6c
+
+get-orig-source: UPSTREAM_VERSION := $(shell dpkg-parsechangelog -SVersion | sed 's/-[^-]*$$//')
+get-orig-source: UPSTREAM_COMMIT := $(shell dpkg-parsechangelog -SChanges -f $(UPSTREAM_VERSION) | sed -n 's/.*Upstream version is commit //p')
+get-orig-source:
+       test -n "$(UPSTREAM_VERSION)"
+       test -n "$(UPSTREAM_COMMIT)"
+       rm -rf debian/upstream.git
+       if [ -d .git ] && git cat-file -e $(UPSTREAM_COMMIT); then \
+               ln -s ../.git debian/upstream.git; \
+       else \
+               git clone --bare https://github.com/sbyx/odhcp6c debian/upstream.git; \
+       fi
+       GIT_DIR=debian/upstream.git git archive --format=tar --prefix=odhcp6c-$(UPSTREAM_VERSION)/ $(UPSTREAM_COMMIT) | xz -c > odhcp6c_$(UPSTREAM_VERSION).orig.tar.xz
+       rm -rf debian/upstream.git