From 56687a961bda900b797ee9015668859f5d9f16a2 Mon Sep 17 00:00:00 2001 From: vladikkuzn Date: Tue, 26 Mar 2024 19:39:08 +0200 Subject: [PATCH 1/2] [makefile] Support for sed on Darwin --- Makefile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5afd390547..08965cd377 100644 --- a/Makefile +++ b/Makefile @@ -84,7 +84,16 @@ SHELL = /usr/bin/env bash -o pipefail # Setting SED allows macos users to install GNU sed and use the latter # instead of the default BSD sed. -SED ?= /usr/bin/sed +SED := /usr/bin/sed +# If the OS is Darwin (MacOS) +ifeq ($(shell uname), Darwin) + # Check if gsed is available + ifeq ($(shell command -v gsed 2>/dev/null),) + $(error "gsed could not be found, please install it.") + endif + # Set SED to gsed if available + SED := $(shell which gsed) +endif version_pkg = sigs.k8s.io/kueue/pkg/version LD_FLAGS += -X '$(version_pkg).GitVersion=$(GIT_TAG)' @@ -307,7 +316,7 @@ artifacts: kustomize yq helm .PHONY: prepare-release-branch prepare-release-branch: yq kustomize - sed -r 's/v[0-9]+\.[0-9]+\.[0-9]+/$(RELEASE_VERSION)/g' -i README.md -i site/hugo.toml + $(SED) -r 's/v[0-9]+\.[0-9]+\.[0-9]+/$(RELEASE_VERSION)/g' -i README.md -i site/hugo.toml $(YQ) e '.appVersion = "$(RELEASE_VERSION)"' -i charts/kueue/Chart.yaml @$(call clean-manifests) From 595545d68305669337d54c79e0c90614ed43bcbb Mon Sep 17 00:00:00 2001 From: vladikkuzn Date: Thu, 28 Mar 2024 23:24:48 +0200 Subject: [PATCH 2/2] [makefile] Update makefile to choose sed via `command -v` --- Makefile | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 08965cd377..e9efca013a 100644 --- a/Makefile +++ b/Makefile @@ -84,15 +84,12 @@ SHELL = /usr/bin/env bash -o pipefail # Setting SED allows macos users to install GNU sed and use the latter # instead of the default BSD sed. -SED := /usr/bin/sed -# If the OS is Darwin (MacOS) -ifeq ($(shell uname), Darwin) - # Check if gsed is available - ifeq ($(shell command -v gsed 2>/dev/null),) - $(error "gsed could not be found, please install it.") - endif - # Set SED to gsed if available - SED := $(shell which gsed) +SED ?= $(shell command -v sed) +ifeq ($(shell command -v gsed 2>/dev/null),) + SED = $(shell command -v sed) +endif +ifeq ($(shell ${SED} --version 2>&1 | grep -q GNU; echo $$?),1) + $(error !!! GNU sed is required. If on OS X, use 'brew install gnu-sed'.) endif version_pkg = sigs.k8s.io/kueue/pkg/version