From 3d0cd9d5da8e23075c930fae1c5e47b398b0707f Mon Sep 17 00:00:00 2001 From: Avi Deitcher Date: Mon, 4 Mar 2024 20:54:50 +0200 Subject: [PATCH] properly handle sed for update-component-sha.sh Signed-off-by: Avi Deitcher --- kernel/Makefile | 6 +++--- scripts/update-component-sha.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/Makefile b/kernel/Makefile index 685f322b1..276907dfd 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -69,8 +69,8 @@ SPACE := $(eval) $(eval) PERIOD := . # series - convert a version to a series, e.g. 6.6.13 -> 6.6.x series = $(word 1,$(subst ., ,$(1))).$(word 2,$(subst ., ,$(1))).x -# serieswildcard - convert a version with or without a hash to a wildcard, e.g. 6.6.13-anbcd -> 6.6.-* -serieswildcard = $(word 1,$(subst ., ,$(1))).$(word 2,$(subst ., ,$(1))).[0-9]+-[0-9a-f]+.* +# serieswithhash - convert a version with or without a hash to a series with a hash, e.g. 6.6.13-anbcd -> 6.6.x-[0-9a-f]+ +serieswithhash = $(word 1,$(subst ., ,$(1))).$(word 2,$(subst ., ,$(1))).[0-9]+-[0-9a-f]+ # word 1 is the release, word 2 is the tool RELEASESEP := PART @@ -195,7 +195,7 @@ tag-debugkernel-%: # will update hash for same semver and/or patch version update-kernel-hash-yaml-%: $(eval NEWTAG=$(shell $(MAKE) tag-plainkernel-$*)) - $(eval OLDTAG=$(call serieswildcard,$(NEWTAG))) + $(eval OLDTAG=$(call serieswithhash,$(NEWTAG))) @cd $(REPO_ROOT) && ./scripts/update-component-sha.sh --hash "$(OLDTAG)" "$(NEWTAG)" # find and replace any usage of the normal kernel with semver for most recent series diff --git a/scripts/update-component-sha.sh b/scripts/update-component-sha.sh index a65c62e52..0ac21b351 100755 --- a/scripts/update-component-sha.sh +++ b/scripts/update-component-sha.sh @@ -69,7 +69,7 @@ case "${mode}" in fi old=$1 new=$2 - git grep -E -l "\b($old)([[:space:]].*)?$" -- '*.yml' '*.yaml' '*.yml.in' '*.yaml.in' '*/Dockerfile' '*/Makefile' | grep -v /vendor/ | while read -r file; do sed -ri.bak -e "s,$old,$new,g" "$file"; done + git grep -E -l "\b($old)([[:space:]]|$)?" -- '*.yml' '*.yaml' '*.yml.in' '*.yaml.in' '*/Dockerfile' '*/Makefile' | grep -v /vendor/ | while read -r file; do sed -ri.bak -e "s,($old)([[:space:]]|$)?,$new\2,g" "$file"; done ;; --image) if [ $# -lt 1 ] ; then