File: rules

package info (click to toggle)
golang-github-go-git-go-git 5.14.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,648 kB
  • sloc: makefile: 81; sh: 76
file content (61 lines) | stat: -rwxr-xr-x 2,334 bytes parent folder | download
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk # DEB_VERSION

GOPATH = $(CURDIR)/_build
GOCACHE = $(CURDIR)/_build/go-build
HOME = $(CURDIR)/_build/fakehome

# autopkgtest.ubuntu.com sets no_proxy env, however proxy_test.go will
# fail with that.
unexport no_proxy

%:
	dh $@ --builddirectory=_build --buildsystem=golang --with=golang

execute_after_dh_auto_configure:
	# remove test files if nocheck is passed
ifeq (nocheck,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	rm -f \
		$(CURDIR)/_build/src/github.com/go-git/go-git/plumbing/transport/http/internal/test/test_utils.go \
		$(CURDIR)/_build/src/github.com/go-git/go-git/plumbing/transport/ssh/internal/test/test_utils.go \
		$(CURDIR)/_build/src/github.com/go-git/go-git/plumbing/transport/test/receive_pack.go \
		$(CURDIR)/_build/src/github.com/go-git/go-git/storage/test/storage_suite.go
endif

# "git daemon cannot be found"
# Debian doesn't have 'git daemon'
execute_before_dh_auto_test:
	rm -fv $(CURDIR)/_build/src/github.com/go-git/go-git/plumbing/transport/git/common_test.go
	rm -fv $(CURDIR)/_build/src/github.com/go-git/go-git/plumbing/transport/git/receive_pack_test.go # undefined: BaseSuite

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	# writeable HOME directory with ~/.ssh/known_hosts and ~/.gitconfig is
	# needed, as per .github/workflows/test.yml.
	cp -r $(CURDIR)/debian/fakehome $(HOME)
	# `go test` must be run manually, as debhelper will clear the HOME variable.
	GOPATH=$(GOPATH) GOCACHE=$(GOCACHE) GO111MODULE=off GOPROXY=off GOTOOLCHAIN=local \
		HOME=$(HOME) go test -vet=off -v -p 8 github.com/go-git/go-git/...
endif

execute_after_dh_auto_test:
	find _build -type d -name .tmp -print0 | xargs -0r rm -rf

# W: golang-github-go-git-go-git-dev: executable-not-elf-or-script [usr/share/gocode/src/github.com/go-git/go-git/internal/url/url_test.go]
execute_before_dh_auto_install:
	find|grep url_test.go
	chmod -v -x $(CURDIR)/_build/src/github.com/go-git/go-git/internal/url/url_test.go

B = $(CURDIR)/debian/tmp/usr/bin
M = $(CURDIR)/debian/tmp/usr/share/man/man1

ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
execute_before_dh_installman-arch:
	mkdir -pv $(M)
	help2man --version-string="$(DEB_VERSION)" \
		--no-info \
		--name="Git implementation written in Go" \
		--output $(M)/go-git.1 \
		$(B)/go-git
endif