Debian Codegraph @

debian/rules

raw
1 #!/usr/bin/make -f
2
3 include /usr/share/dpkg/pkg-info.mk # DEB_VERSION
4
5 GOPATH = $(CURDIR)/_build
6 GOCACHE = $(CURDIR)/_build/go-build
7 HOME = $(CURDIR)/_build/fakehome
8
9 # autopkgtest.ubuntu.com sets no_proxy env, however proxy_test.go will
10 # fail with that.
11 unexport no_proxy
12
13 %:
14 dh $@ --builddirectory=_build --buildsystem=golang
15
16 execute_after_dh_auto_configure:
17 # remove test files if nocheck is passed
18 ifeq (nocheck,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
19 rm -f \
20 $(CURDIR)/_build/src/github.com/go-git/go-git/v5/plumbing/transport/http/internal/test/test_utils.go \
21 $(CURDIR)/_build/src/github.com/go-git/go-git/v5/plumbing/transport/ssh/internal/test/test_utils.go \
22 $(CURDIR)/_build/src/github.com/go-git/go-git/v5/plumbing/transport/test/receive_pack.go \
23 $(CURDIR)/_build/src/github.com/go-git/go-git/v5/storage/test/storage_suite.go
24 endif
25
26 # "git daemon cannot be found"
27 # Debian doesn't have 'git daemon'
28 execute_before_dh_auto_test:
29 rm -fv $(CURDIR)/_build/src/github.com/go-git/go-git/v5/plumbing/transport/git/common_test.go
30 rm -fv $(CURDIR)/_build/src/github.com/go-git/go-git/v5/plumbing/transport/git/receive_pack_test.go # undefined: BaseSuite
31
32 override_dh_auto_test:
33 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
34 # writeable HOME directory with ~/.ssh/known_hosts and ~/.gitconfig is
35 # needed, as per .github/workflows/test.yml.
36 cp -r $(CURDIR)/debian/fakehome $(HOME)
37 # `go test` must be run manually, as debhelper will clear the HOME variable.
38 GOPATH=$(GOPATH) GOCACHE=$(GOCACHE) GO111MODULE=off GOPROXY=off GOTOOLCHAIN=local \
39 HOME=$(HOME) go test -vet=off -v -p 8 github.com/go-git/go-git/v5/...
40 endif
41
42 execute_after_dh_auto_test:
43 find _build -type d -name .tmp -print0 | xargs -0r rm -rf
44
45 # W: golang-github-go-git-go-git-v5-dev: executable-not-elf-or-script [usr/share/gocode/src/github.com/go-git/go-git/v5/internal/url/url_test.go]
46 execute_before_dh_auto_install:
47 find|grep url_test.go
48 chmod -v -x $(CURDIR)/_build/src/github.com/go-git/go-git/v5/internal/url/url_test.go
49
50 B = $(CURDIR)/debian/tmp/usr/bin
51 M = $(CURDIR)/debian/tmp/usr/share/man/man1
52
53 ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
54 execute_before_dh_installman-arch:
55 mkdir -pv $(M)
56 help2man --version-string="$(DEB_VERSION)" \
57 --no-info \
58 --name="Git implementation written in Go" \
59 --output $(M)/go-git.1 \
60 $(B)/go-git
61 endif