Skip to content

Commit

Permalink
build: Use backup file in gen_release_info
Browse files Browse the repository at this point in the history
Using `sed -i` cross-platform is problematic as the `-i` flag does not
behave the same on macOS and linux (see 5e561ad).
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 <[email protected]>
  • Loading branch information
cfergeau authored and praveenkumar committed Jan 16, 2025
1 parent 8f40e84 commit 4f8b2a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/docs/package-lock.json
/release/
/release-info.json
/release-info.json-e
/release-info.json.bak
*.crcbundle
/tmp-embed/
/RPMS/
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4f8b2a3

Please sign in to comment.