From d8c42de4121f5c2088db5a492ce600d0b99f8e75 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 13 Apr 2022 16:15:09 -0700 Subject: [PATCH 01/10] Makefile: rm .install.libseccomp.sudo target This was originally added in commit a824186ac9803ef to be used from Travis CI. Travis was removed in commit 8771a03af1f17f and there is no need to have this target ever since (October 2018). Also, remove the comment about BUILD_TAGS, which originally belonged to varlink target (removed by commit f62a356515e387b0) but got misplaced later. Signed-off-by: Kir Kolyshkin --- Makefile | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Makefile b/Makefile index 3f9d56025d..f6d0aab4fd 100644 --- a/Makefile +++ b/Makefile @@ -887,13 +887,6 @@ install.tools: .install.ginkgo .install.golangci-lint .install.bats ## Install n python3 -m pip install --user pre-commit; \ fi -# $BUILD_TAGS variable is used in hack/golangci-lint.sh -.PHONY: install.libseccomp.sudo -install.libseccomp.sudo: - rm -rf ../../seccomp/libseccomp - git clone https://github.com/seccomp/libseccomp ../../seccomp/libseccomp - cd ../../seccomp/libseccomp && git checkout --detach $(LIBSECCOMP_COMMIT) && ./autogen.sh && ./configure --prefix=/usr && make all && make install - .PHONY: uninstall uninstall: for i in $(filter %.1,$(MANPAGES_DEST)); do \ From e2d2b537affada35a0f38dbda0d57361e57bcb05 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 13 Apr 2022 16:31:49 -0700 Subject: [PATCH 02/10] Makefile: rm .gopathok Since about Go 1.10 (or whereabouts) the specific package structure is no longer required. This also removes GOPKGDIR and GOPKGBASEDIR as they were only used by gopathok. Signed-off-by: Kir Kolyshkin --- Makefile | 44 +++++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index f6d0aab4fd..df7afcaf79 100644 --- a/Makefile +++ b/Makefile @@ -126,8 +126,6 @@ export GOPATH := $(HOME)/go unexport GOBIN endif FIRST_GOPATH := $(firstword $(subst :, ,$(GOPATH))) -GOPKGDIR := $(FIRST_GOPATH)/src/$(PROJECT) -GOPKGBASEDIR ?= $(shell dirname "$(GOPKGDIR)") GOBIN := $(shell $(GO) env GOBIN) ifeq ($(GOBIN),) @@ -223,15 +221,8 @@ help: ## (Default) Print listing of key targets with their descriptions ### Linting/Formatting/Code Validation targets ### -.gopathok: -ifeq ("$(wildcard $(GOPKGDIR))","") - mkdir -p "$(GOPKGBASEDIR)" - ln -sfn "$(CURDIR)" "$(GOPKGDIR)" -endif - touch $@ - .PHONY: .gitvalidation -.gitvalidation: .gopathok +.gitvalidation: @echo "Validating vs commit '$(call err_if_empty,EPOCH_TEST_COMMIT)'" GIT_CHECK_EXCLUDE="./vendor:./test/tools/vendor:docs/make.bat:test/buildah-bud/buildah-tests.diff" ./test/tools/build/git-validation -run DCO,short-subject,dangling-whitespace -range $(EPOCH_TEST_COMMIT)..$(HEAD) @@ -245,7 +236,7 @@ endif $(PRE_COMMIT) run -a .PHONY: golangci-lint -golangci-lint: .gopathok .install.golangci-lint +golangci-lint: .install.golangci-lint hack/golangci-lint.sh run .PHONY: gofmt @@ -261,11 +252,11 @@ gofmt: ## Verify the source code gofmt git diff --exit-code .PHONY: test/checkseccomp/checkseccomp -test/checkseccomp/checkseccomp: .gopathok $(wildcard test/checkseccomp/*.go) +test/checkseccomp/checkseccomp: $(wildcard test/checkseccomp/*.go) $(GOCMD) build $(BUILDFLAGS) $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' -tags "$(BUILDTAGS)" -o $@ ./test/checkseccomp .PHONY: test/testvol/testvol -test/testvol/testvol: .gopathok $(wildcard test/testvol/*.go) +test/testvol/testvol: $(wildcard test/testvol/*.go) $(GOCMD) build $(BUILDFLAGS) $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' -o $@ ./test/testvol .PHONY: volume-plugin-test-image @@ -273,10 +264,10 @@ volume-plugin-test-img: podman build -t quay.io/libpod/volume-plugin-test-img -f Containerfile-testvol . .PHONY: test/goecho/goecho -test/goecho/goecho: .gopathok $(wildcard test/goecho/*.go) +test/goecho/goecho: $(wildcard test/goecho/*.go) $(GOCMD) build $(BUILDFLAGS) $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' -o $@ ./test/goecho -test/version/version: .gopathok version/version.go +test/version/version: version/version.go $(GO) build -o $@ ./test/version/ .PHONY: codespell @@ -309,7 +300,7 @@ vendor-in-container: ### # Make sure to warn in case we're building without the systemd buildtag. -bin/podman: .gopathok $(SOURCES) go.mod go.sum +bin/podman: $(SOURCES) go.mod go.sum ifeq (,$(findstring systemd,$(BUILDTAGS))) @echo "Podman is being compiled without the systemd build tag. \ Install libsystemd on Ubuntu or systemd-devel on rpm based \ @@ -325,14 +316,14 @@ endif $(SRCBINDIR): mkdir -p $(SRCBINDIR) -$(SRCBINDIR)/podman$(BINSFX): $(SRCBINDIR) .gopathok $(SOURCES) go.mod go.sum +$(SRCBINDIR)/podman$(BINSFX): $(SRCBINDIR) $(SOURCES) go.mod go.sum $(GOCMD) build \ $(BUILDFLAGS) \ $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' \ -tags "${REMOTETAGS}" \ -o $@ ./cmd/podman -$(SRCBINDIR)/podman-remote-static: $(SRCBINDIR) .gopathok $(SOURCES) go.mod go.sum +$(SRCBINDIR)/podman-remote-static: $(SRCBINDIR) $(SOURCES) go.mod go.sum CGO_ENABLED=0 \ GOOS=$(GOOS) \ GOARCH=$(GOARCH) \ @@ -368,7 +359,7 @@ podman-remote-windows: ## Build podman-remote for Windows bin/windows/podman.exe .PHONY: podman-winpath -podman-winpath: .gopathok $(SOURCES) go.mod go.sum +podman-winpath: $(SOURCES) go.mod go.sum CGO_ENABLED=0 \ GOOS=windows \ $(GO) build \ @@ -395,7 +386,7 @@ podman-mac-helper: ## Build podman-mac-helper for macOS -o bin/darwin/podman-mac-helper \ ./cmd/podman-mac-helper -bin/rootlessport: .gopathok $(SOURCES) go.mod go.sum +bin/rootlessport: $(SOURCES) go.mod go.sum CGO_ENABLED=$(CGO_ENABLED) \ $(GO) build \ $(BUILDFLAGS) \ @@ -415,7 +406,7 @@ ifneq ($(GOOS),darwin) endif # DO NOT USE: use local-cross instead -bin/podman.cross.%: .gopathok +bin/podman.cross.%: TARGET="$*"; \ GOOS="$${TARGET%%.*}"; \ GOARCH="$${TARGET##*.}"; \ @@ -455,7 +446,7 @@ completions: podman podman-remote ### Documentation targets ### -pkg/api/swagger.yaml: .gopathok +pkg/api/swagger.yaml: make -C pkg/api $(MANPAGES): %: %.md .install.md2man docdir @@ -759,7 +750,7 @@ package-install: package ## Install rpm packages /usr/bin/podman info # will catch a broken conmon .PHONY: install -install: .gopathok install.bin install.remote install.man install.systemd ## Install binaries to system locations +install: install.bin install.remote install.man install.systemd ## Install binaries to system locations .PHONY: install.catatonit install.catatonit: @@ -862,13 +853,13 @@ install.tools: .install.ginkgo .install.golangci-lint .install.bats ## Install n make -C test/tools .PHONY: .install.ginkgo -.install.ginkgo: .gopathok +.install.ginkgo: if [ ! -x "$(GOBIN)/ginkgo" ]; then \ $(GO) install $(BUILDFLAGS) ./vendor/github.com/onsi/ginkgo/ginkgo ; \ fi .PHONY: .install.golangci-lint -.install.golangci-lint: .gopathok +.install.golangci-lint: VERSION=1.45.2 GOBIN=$(GOBIN) ./hack/install_golangci.sh .PHONY: .install.md2man @@ -878,7 +869,7 @@ install.tools: .install.ginkgo .install.golangci-lint .install.bats ## Install n fi .PHONY: .install.bats -.install.bats: .gopathok +.install.bats: VERSION=v1.1.0 ./hack/install_bats.sh .PHONY: .install.pre-commit @@ -917,7 +908,6 @@ clean-binaries: ## Remove platform/architecture specific binary files .PHONY: clean clean: clean-binaries ## Clean all make artifacts rm -rf \ - .gopathok \ _output \ $(wildcard podman-*.msi) \ $(wildcard podman-remote*.zip) \ From c63bb6b9a8a9d18d661f10c1a2a6884258180fae Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Mon, 16 May 2022 16:55:09 -0700 Subject: [PATCH 03/10] Makefile,.gitignore: rm .install.goimports Recent commit 3b9177995e0124beb064ef8615ba9a2ae7ca4f4b removes this target, but some artifacts remain. Remove those. Fixes: 3b9177995e0124beb064ef8615ba9a2ae7ca4f4b Signed-off-by: Kir Kolyshkin --- .gitignore | 1 - Makefile | 1 - 2 files changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index f6eee2fe0c..e1eaee2ce9 100644 --- a/.gitignore +++ b/.gitignore @@ -39,5 +39,4 @@ tags result # Necessary to prevent hack/tree-status.sh false-positive /*runner_stats.log -.install.goimports .generate-bindings diff --git a/Makefile b/Makefile index df7afcaf79..8932214e48 100644 --- a/Makefile +++ b/Makefile @@ -923,7 +923,6 @@ clean: clean-binaries ## Clean all make artifacts libpod/pod_ffjson.go \ libpod/container_easyjson.go \ libpod/pod_easyjson.go \ - .install.goimports \ docs/build \ .venv make -C docs clean From 11d3cf26977538b1ee20ea331e0f14e995d7f550 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 13 Apr 2022 17:13:45 -0700 Subject: [PATCH 04/10] Makefile, podman.spec.rpkg: rm GOBIN and GOPATH Remove GOPATH setting as since Go 1.9 it defaults to $HOME/go (for earlier versions it had to be specified explicitly). Remove GOPATH-related code from the spec, using relative paths when compiling packages, and enable Go modules, simplifying the spec. Remove support for multiple paths in GOPATH (which is rarely used and doesn't really work with modules). Remove setting GOBIN, rely on $GOPATH/bin instead. In case GOBIN is explicitly set (which is highly unlikely), forcefully ignore by unsetting it. Remove GOBIN from tools invocation since we added GOPATH/bin to PATH. Signed-off-by: Kir Kolyshkin --- .cirrus.yml | 1 - Makefile | 30 +++++++++--------------------- podman.spec.rpkg | 28 ++++++---------------------- 3 files changed, 15 insertions(+), 44 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 324fd32f6e..eed12b02f6 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -9,7 +9,6 @@ env: DEST_BRANCH: "main" # Overrides default location (/tmp/cirrus) for repo clone GOPATH: &gopath "/var/tmp/go" - GOBIN: "${GOPATH}/bin" GOCACHE: "${GOPATH}/cache" GOSRC: &gosrc "/var/tmp/go/src/github.com/containers/podman" CIRRUS_WORKING_DIR: *gosrc diff --git a/Makefile b/Makefile index 8932214e48..ff3e69087e 100644 --- a/Makefile +++ b/Makefile @@ -120,20 +120,10 @@ RELEASE_NUMBER = $(shell echo "$(RELEASE_VERSION)" | sed -e 's/^v\(.*\)/\1/') # If non-empty, logs all output from server during remote system testing PODMAN_SERVER_LOG ?= -# If GOPATH not specified, use one in the local directory -ifeq ($(GOPATH),) -export GOPATH := $(HOME)/go -unexport GOBIN -endif -FIRST_GOPATH := $(firstword $(subst :, ,$(GOPATH))) - -GOBIN := $(shell $(GO) env GOBIN) -ifeq ($(GOBIN),) -GOBIN := $(FIRST_GOPATH)/bin -endif - +# Ensure GOBIN is not set so the default (`go env GOPATH`/bin) is used. +override undefine GOBIN # This must never include the 'hack' directory -export PATH := $(PATH):$(GOBIN) +export PATH := $(shell $(GO) env GOPATH)/bin:$(PATH) GOMD2MAN ?= $(shell command -v go-md2man || echo './test/tools/build/go-md2man') @@ -522,7 +512,7 @@ run-docker-py-tests: .PHONY: localunit localunit: test/goecho/goecho test/version/version rm -rf ${COVERAGE_PATH} && mkdir -p ${COVERAGE_PATH} - UNIT=1 $(GOBIN)/ginkgo \ + UNIT=1 ginkgo \ -r \ $(TESTFLAGS) \ --skipPackage test/e2e,pkg/apparmor,pkg/bindings,hack,pkg/machine/e2e \ @@ -541,8 +531,8 @@ test: localunit localintegration remoteintegration localsystem remotesystem ## .PHONY: ginkgo-run ginkgo-run: - ACK_GINKGO_RC=true $(GOBIN)/ginkgo version - ACK_GINKGO_RC=true $(GOBIN)/ginkgo -v $(TESTFLAGS) -tags "$(TAGS)" $(GINKGOTIMEOUT) -cover -flakeAttempts 3 -progress -trace -noColor -nodes 3 -debug test/e2e/. $(HACK) + ACK_GINKGO_RC=true ginkgo version + ACK_GINKGO_RC=true ginkgo -v $(TESTFLAGS) -tags "$(TAGS)" $(GINKGOTIMEOUT) -cover -flakeAttempts 3 -progress -trace -noColor -nodes 3 -debug test/e2e/. $(HACK) .PHONY: ginkgo ginkgo: @@ -560,7 +550,7 @@ remoteintegration: test-binaries ginkgo-remote .PHONY: localbenchmarks localbenchmarks: test-binaries - PATH=$(PATH):$(shell pwd)/hack ACK_GINKGO_RC=true $(GOBIN)/ginkgo \ + PATH=$(PATH):$(shell pwd)/hack ACK_GINKGO_RC=true ginkgo \ -focus "Podman Benchmark Suite" \ -tags "$(BUILDTAGS) benchmarks" -noColor \ -noisySkippings=false -noisyPendings=false \ @@ -854,13 +844,11 @@ install.tools: .install.ginkgo .install.golangci-lint .install.bats ## Install n .PHONY: .install.ginkgo .install.ginkgo: - if [ ! -x "$(GOBIN)/ginkgo" ]; then \ - $(GO) install $(BUILDFLAGS) ./vendor/github.com/onsi/ginkgo/ginkgo ; \ - fi + $(GO) install $(BUILDFLAGS) ./vendor/github.com/onsi/ginkgo/ginkgo .PHONY: .install.golangci-lint .install.golangci-lint: - VERSION=1.45.2 GOBIN=$(GOBIN) ./hack/install_golangci.sh + VERSION=1.45.2 ./hack/install_golangci.sh .PHONY: .install.md2man .install.md2man: diff --git a/podman.spec.rpkg b/podman.spec.rpkg index 9372539187..199c691f8a 100644 --- a/podman.spec.rpkg +++ b/podman.spec.rpkg @@ -13,17 +13,9 @@ %endif %if ! 0%{?gobuild:1} -%define gobuild(o:) GO111MODULE=off go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '" -a -v -x %{?**}; +%define gobuild(o:) go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '" -a -v -x %{?**}; %endif -%global provider github -%global provider_tld com -%global project containers -%global repo %{name} -# https://github.com/containers/%%{name} -%global import_path %{provider}.%{provider_tld}/%{project}/%{repo} -%global git0 https://%{import_path} - # git_dir_name returns repository name derived from remote Git repository URL Name: {{{ git_dir_name }}} @@ -156,8 +148,7 @@ connections as well. # This will invoke `make` command in the directory with the extracted sources. %build %set_build_flags -export GO111MODULE=off -export GOPATH=$(pwd)/_build:$(pwd) +%global gomodulesmode GO111MODULE=on export CGO_CFLAGS=$CFLAGS # These extra flags present in $CFLAGS have been skipped for now as they break the build CGO_CFLAGS=$(echo $CGO_CFLAGS | sed 's/-flto=auto//g') @@ -168,33 +159,26 @@ CGO_CFLAGS=$(echo $CGO_CFLAGS | sed 's/-specs=\/usr\/lib\/rpm\/redhat\/redhat-an export CGO_CFLAGS+=" -m64 -mtune=generic -fcf-protection=full" %endif -mkdir _build -pushd _build -mkdir -p src/%{provider}.%{provider_tld}/%{project} -ln -s ../../../../ src/%{import_path} -popd -ln -s vendor src - %if 0%{?rhel} rm -rf vendor/github.com/containers/storage/drivers/register/register_btrfs.go %endif # build date. FIXME: Makefile uses '/v2/libpod', that doesn't work here? -LDFLAGS="-X %{import_path}/libpod/define.buildInfo=$(date +%s)" +LDFLAGS="-X ./libpod/define.buildInfo=$(date +%s)" # build rootlessport first -%gobuild -o bin/rootlessport %{import_path}/cmd/rootlessport +%gobuild -o bin/rootlessport ./cmd/rootlessport # set base buildtags common to both %%{name} and %%{name}-remote export BASEBUILDTAGS="seccomp exclude_graphdriver_devicemapper $(hack/selinux_tag.sh) $(hack/systemd_tag.sh) $(hack/libsubid_tag.sh)" # build %%{name} export BUILDTAGS="$BASEBUILDTAGS $(hack/btrfs_installed_tag.sh) $(hack/btrfs_tag.sh)" -%gobuild -o bin/%{name} %{import_path}/cmd/%{name} +%gobuild -o bin/%{name} ./cmd/%{name} # build %%{name}-remote export BUILDTAGS="$BASEBUILDTAGS exclude_graphdriver_btrfs btrfs_noversion remote" -%gobuild -o bin/%{name}-remote %{import_path}/cmd/%{name} +%gobuild -o bin/%{name}-remote ./cmd/%{name} make docs docker-docs From 2b54bf3e64f1969dea1fac79365d0b84aa6714a9 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 13 Apr 2022 17:24:32 -0700 Subject: [PATCH 05/10] Move GOPROXY from Makefile to cirrus.yml GOPROXY's default value is "https://proxy.golang.org,direct" since go 1.13, so it is redundant to set it explicitly. For some reason though, GOPROXY in Cirrus CI is set to direct, which makes things such as go mod tidy very slow. So, set the proper (default) value for in in .cirrus.yml. Do the same for GOSUMDB. Signed-off-by: Kir Kolyshkin --- .cirrus.yml | 3 +++ Makefile | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index eed12b02f6..ee01312796 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -7,6 +7,9 @@ env: #### # Name of the ultimate destination branch for this CI run, PR or post-merge. DEST_BRANCH: "main" + # Sane (default) value for GOPROXY and GOSUMDB. + GOPROXY: "https://proxy.golang.org,direct" + GOSUMDB: "sum.golang.org" # Overrides default location (/tmp/cirrus) for repo clone GOPATH: &gopath "/var/tmp/go" GOCACHE: "${GOPATH}/cache" diff --git a/Makefile b/Makefile index ff3e69087e..57b8035be7 100644 --- a/Makefile +++ b/Makefile @@ -20,8 +20,6 @@ ### Variables & Definitions ### -export GOPROXY=https://proxy.golang.org - GO ?= go GO_LDFLAGS:= $(shell if $(GO) version|grep -q gccgo ; then echo "-gccgoflags"; else echo "-ldflags"; fi) GOCMD = CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) GOARCH=$(GOARCH) $(GO) From d2070a39eaf94185489deee1ca0f8a8640c6f959 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 13 Apr 2022 17:26:10 -0700 Subject: [PATCH 06/10] Makefile: rm -mod=vendor "go build" no longer requires explicit "-mod=vendor", as this is the default since go 1.14. Signed-off-by: Kir Kolyshkin --- Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Makefile b/Makefile index 57b8035be7..6452b6c1e1 100644 --- a/Makefile +++ b/Makefile @@ -67,8 +67,6 @@ PRE_COMMIT = $(shell command -v bin/venv/bin/pre-commit ~/.local/bin/pre-commit # triggered. SOURCES = $(shell find . -path './.*' -prune -o \( \( -name '*.go' -o -name '*.c' \) -a ! -name '*_test.go' \) -print) -BUILDFLAGS := -mod=vendor $(BUILDFLAGS) - BUILDTAGS_CROSS ?= containers_image_openpgp exclude_graphdriver_btrfs exclude_graphdriver_devicemapper exclude_graphdriver_overlay CONTAINER_RUNTIME := $(shell command -v podman 2> /dev/null || echo docker) OCI_RUNTIME ?= "" From 9bf81814a2a5fb4ecda9856d32e6cbd0f8f83644 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 13 Apr 2022 17:28:27 -0700 Subject: [PATCH 07/10] Makefile: rm CHANGELOG_* and ISODATE vars Those are not used since commit 0d1ba0a58fdb15af7e. Fixes: 0d1ba0a58fdb15af7 Signed-off-by: Kir Kolyshkin --- Makefile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Makefile b/Makefile index 6452b6c1e1..b0b3dd5f49 100644 --- a/Makefile +++ b/Makefile @@ -27,8 +27,6 @@ COVERAGE_PATH ?= .coverage DESTDIR ?= EPOCH_TEST_COMMIT ?= $(shell git merge-base $${DEST_BRANCH:-main} HEAD) HEAD ?= HEAD -CHANGELOG_BASE ?= HEAD~ -CHANGELOG_TARGET ?= HEAD PROJECT := github.com/containers/podman GIT_BASE_BRANCH ?= origin/main GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null) @@ -86,10 +84,8 @@ GIT_COMMIT ?= $(if $(shell git status --porcelain --untracked-files=no),${COMMIT DATE_FMT = %s ifdef SOURCE_DATE_EPOCH BUILD_INFO ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+$(DATE_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "+$(DATE_FMT)" 2>/dev/null || date -u "+$(DATE_FMT)") - ISODATE ?= $(shell date -d "@$(SOURCE_DATE_EPOCH)" --iso-8601) else BUILD_INFO ?= $(shell date "+$(DATE_FMT)") - ISODATE ?= $(shell date --iso-8601) endif LIBPOD := ${PROJECT}/v4/libpod GOFLAGS ?= -trimpath From d49efde27e577708bf5a7ea8aa686099717ae41b Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 13 Apr 2022 17:40:17 -0700 Subject: [PATCH 08/10] Makefile: rm gofmt target It is superceded by golangci-lint, which has gofmt as one of the linters. Signed-off-by: Kir Kolyshkin --- Makefile | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/Makefile b/Makefile index b0b3dd5f49..63d1342b80 100644 --- a/Makefile +++ b/Makefile @@ -221,18 +221,6 @@ endif golangci-lint: .install.golangci-lint hack/golangci-lint.sh run -.PHONY: gofmt -gofmt: ## Verify the source code gofmt - find . -name '*.go' -type f \ - -not \( \ - -name '.golangci.yml' -o \ - -name 'Makefile' -o \ - -path './vendor/*' -prune -o \ - -path './test/tools/vendor/*' -prune -o \ - -path './contrib/*' -prune \ - \) -exec gofmt -d -e -s -w {} \+ - git diff --exit-code - .PHONY: test/checkseccomp/checkseccomp test/checkseccomp/checkseccomp: $(wildcard test/checkseccomp/*.go) $(GOCMD) build $(BUILDFLAGS) $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' -tags "$(BUILDTAGS)" -o $@ ./test/checkseccomp @@ -257,7 +245,7 @@ codespell: codespell -S bin,vendor,.git,go.sum,.cirrus.yml,"RELEASE_NOTES.md,*.xz,*.gz,*.ps1,*.tar,swagger.yaml,*.tgz,bin2img,*ico,*.png,*.1,*.5,copyimg,*.orig,apidoc.go" -L uint,iff,od,seeked,splitted,marge,ERRO,hist,ether -w .PHONY: validate -validate: gofmt lint .gitvalidation validate.completions man-page-check swagger-check tests-included tests-expect-exit +validate: lint .gitvalidation validate.completions man-page-check swagger-check tests-included tests-expect-exit .PHONY: build-all-new-commits build-all-new-commits: From 40a1cd4efb97c431df226dd1b88b359bd7de7df1 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 13 Apr 2022 17:32:15 -0700 Subject: [PATCH 09/10] Remove GO111MODULES use Using it is no longer needed. Signed-off-by: Kir Kolyshkin --- Makefile | 8 ++++---- pkg/api/Makefile | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 63d1342b80..fa9b28bf0d 100644 --- a/Makefile +++ b/Makefile @@ -254,9 +254,9 @@ build-all-new-commits: .PHONY: vendor vendor: - GO111MODULE=on $(GO) mod tidy - GO111MODULE=on $(GO) mod vendor - GO111MODULE=on $(GO) mod verify + $(GO) mod tidy + $(GO) mod vendor + $(GO) mod verify .PHONY: vendor-in-container vendor-in-container: @@ -372,7 +372,7 @@ rootlessport: bin/rootlessport .PHONY: generate-bindings generate-bindings: ifneq ($(GOOS),darwin) - GO111MODULE=off $(GOCMD) generate ./pkg/bindings/... ; + $(GOCMD) generate ./pkg/bindings/... ; endif # DO NOT USE: use local-cross instead diff --git a/pkg/api/Makefile b/pkg/api/Makefile index 6da5fb57e1..d07cf6f93b 100644 --- a/pkg/api/Makefile +++ b/pkg/api/Makefile @@ -1,5 +1,3 @@ -export GO111MODULE=off - SWAGGER_OUT ?= swagger.yaml validate: ${SWAGGER_OUT} From 653117087fd6d6d956ce212bfbec0e4091a96010 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 17 May 2022 13:52:56 -0700 Subject: [PATCH 10/10] ci: pr-should-include-tests: add more exceptions Add .golangci.yml, podman.spec.rpkg, and non top-level Makefiles. Signed-off-by: Kir Kolyshkin --- contrib/cirrus/pr-should-include-tests | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/cirrus/pr-should-include-tests b/contrib/cirrus/pr-should-include-tests index 57ca39d9bf..9409a1d499 100755 --- a/contrib/cirrus/pr-should-include-tests +++ b/contrib/cirrus/pr-should-include-tests @@ -34,9 +34,11 @@ filtered_changes=$(git diff --name-only $base $head | fgrep -vx .cirrus.yml | fgrep -vx .pre-commit-config.yaml | fgrep -vx .gitignore | - fgrep -vx Makefile | fgrep -vx go.mod | fgrep -vx go.sum | + fgrep -vx podman.spec.rpkg | + fgrep -vx .golangci.yml | + egrep -v '/*Makefile$' | egrep -v '^[^/]+\.md$' | egrep -v '^.github' | egrep -v '^contrib/' |