File: rules

package info (click to toggle)
docker.io 18.09.1+dfsg1-7.1+deb10u2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 65,584 kB
  • sloc: sh: 9,753; makefile: 827; ansic: 239; python: 162; asm: 10
file content (185 lines) | stat: -rwxr-xr-x 7,669 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

## Disable compiler cache (`go env GOCACHE`, `go help cache`).
export GOCACHE=off

export HOME=$(CURDIR)/debian/tmp

#export DH_GOLANG_BUILDPKG := github.com/docker/docker github.com/docker/cli
export DH_GOLANG_GO_GENERATE := 1
export DH_GOLANG_INSTALL_ALL := 1
export DH_GOLANG_INSTALL_EXTRA := testdata/
export DH_GOLANG_EXCLUDES := \
    integration-cli \
    vendor

# temporary build path (see http://golang.org/doc/code.html#GOPATH)
OUR_GOPATH := $(CURDIR)/.gopath
export GOPATH := $(OUR_GOPATH)

export DOCKER_VERSION := $(shell cat VERSION)
export DOCKER_GITCOMMIT := $(shell ./debian/helpers/gitcommit.sh $(DOCKER_VERSION))
ifndef DOCKER_GITCOMMIT
  $(error Missing DOCKER_GITCOMMIT - see debian/upstream-version-gitcommits)
endif

export BUILDTIME := $(shell dpkg-parsechangelog -SDate)

# have "make.sh" keep "bundle/$(DOCKER_VERSION)" around between runs (we clean it up appropriately ourselves)
export KEEPBUNDLE := 1

## AppArmor can be optionally used in Debian and is there by default in Ubuntu,
## so we need support for it compiled into our binary same story with SELinux.
export DOCKER_BUILDTAGS := apparmor seccomp selinux ambient

## prefer Go 1.7 explicitly if it's available (golang-1.7-go)
#export PATH := /usr/lib/go-1.7/bin:$(PATH)

APPARMOR_RECOMMENDS := $(shell dpkg-vendor --is Ubuntu && echo apparmor)
BUILT_LIBC := $(shell dpkg-query -f '$${source:Package} (= $${source:Version})' -W libc-dev-bin)

%:
	dh $@ --buildsystem=golang --with=bash-completion,golang --builddirectory=.gopath

override_dh_clean:
	dh_clean
	$(RM) -v -r autogen bundles man/man*/
#	-find . -type f -name '*.pb.go' -delete -printf 'removed %p\n'            ## delete generated .pb.go files
	## Remove Files-Excluded (when built from checkout or non-DFSG tarball):
	$(RM) -rv `perl -0nE 'say grep { $$_=q{ */}.$$_ } split(/\s+/,$$1) if m{^Files\-Excluded:\s*(.*?)(?:\n\n|^Files|^Comment:)}sm;' debian/copyright`
	-find */vendor -mindepth 1 -type d -empty -delete -printf 'removed %p\n'

override_dh_auto_configure:
## dh_auto_configure symlinks dirs from "/usr/share/gocode/src" into
## $(OUR_GOPATH) unless folders already exist there in which case files
## are copied. Pre-making directories allows us to use debhelper to
## create proper GOPATH source tree yet have certain directories writable
## even if they are provided by already installed package.
	mkdir -pv $(OUR_GOPATH)/src/github.com/docker/cli
	mkdir -pv $(OUR_GOPATH)/src/github.com/docker/docker
	mkdir -pv $(OUR_GOPATH)/src/github.com/docker/libnetwork
	mkdir -pv $(OUR_GOPATH)/src/github.com/docker/swarmkit
	mkdir -pv $(OUR_GOPATH)/src/github.com/docker/distribution
	mkdir -pv $(OUR_GOPATH)/src/github.com/docker/go-events
	mkdir -pv $(OUR_GOPATH)/src/github.com/docker/go-metrics
	mkdir -pv $(OUR_GOPATH)/src/github.com/containerd/containerd

#	## Prepare builddirectory but throw away sourcedirectory.
	DH_GOPKG="__IGNORE__" dh_auto_configure

## Each package must be removed from working tree first, in case some
## of the packages that we are going to build are already installed.
## This is also useful for building in unclean environment.
##
## This is _necessary_ to avoid merging packages that we build with
## pre-installed packages. See #827226 for details.
## Debhelper knows only about "main" DH_GOPKG package but we build several
## and we have to ensure that build tree is properly prepared.
	$(RM) -r              $(OUR_GOPATH)/src/github.com/docker/cli
	cp -ra  cli           $(OUR_GOPATH)/src/github.com/docker/cli

	$(RM) -r              $(OUR_GOPATH)/src/github.com/docker/docker
	cp -ra  engine        $(OUR_GOPATH)/src/github.com/docker/docker

	$(RM) -r              $(OUR_GOPATH)/src/github.com/docker/libnetwork
	cp -ra  libnetwork    $(OUR_GOPATH)/src/github.com/docker/libnetwork

	$(RM) -r              $(OUR_GOPATH)/src/github.com/docker/swarmkit
	cp -ra  swarmkit      $(OUR_GOPATH)/src/github.com/docker/swarmkit

	$(RM) -r              $(OUR_GOPATH)/src/github.com/docker/distribution
	cp -ra  distribution  $(OUR_GOPATH)/src/github.com/docker/distribution

	$(RM) -r              $(OUR_GOPATH)/src/github.com/docker/go-events
	cp -ra  go-events     $(OUR_GOPATH)/src/github.com/docker/go-events

	$(RM) -r              $(OUR_GOPATH)/src/github.com/docker/go-metrics
	cp -ra  go-metrics    $(OUR_GOPATH)/src/github.com/docker/go-metrics

	$(RM) -r              $(OUR_GOPATH)/src/github.com/containerd/containerd
	cp -ra  containerd    $(OUR_GOPATH)/src/github.com/containerd/containerd

#	cp -ra  containerd/vendor/github.com/containerd/continuity    $(OUR_GOPATH)/src/github.com/containerd/
#	cp -ra  engine/vendor/github.com/docker/distribution          $(OUR_GOPATH)/src/github.com/docker/

override_dh_auto_build-indep:
	# noop

override_dh_auto_build-arch:
## order is important:

##	## FIXME: DH_GOLANG_BUILDPKG --> DH_GOPKG
	DH_GOLANG_BUILDPKG="github.com/docker/distribution"    dh_auto_build -v

	DH_GOPKG="github.com/docker/libnetwork"                dh_auto_build -v

##	## FIXME: DH_GOLANG_BUILDPKG --> DH_GOPKG
	DH_GOLANG_BUILDPKG="github.com/docker/swarmkit"        dh_auto_build -v

	export DH_GOPKG="github.com/containerd/containerd" ;\
        export REV="`grep $${DH_GOPKG} engine/vendor.conf | head -1 | awk '{print $$2}'`" ;\
        dh_auto_build -v -- -tags "$(DOCKER_BUILDTAGS)" \
          -ldflags "-X $${DH_GOPKG}/version.Version=$(DOCKER_VERSION) -X $${DH_GOPKG}/version.Revision=$${REV}"

	DH_GOPKG="github.com/docker/go-events"                 dh_auto_build -v
	DH_GOPKG="github.com/docker/go-metrics"                dh_auto_build -v
	
##	build ("cd" first to ensure we build from within GOPATH)
	cd '$(OUR_GOPATH)/src/github.com/docker/docker' \
        && VERSION=$(DOCKER_VERSION) ./hack/make.sh dynbinary
	
	cd '$(OUR_GOPATH)/src/github.com/docker/cli' \
        && DISABLE_WARN_OUTSIDE_CONTAINER=1 LDFLAGS='' \
           $(MAKE) VERSION=$(DOCKER_VERSION) GITCOMMIT=$(DOCKER_GITCOMMIT) dynbinary manpages
	
#	# compile man pages
#	./man/md2man-all.sh -q

override_dh_auto_test-indep:
	DH_GOLANG_EXCLUDES="integration-cli integration test/integration" \
        dh_auto_test -v --max-parallel=4 -- -short

override_dh_auto_test-arch:
###     [[[ DO NOT DISABLE TESTS ]]]  [[[ DO *NOT* DISABLE TESTS ]]]
	DH_GOLANG_EXCLUDES="integration-cli integration test/integration" \
        dh_auto_test -v --max-parallel=4 -- -short
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	## Test engine:
#	cd '$(OUR_GOPATH)/src/$(DH_GOPKG)' \
#        && TESTFLAGS='-test.short' ./hack/make.sh test-unit
	cd $(OUR_GOPATH)/src/github.com/docker/docker \
        && TESTFLAGS='-test.short' ./hack/test/unit

	## Test CLI:
	cd $(OUR_GOPATH)/src/github.com/docker/cli \
        && DISABLE_WARN_OUTSIDE_CONTAINER=1 $(MAKE) test-unit

	.gopath/bin/containerd -version
endif

override_dh_install:
	## Do not install extra license files:
	dh_install -XLICENSE

override_dh_auto_install:
	## skip dh_auto_install to stop dh_golang trying to copy bits
	## for /usr/share/gocode (we use dh_install/dh-exec for that)

override_dh_installinit:
	dh_installinit -v --name=docker --no-stop-on-upgrade --no-restart-after-upgrade

override_dh_installsystemd:
	dh_installsystemd -v --name=docker --no-stop-on-upgrade --no-restart-after-upgrade

override_dh_installudev:
	# use priority z80 to match the upstream priority of 80
	dh_installudev -v --name=docker --priority=z80

override_dh_gencontrol:
	echo 'apparmor:Recommends=$(APPARMOR_RECOMMENDS)' >> debian/docker.io.substvars
	echo 'libc:Built-Using=$(BUILT_LIBC)' >> debian/docker.io.substvars
	dh_gencontrol