Skip to content

Commit e72c5cb

Browse files
stblassitudesapk
andauthored
Simplify grep regexp to be more compatible (#10765)
* Simplify grep regexp to be more compatible The new expression also works with the BSD implementation of grep. Also, I believe the expression did not work consistently for all possible version numers, for example a two digit patch version would not have been matched. * Fix quote * Allow for two and three part version numbers * Select one, two and three part version numbers, reject amd64 * Also allow one to three parts for node version * Use JS code to print node verion in correct format * Avoid grep altogether * Handle go1.14beta1 as well. Co-authored-by: Antoine GIRARD <[email protected]>
1 parent ad6f232 commit e72c5cb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ help:
148148

149149
.PHONY: go-check
150150
go-check:
151-
$(eval GO_VERSION := $(shell printf "%03d%03d%03d" $(shell go version | grep -Eo '[0-9]+\.?[0-9]+?\.?[0-9]?[[:space:]]' | tr '.' ' ');))
151+
$(eval GO_VERSION := $(shell printf "%03d%03d%03d" $(shell go version | grep -Eo '[0-9]+\.[0-9.]+' | tr '.' ' ');))
152152
@if [ "$(GO_VERSION)" -lt "$(MIN_GO_VERSION)" ]; then \
153153
echo "Gitea requires Go 1.12 or greater to build. You can get it at https://golang.org/dl/"; \
154154
exit 1; \
@@ -163,7 +163,7 @@ git-check:
163163

164164
.PHONY: node-check
165165
node-check:
166-
$(eval NODE_VERSION := $(shell printf "%03d%03d%03d" $(shell node -v | grep -Eo '[0-9]+\.?[0-9]+?\.?[0-9]?' | tr '.' ' ');))
166+
$(eval NODE_VERSION := $(shell printf "%03d%03d%03d" $(shell node -v | cut -c2- | tr '.' ' ');))
167167
$(eval NPM_MISSING := $(shell hash npm > /dev/null 2>&1 || echo 1))
168168
@if [ "$(NODE_VERSION)" -lt "$(MIN_NODE_VERSION)" -o "$(NPM_MISSING)" = "1" ]; then \
169169
echo "Gitea requires Node.js 10 or greater and npm to build. You can get it at https://nodejs.org/en/download/"; \

0 commit comments

Comments
 (0)