From 18a3852006827dd565b1f86232b2b180021cbd99 Mon Sep 17 00:00:00 2001 From: vladikkuzn <51460778+vladikkuzn@users.noreply.github.com> Date: Tue, 2 Apr 2024 20:34:12 +0300 Subject: [PATCH] [makefile] Support for sed on Darwin (#1920) * [makefile] Support for sed on Darwin * [makefile] Update makefile to choose sed via `command -v` --- Makefile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b632e93f0e..5022ffb1b4 100644 --- a/Makefile +++ b/Makefile @@ -84,7 +84,13 @@ 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 ?= $(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 LD_FLAGS += -X '$(version_pkg).GitVersion=$(GIT_TAG)' @@ -312,7 +318,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)