From f2ab8c8ea7eef5db4d9ec6245f96860814d63dd7 Mon Sep 17 00:00:00 2001 From: Otto Richter Date: Fri, 16 Aug 2024 14:54:55 +0200 Subject: [PATCH 1/4] Drop legacy update-translation target --- Makefile | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Makefile b/Makefile index 754a973136..62be2a2613 100644 --- a/Makefile +++ b/Makefile @@ -954,16 +954,6 @@ lockfile-check: @git diff --exit-code --color=always package-lock.json \ || (code=$$?; echo "Please run 'npm install --package-lock-only' and commit the result"; exit $${code}) -.PHONY: update-translations -update-translations: - mkdir -p ./translations - cd ./translations && curl -L https://crowdin.com/download/project/gitea.zip > gitea.zip && unzip gitea.zip - rm ./translations/gitea.zip - $(SED_INPLACE) -e 's/="/=/g' -e 's/"$$//g' ./translations/*.ini - $(SED_INPLACE) -e 's/\\"/"/g' ./translations/*.ini - mv ./translations/*.ini ./options/locale/ - rmdir ./translations - .PHONY: generate-license generate-license: $(GO) run build/generate-licenses.go From ac5d4f68d1e5e66c20ea9375863b4f6608fcb270 Mon Sep 17 00:00:00 2001 From: Otto Richter Date: Fri, 16 Aug 2024 15:04:25 +0200 Subject: [PATCH 2/4] Comments for structure, moving things around, drop Gitea mentions --- Makefile | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 62be2a2613..65f08a0547 100644 --- a/Makefile +++ b/Makefile @@ -273,20 +273,24 @@ help: @echo " - test[\#TestSpecificName] run unit test" @echo " - test-sqlite[\#TestSpecificName] run integration test for sqlite" +### +# Check system and environment requirements +### + .PHONY: go-check go-check: $(eval MIN_GO_VERSION_STR := $(shell grep -Eo '^go\s+[0-9]+\.[0-9]+' go.mod | cut -d' ' -f2)) $(eval MIN_GO_VERSION := $(shell printf "%03d%03d" $(shell echo '$(MIN_GO_VERSION_STR)' | tr '.' ' '))) $(eval GO_VERSION := $(shell printf "%03d%03d" $(shell $(GO) version | grep -Eo '[0-9]+\.[0-9]+' | tr '.' ' ');)) @if [ "$(GO_VERSION)" -lt "$(MIN_GO_VERSION)" ]; then \ - echo "Gitea requires Go $(MIN_GO_VERSION_STR) or greater to build. You can get it at https://go.dev/dl/"; \ + echo "Forgejo requires Go $(MIN_GO_VERSION_STR) or greater to build. You can get it at https://go.dev/dl/"; \ exit 1; \ fi .PHONY: git-check git-check: @if git lfs >/dev/null 2>&1 ; then : ; else \ - echo "Gitea requires git with lfs support to run tests." ; \ + echo "Forgejo requires git with lfs support to run tests." ; \ exit 1; \ fi @@ -297,10 +301,14 @@ node-check: $(eval NODE_VERSION := $(shell printf "%03d%03d%03d" $(shell node -v | cut -c2- | tr '.' ' ');)) $(eval NPM_MISSING := $(shell hash npm > /dev/null 2>&1 || echo 1)) @if [ "$(NODE_VERSION)" -lt "$(MIN_NODE_VERSION)" -o "$(NPM_MISSING)" = "1" ]; then \ - echo "Gitea requires Node.js $(MIN_NODE_VERSION_STR) or greater and npm to build. You can get it at https://nodejs.org/en/download/"; \ + echo "Forgejo requires Node.js $(MIN_NODE_VERSION_STR) or greater and npm to build. You can get it at https://nodejs.org/en/download/"; \ exit 1; \ fi +### +# Basic maintenance, check and lint targets +### + .PHONY: clean-all clean-all: clean rm -rf $(WEBPACK_DEST_ENTRIES) node_modules @@ -500,6 +508,14 @@ lint-templates: .venv node_modules lint-yaml: .venv @poetry run yamllint . +.PHONY: security-check +security-check: + go run $(GOVULNCHECK_PACKAGE) ./... + +### +# Development and testing targets +### + .PHONY: watch watch: @bash tools/watch.sh @@ -782,6 +798,10 @@ e2e.sqlite.test: $(GO_SOURCES) .PHONY: check check: test +### +# Production / build targets +### + .PHONY: install $(TAGS_PREREQ) install: $(wildcard *.go) CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) install -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' @@ -811,10 +831,6 @@ generate-go: $(TAGS_PREREQ) merge-locales: @echo "NOT NEEDED: THIS IS A NOOP AS OF Forgejo 7.0 BUT KEPT FOR BACKWARD COMPATIBILITY" -.PHONY: security-check -security-check: - go run $(GOVULNCHECK_PACKAGE) ./... - $(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ) CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@ @@ -878,6 +894,15 @@ release-sources: | $(DIST_DIRS) release-docs: | $(DIST_DIRS) docs tar -czf $(DIST)/release/gitea-docs-$(VERSION).tar.gz -C ./docs . +.PHONY: docker +docker: + docker build --disable-content-trust=false -t $(DOCKER_REF) . +# support also build args docker build --build-arg GITEA_VERSION=v1.2.3 --build-arg TAGS="bindata sqlite sqlite_unlock_notify" . + +### +# Dependency management +### + .PHONY: deps deps: deps-frontend deps-backend deps-tools deps-py @@ -979,11 +1004,6 @@ generate-manpage: @gzip -9 man/man1/gitea.1 && echo man/man1/gitea.1.gz created @#TODO A small script that formats config-cheat-sheet.en-us.md nicely for use as a config man page -.PHONY: docker -docker: - docker build --disable-content-trust=false -t $(DOCKER_REF) . -# support also build args docker build --build-arg GITEA_VERSION=v1.2.3 --build-arg TAGS="bindata sqlite sqlite_unlock_notify" . - # This endif closes the if at the top of the file endif From b390641478defa97522b4f060dd366674e21adb7 Mon Sep 17 00:00:00 2001 From: Otto Richter Date: Fri, 16 Aug 2024 15:28:48 +0200 Subject: [PATCH 3/4] Drop vendor filter (dir is gone), left-align help messages --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 65f08a0547..a16dfbb11c 100644 --- a/Makefile +++ b/Makefile @@ -123,7 +123,7 @@ LDFLAGS := $(LDFLAGS) -X "main.ReleaseVersion=$(RELEASE_VERSION)" -X "main.MakeV LINUX_ARCHS ?= linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64 ifeq ($(HAS_GO), yes) - GO_TEST_PACKAGES ?= $(filter-out $(shell $(GO) list code.gitea.io/gitea/models/migrations/...) $(shell $(GO) list code.gitea.io/gitea/models/forgejo_migrations/...) code.gitea.io/gitea/tests/integration/migration-test code.gitea.io/gitea/tests code.gitea.io/gitea/tests/integration code.gitea.io/gitea/tests/e2e,$(shell $(GO) list ./... | grep -v /vendor/)) + GO_TEST_PACKAGES ?= $(filter-out $(shell $(GO) list code.gitea.io/gitea/models/migrations/...) $(shell $(GO) list code.gitea.io/gitea/models/forgejo_migrations/...) code.gitea.io/gitea/tests/integration/migration-test code.gitea.io/gitea/tests code.gitea.io/gitea/tests/integration code.gitea.io/gitea/tests/e2e,$(shell $(GO) list ./...)) endif REMOTE_CACHER_MODULES ?= cache nosql session queue GO_TEST_REMOTE_CACHER_PACKAGES ?= $(addprefix code.gitea.io/gitea/modules/,$(REMOTE_CACHER_MODULES)) @@ -206,7 +206,7 @@ all: build .PHONY: help help: @echo "Make Routines:" - @echo " - \"\" equivalent to \"build\"" + @echo " - \"\" equivalent to \"build\"" @echo " - build build everything" @echo " - frontend build frontend files" @echo " - backend build backend files" @@ -270,7 +270,7 @@ help: @echo " - swagger-validate check if the swagger spec is valid" @echo " - go-licenses regenerate go licenses" @echo " - tidy run go mod tidy" - @echo " - test[\#TestSpecificName] run unit test" + @echo " - test[\#TestSpecificName] run unit test" @echo " - test-sqlite[\#TestSpecificName] run integration test for sqlite" ### From 7e0cebecb00d6688bc1043ea82ecf2d20a56bb52 Mon Sep 17 00:00:00 2001 From: Otto Richter Date: Sun, 18 Aug 2024 15:14:34 +0200 Subject: [PATCH 4/4] Drop docker target from Makefile as per https://codeberg.org/forgejo/forgejo/pulls/4979#issuecomment-2181764 --- Makefile | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Makefile b/Makefile index a16dfbb11c..de8136feb8 100644 --- a/Makefile +++ b/Makefile @@ -41,10 +41,6 @@ GOMOCK_PACKAGE ?= go.uber.org/mock/mockgen@v0.4.0 # renovate: datasource=go GOPLS_PACKAGE ?= golang.org/x/tools/gopls@v0.16.1 # renovate: datasource=go RENOVATE_NPM_PACKAGE ?= renovate@38.25.0 # renovate: datasource=docker packageName=code.forgejo.org/forgejo-contrib/renovate -DOCKER_IMAGE ?= gitea/gitea -DOCKER_TAG ?= latest -DOCKER_REF := $(DOCKER_IMAGE):$(DOCKER_TAG) - ifeq ($(HAS_GO), yes) CGO_EXTRA_CFLAGS := -DSQLITE_MAX_VARIABLE_NUMBER=32766 CGO_CFLAGS ?= $(shell $(GO) env CGO_CFLAGS) $(CGO_EXTRA_CFLAGS) @@ -894,11 +890,6 @@ release-sources: | $(DIST_DIRS) release-docs: | $(DIST_DIRS) docs tar -czf $(DIST)/release/gitea-docs-$(VERSION).tar.gz -C ./docs . -.PHONY: docker -docker: - docker build --disable-content-trust=false -t $(DOCKER_REF) . -# support also build args docker build --build-arg GITEA_VERSION=v1.2.3 --build-arg TAGS="bindata sqlite sqlite_unlock_notify" . - ### # Dependency management ###