❦  1 septembre 2013 11:46 CEST, Vincent Bernat <ber...@debian.org> :

> Since "go get" seems to be able to find the appropriate sources, it
> would be convenient to provide an automatic "get-orig-source"
> target. I don't know debhelper enough to know if it is something
> possible (a custom target).
>
> Another difficulty is that "go get" does not seem a way to request an
> exact git/hg tag. But since it clones the whole repository, this can
> be worked around but we will need to support several VCS (or patch "go
> get"?).

As an example, here is what I use:

.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+.*)};')
REV  = $(shell echo $(VER) | perl -ne 'print $$1 if m/~hg(\d+)$$/')
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) \
        && hg archive -r $(REV) $(PKG)-$(VER).tar \
        && xz $(PKG)-$(VER).tar
        mv $(PKG)-$(VER)/src/$(DH_GOPKG)/$(PKG)-$(VER).tar.xz $@
        rm -rf $(PKG)-$(VER)

Only one line is VCS specific (and one regular expression that could be
tweaked to be generic).
-- 
panic ("Splunge!");
        2.2.16 /usr/src/linux/drivers/scsi/psi240i.c

Attachment: signature.asc
Description: PGP signature

Reply via email to