1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#!/usr/bin/make -f
export DH_OPTIONS
export DH_GOPKG := github.com/rcrowley/go-metrics
%:
dh $@ --buildsystem=golang --with=golang
override_dh_auto_configure:
[ ! -d stathat ] || mv stathat debian/stathat-moved
dh_auto_configure
override_dh_clean:
[ ! -d debian/stathat-moved ] || mv debian/stathat-moved stathat
dh_clean
override_dh_auto_install:
dh_auto_install
rm -rf debian/golang-metrics-dev/usr/bin
.PHONY: get-orig-source
PKD = $(abspath $(dir $(MAKEFILE_LIST)))
PKG = $(word 2,$(shell dpkg-parsechangelog -l$(PKD)/changelog | grep ^Source))
VER ?= $(shell dpkg-parsechangelog -l$(PKD)/changelog | perl -ne 'print $$1 if m{^Version:\s+(?:\d+:)?(\d.*)(?:\-\d+.*)};')
UDATE= $(shell TZ=UTC date --rfc-3339=seconds --date='$(shell echo $(VER) | perl -ne 'print "$$1-$$2-$$3" if m/~git(\d{4})(\d{2})(\d{2})$$/')')
get-orig-source: $(PKG)_$(VER).orig.tar.xz $(info I: $(PKG)_$(VER))
$(PKG)_$(VER).orig.tar.xz:
GOPATH=$(PKG)-$(VER) go get -d $(DH_GOPKG)
cd $(PKG)-$(VER)/src/$(DH_GOPKG) \
&& git checkout $$(git log -n1 --format=%h --before="$(UDATE)") \
&& git archive --prefix $(PKG)-$(VER)/ HEAD > $(PKG)-$(VER).tar \
&& xz $(PKG)-$(VER).tar
mv $(PKG)-$(VER)/src/$(DH_GOPKG)/$(PKG)-$(VER).tar.xz $@
rm -rf $(PKG)-$(VER)
|