From 411698c16e3b1918c6cf19751e16281d8399f811 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 25 Apr 2018 10:38:02 +0100 Subject: [PATCH 1/4] update-component-sha.sh: simplify the quoting on sed expression I think the intention was to use "" for bits with substititions and '' for bits without, but that makes it hard to read and the bits in '' are safe in the "" context anyway. Running: ./scripts/update-component-sha.sh --image linuxkit/runc 100d0d046c5061d75ee43e4ac5017a759109cae4 Still DTRT and updates runc to that (bogus) sha. Signed-off-by: Ian Campbell --- scripts/update-component-sha.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update-component-sha.sh b/scripts/update-component-sha.sh index 704ab0a34..e30bd06e6 100755 --- a/scripts/update-component-sha.sh +++ b/scripts/update-component-sha.sh @@ -69,7 +69,7 @@ case "$1" in hash=$3 ;; esac - git grep -E -l "\b$image:" | xargs sed -i.bak -e "s,$image:[[:xdigit:]]"'\{40\}'",$image:$hash,g" + git grep -E -l "\b$image:" | xargs sed -i.bak -e "s,$image:[[:xdigit:]]\{40\},$image:$hash,g" ;; *) echo "Unknown mode $1" From 3ebd1769e223ae76d74dcea09f1a302a77b6cfe6 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 25 Apr 2018 10:40:33 +0100 Subject: [PATCH 2/4] update-component-sha.sh: use extended/modern regex for a complex case. Right now the difference is rather minor, but I'm about to make this case more complicated. Running: ./scripts/update-component-sha.sh --image linuxkit/runc 100d0d046c5061d75ee43e4ac5017a759109cae4 Still DTRT and updates runc to that (bogus) sha. Signed-off-by: Ian Campbell --- scripts/update-component-sha.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update-component-sha.sh b/scripts/update-component-sha.sh index e30bd06e6..5b41ae760 100755 --- a/scripts/update-component-sha.sh +++ b/scripts/update-component-sha.sh @@ -69,7 +69,7 @@ case "$1" in hash=$3 ;; esac - git grep -E -l "\b$image:" | xargs sed -i.bak -e "s,$image:[[:xdigit:]]\{40\},$image:$hash,g" + git grep -E -l "\b$image:" | xargs sed -i.bak -E -e "s,$image:[[:xdigit:]]{40},$image:$hash,g" ;; *) echo "Unknown mode $1" From 4320c3928f37cd486be8e608d584b9fb97d90be8 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 25 Apr 2018 10:42:31 +0100 Subject: [PATCH 3/4] update-component-sha.sh: support update of image with tagged release. This updates to support updating things like `linuxkit/runc:v0.3` to a new hash (or tag). Running: ./scripts/update-component-sha.sh --image linuxkit/runc 100d0d046c5061d75ee43e4ac5017a759109cae4 Still DTRT and updates runc to that (bogus) sha. Furthermore, running: ./scripts/update-component-sha.sh --image linuxkit/runc v0.4 Updates runc to that (bogus) release (this worked before) but now running: ./scripts/update-component-sha.sh --image linuxkit/runc acba8886e4b1318457c711700f695a02fef9493d Inverts things and puts them back. (this is not quote a nop because src/cmd/linuxkit/vendor/github.com/moby/tool/src/moby/linuxkit.go has a different sha in it which is not put back) Signed-off-by: Ian Campbell --- scripts/update-component-sha.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update-component-sha.sh b/scripts/update-component-sha.sh index 5b41ae760..a71303d0f 100755 --- a/scripts/update-component-sha.sh +++ b/scripts/update-component-sha.sh @@ -69,7 +69,7 @@ case "$1" in hash=$3 ;; esac - git grep -E -l "\b$image:" | xargs sed -i.bak -E -e "s,$image:[[:xdigit:]]{40},$image:$hash,g" + git grep -E -l "\b$image:" | xargs sed -i.bak -E -e "s,$image:([[:xdigit:]]{40}|v[0-9\.]+),$image:$hash,g" ;; *) echo "Unknown mode $1" From 6c1ba442b438669e11eefbb53f6ae3abd3fc5dd6 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 25 Apr 2018 10:47:33 +0100 Subject: [PATCH 4/4] update-component-sha.sh: ignore changes in directories named "vendor" src/cmd/linuxkit/vendor/github.com/moby/tool/src/moby/linuxkit.go embeds a yaml fragement with some hashes in it, so avoid updating that since that would make the vendoring unclean. Signed-off-by: Ian Campbell --- scripts/update-component-sha.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/update-component-sha.sh b/scripts/update-component-sha.sh index a71303d0f..82dbd30b8 100755 --- a/scripts/update-component-sha.sh +++ b/scripts/update-component-sha.sh @@ -56,7 +56,7 @@ case "$1" in old=$2 new=$3 - git grep -w -l "\b$old\b" | xargs sed -i.bak -e "s,$old,$new,g" + git grep -w -l "\b$old\b" | grep -v /vendor/ | xargs sed -i.bak -e "s,$old,$new,g" ;; --image) case $# in @@ -69,7 +69,7 @@ case "$1" in hash=$3 ;; esac - git grep -E -l "\b$image:" | xargs sed -i.bak -E -e "s,$image:([[:xdigit:]]{40}|v[0-9\.]+),$image:$hash,g" + git grep -E -l "\b$image:" | grep -v /vendor/ | xargs sed -i.bak -E -e "s,$image:([[:xdigit:]]{40}|v[0-9\.]+),$image:$hash,g" ;; *) echo "Unknown mode $1"