From bc43373cd3dffe23ef6055b6d25d1f5dc5790b81 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Thu, 9 Jan 2025 09:38:00 +0100 Subject: [PATCH] build: Use backup file in gen_release_info Using `sed -i` cross-platform is problematic as the `-i` flag does not behave the same on macOS and linux (see 5e561ad5b). The `sed` on macOS currently treat `-e` as a backup extension while on linux it's treated as a flag. This does not seem to make a difference, but it is very magic. This commit specifies a backup extension to `sed -i`, which works for me on macOS and linux. `-e` will be used as a flag on all platforms. Signed-off-by: Christophe Fergeau --- .gitignore | 2 +- Makefile | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 234dcd0f1e..eb9487627c 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ /docs/package-lock.json /release/ /release-info.json -/release-info.json-e +/release-info.json.bak *.crcbundle /tmp-embed/ /RPMS/ diff --git a/Makefile b/Makefile index 1bd3323565..535dc3234e 100644 --- a/Makefile +++ b/Makefile @@ -270,8 +270,9 @@ cross-lint: $(TOOLS_BINDIR)/golangci-lint gen_release_info .PHONY: gen_release_info gen_release_info: @cat release-info.json.sample | sed s/@CRC_VERSION@/$(CRC_VERSION)/ > $(RELEASE_INFO) - @sed -i"" -e s/@GIT_COMMIT_SHA@/$(COMMIT_SHA)/ $(RELEASE_INFO) - @sed -i"" -e s/@OPENSHIFT_VERSION@/$(OPENSHIFT_VERSION)/ $(RELEASE_INFO) + @sed -i.bak -e s/@GIT_COMMIT_SHA@/$(COMMIT_SHA)/ $(RELEASE_INFO) + @sed -i.bak -e s/@OPENSHIFT_VERSION@/$(OPENSHIFT_VERSION)/ $(RELEASE_INFO) + @rm -f $(RELEASE_INFO).bak .PHONY: linux-release-binary macos-release-binary windows-release-binary linux-release-binary: LDFLAGS+= $(RELEASE_VERSION_VARIABLES)