@@ -23,12 +23,15 @@ GO ?= go
23
23
GOBIN := $(shell $(GO ) env GOBIN)
24
24
GOOS ?= $(shell go env GOOS)
25
25
GOARCH ?= $(shell go env GOARCH)
26
+ GOPATH ?= $(shell go env GOPATH)
26
27
27
28
# N/B: This value is managed by Renovate, manual changes are
28
29
# possible, as long as they don't disturb the formatting
29
30
# (i.e. DO NOT ADD A 'v' prefix!)
30
31
GOLANGCI_LINT_VERSION := 1.55.2
31
32
33
+ GO_MD2MAN_VERSION := 2.0.3
34
+
32
35
ifeq ($(GOBIN ) ,)
33
36
GOBIN := $(GOPATH ) /bin
34
37
endif
82
85
CONTAINER_GOSRC = /src/github.com/containers/skopeo
83
86
CONTAINER_RUN ?= $(CONTAINER_CMD ) --security-opt label=disable -v $(CURDIR ) :$(CONTAINER_GOSRC ) -w $(CONTAINER_GOSRC ) $(SKOPEO_CIDEV_CONTAINER_FQIN )
84
87
85
- GIT_COMMIT := $(shell GIT_CEILING_DIRECTORIES=$$(cd ..; pwd ) git rev-parse HEAD 2> /dev/null || true)
88
+ GIT_COMMIT := $(shell GIT_CEILING_DIRECTORIES=$$(cd ..; pwd ) git rev-parse HEAD || true)
86
89
87
90
EXTRA_LDFLAGS ?=
88
91
SKOPEO_LDFLAGS := -ldflags '-X main.gitCommit=${GIT_COMMIT} $(EXTRA_LDFLAGS ) '
@@ -127,7 +130,8 @@ help:
127
130
128
131
# Do the build and the output (skopeo) should appear in current dir
129
132
binary : cmd/skopeo
130
- $(CONTAINER_RUN ) make bin/skopeo $(if $(DEBUG ) ,DEBUG=$(DEBUG ) ) BUILDTAGS=' $(BUILDTAGS)'
133
+ $(CONTAINER_RUN ) bash -c \
134
+ " git config --global --add safe.directory $( CONTAINER_GOSRC) && make bin/skopeo $( if $( DEBUG) ,DEBUG=$( DEBUG) ) BUILDTAGS='$( BUILDTAGS) '"
131
135
132
136
# Build w/o using containers
133
137
.PHONY : bin/skopeo
@@ -145,7 +149,8 @@ endif
145
149
docs : $(MANPAGES )
146
150
147
151
docs-in-container :
148
- ${CONTAINER_RUN} $(MAKE ) docs $(if $(DEBUG ) ,DEBUG=$(DEBUG ) )
152
+ ${CONTAINER_RUN} bash -c \
153
+ " git config --global --add safe.directory $( CONTAINER_GOSRC) && $( MAKE) docs $( if $( DEBUG) ,DEBUG=$( DEBUG) ) "
149
154
150
155
.PHONY : completions
151
156
completions : bin/skopeo
@@ -188,6 +193,9 @@ shell:
188
193
$(CONTAINER_RUN ) bash
189
194
190
195
tools :
196
+ if [ ! -x " $( GOBIN) /go-md2man" ]; then \
197
+ go install github.com/cpuguy83/go-md2man/v2@v$(GO_MD2MAN_VERSION ) ; \
198
+ fi
191
199
if [ ! -x " $( GOBIN) /golangci-lint" ]; then \
192
200
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN ) v$(GOLANGCI_LINT_VERSION ) ; \
193
201
fi
@@ -199,7 +207,8 @@ test-integration:
199
207
# --cap-add=cap_mknod is important to allow skopeo to use containers-storage: directly as it exists in the callers’ environment, without
200
208
# creating a nested user namespace (which requires /etc/subuid and /etc/subgid to be set up)
201
209
$(CONTAINER_CMD) --security-opt label=disable --cap-add=cap_mknod -v $(CURDIR):$(CONTAINER_GOSRC) -w $(CONTAINER_GOSRC) $(SKOPEO_CIDEV_CONTAINER_FQIN) \
202
- $(MAKE) test-integration-local
210
+ bash -c \
211
+ "git config --global --add safe.directory $(CONTAINER_GOSRC) && $(MAKE) test-integration-local"
203
212
204
213
205
214
# Intended for CI, assumed to be running in quay.io/libpod/skopeo_cidev container.
@@ -214,7 +223,8 @@ test-system:
214
223
-v $(CURDIR ) :$(CONTAINER_GOSRC ) -w $(CONTAINER_GOSRC ) \
215
224
-v $$ DTEMP:/var/lib/containers:Z -v /run/systemd/journal/socket:/run/systemd/journal/socket \
216
225
" $( SKOPEO_CIDEV_CONTAINER_FQIN) " \
217
- $(MAKE ) test-system-local; \
226
+ bash -c \
227
+ " git config --global --add safe.directory $( CONTAINER_GOSRC) && $( MAKE) test-system-local;" \
218
228
rc=$$? ; \
219
229
$(CONTAINER_RUNTIME ) unshare rm -rf $$ DTEMP; # This probably doesn't work with Docker, oh well, better than nothing... \
220
230
exit $$ rc
@@ -226,16 +236,18 @@ test-system-local: bin/skopeo
226
236
227
237
test-unit :
228
238
# Just call (make test unit-local) here instead of worrying about environment differences
229
- $(CONTAINER_RUN ) $(MAKE ) test-unit-local
239
+ $(CONTAINER_RUN ) bash -c \
240
+ " git config --global --add safe.directory $( CONTAINER_GOSRC) && $( MAKE) test-unit-local"
230
241
231
242
validate :
232
- $(CONTAINER_RUN ) $(MAKE ) validate-local
243
+ $(CONTAINER_RUN ) bash -c \
244
+ " git config --global --add safe.directory $( CONTAINER_GOSRC) && $( MAKE) validate-local"
233
245
234
246
# This target is only intended for development, e.g. executing it from an IDE. Use (make test) for CI or pre-release testing.
235
247
test-all-local : validate-local validate-docs test-unit-local
236
248
237
249
.PHONY : validate-local
238
- validate-local :
250
+ validate-local : tools
239
251
hack/validate-git-marks.sh
240
252
hack/validate-gofmt.sh
241
253
GOBIN=$(GOBIN ) hack/validate-lint.sh
0 commit comments