Skip to content

Commit b899937

Browse files
committed
Fix GPG_KEYNAME extraction in macOS
grep (BSD grep) 2.5.1-FreeBSD, the variant found on macOS 10.14 (Mojave), does not have the -P flag. awk to the rescue! awk version 20070501 works just fine. Notice the lazy evaluation, where the variable will be expanded just-in-time, when it gets referenced in the make target. This speeds up execution of all make targets since this gets invoked only when the variable is used. The only downside is that this will be invoked multiple times if the variable is referenced multiple times.
1 parent 6e065d5 commit b899937

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ SHELL := bash# we want bash behaviour in all shell invocations
77
export PATH := $(CURDIR):$(CURDIR)/scripts:$(PATH)
88
OS := $(shell uname -s | tr '[:upper:]' '[:lower:]')
99
HARDWARE := $(shell uname -m | tr '[:upper:]' '[:lower:]')
10-
GPG_KEYNAME := $(shell cat pom.xml | grep -oPm1 "(?<=<gpg.keyname>)[^<]+")
10+
GPG_KEYNAME := $$(awk -F'[<>]' '/<gpg.keyname>/ { print $$3 }' pom.xml)
1111

1212
### TARGETS ###
1313
#

0 commit comments

Comments
 (0)