From ba92777d4497f56af054ade529a1b4dba0b823a5 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Thu, 19 Sep 2024 10:58:45 -0700 Subject: [PATCH 1/3] Makefile,.cirrus.yml: remove obsoleted build tag Since commit 8ca60c5d we use c/storage with devicemapper driver removed, so libdm_no_deferred_remove is no longer in use. Remove it. Signed-off-by: Kir Kolyshkin --- .cirrus.yml | 6 +++--- Makefile | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index cab9f3f699..9893b12378 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -81,10 +81,10 @@ test_task: matrix: - name: "Test" env: - BUILDTAGS: 'btrfs_noversion libdm_no_deferred_remove' + BUILDTAGS: 'btrfs_noversion' - name: "Test w/ opengpg" env: - BUILDTAGS: &withopengpg 'btrfs_noversion libdm_no_deferred_remove containers_image_openpgp' + BUILDTAGS: &withopengpg 'btrfs_noversion containers_image_openpgp' script: ${GOSRC}/${SCRIPT_BASE}/runner.sh image_tests @@ -110,7 +110,7 @@ test_skopeo_task: matrix: - name: "Skopeo Test" env: - BUILDTAGS: 'btrfs_noversion libdm_no_deferred_remove' + BUILDTAGS: 'btrfs_noversion' - name: "Skopeo Test w/ opengpg" env: BUILDTAGS: *withopengpg diff --git a/Makefile b/Makefile index d664c7a09a..005a70cf2a 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ endif BUILD_TAGS_WINDOWS_CROSS = containers_image_openpgp BUILD_TAGS_DARWIN_CROSS = containers_image_openpgp -BUILDTAGS = btrfs_noversion libdm_no_deferred_remove +BUILDTAGS = btrfs_noversion BUILDFLAGS := -tags "$(BUILDTAGS)" PACKAGES := $(shell go list $(BUILDFLAGS) ./...) From dd11e606ed3f2197609794f822c201a9b7f02768 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Thu, 19 Sep 2024 11:08:26 -0700 Subject: [PATCH 2/3] .codespellrc: exclude directories with test data Instead of excluding just the *.gpg files, let's exclude directories containing those (and similar) files which should not be subjected to spell checker. This makes codespell run faster and fixes the following warning: > WARNING: Cannot decode file using encoding "utf-8": ./signature/simplesigning/testdata/private-keys-v1.d/A0E6EC3A2963DC2D19E9C24E4E6DD232E6BBE1CD.key > WARNING: Trying next encoding "iso-8859-1" Signed-off-by: Kir Kolyshkin --- .codespellrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codespellrc b/.codespellrc index 0b6bdcb31f..df04cb4d68 100644 --- a/.codespellrc +++ b/.codespellrc @@ -1,6 +1,6 @@ # See https://github.com/codespell-project/codespell#using-a-config-file [codespell] -skip = ./vendor,./.git,./go.sum,*.gpg +skip = ./vendor,./.git,./go.sum,./signature/fixtures,./signature/simplesigning/testdata # NOTE words added to the list below need to be lowercased. ignore-words-list = te,bu From 4c0511f89a5ff3d2b4e41007399fca650cc81f6e Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Thu, 19 Sep 2024 11:15:25 -0700 Subject: [PATCH 3/3] Makefile: mark all phony targets as such Quite a few phony targets were not marked as such. Fix this. While at it, let's mark those individually, in place, so it's easier to remember and check. Signed-off-by: Kir Kolyshkin --- Makefile | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 005a70cf2a..03385addb9 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,3 @@ -.PHONY: all tools test validate lint .gitvalidation fmt - export GOPROXY=https://proxy.golang.org @@ -38,66 +36,83 @@ GOLANGCI_LINT_VERSION := 1.61.0 export PATH := $(PATH):${GOBIN} +.PHONY: all all: tools test validate .gitvalidation +.PHONY: build build: go build $(BUILDFLAGS) ./... $(MANPAGES): %: %.md $(GOMD2MAN) -in $< -out $@ +.PHONY: docs docs: $(MANPAGES) +.PHONY: install-docs install-docs: docs install -d -m 755 ${MANINSTALLDIR}/man5 install -m 644 docs/*.5 ${MANINSTALLDIR}/man5/ +.PHONY: install install: install-docs install -d -m 755 ${DESTDIR}${CONTAINERSCONFDIR} install -m 644 default-policy.json ${DESTDIR}${CONTAINERSCONFDIR}/policy.json install -d -m 755 ${DESTDIR}${REGISTRIESDDIR} install -m 644 default.yaml ${DESTDIR}${REGISTRIESDDIR}/default.yaml +.PHONY: cross cross: GOOS=windows $(MAKE) build BUILDTAGS="$(BUILDTAGS) $(BUILD_TAGS_WINDOWS_CROSS)" GOOS=darwin $(MAKE) build BUILDTAGS="$(BUILDTAGS) $(BUILD_TAGS_DARWIN_CROSS)" +.PHONY: tools tools: .install.gitvalidation .install.golangci-lint +.PHONY: .install.gitvalidation .install.gitvalidation: if [ ! -x "$(GOBIN)/git-validation" ]; then \ go install github.com/vbatts/git-validation@latest; \ fi +.PHONY: .install.golangci-lint .install.golangci-lint: if [ ! -x "$(GOBIN)/golangci-lint" ]; then \ curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(GOBIN) v$(GOLANGCI_LINT_VERSION) ; \ fi +.PHONY: clean clean: rm -rf $(MANPAGES) +.PHONY: test test: @go test $(BUILDFLAGS) -cover ./... +.PHONY: fmt fmt: @gofmt -l -s -w $(SOURCE_DIRS) +.PHONY: validate validate: lint @BUILDTAGS="$(BUILDTAGS)" hack/validate.sh +.PHONY: lint lint: $(GOBIN)/golangci-lint run --build-tags "$(BUILDTAGS)" # When this is running in CI, it will only check the CI commit range +.PHONY: .gitvalidation .gitvalidation: @which $(GOBIN)/git-validation > /dev/null 2>/dev/null || (echo "ERROR: git-validation not found. Consider 'make clean && make tools'" && false) git fetch -q "https://github.com/containers/image.git" "refs/heads/main" upstream="$$(git rev-parse --verify FETCH_HEAD)" ; \ $(GOBIN)/git-validation -q -run DCO,short-subject,dangling-whitespace -range $$upstream..HEAD +.PHONY: vendor-in-container vendor-in-container: podman run --privileged --rm --env HOME=/root -v `pwd`:/src -w /src golang go mod tidy +.PHONY: codespell codespell: codespell -w