From fbcdf2c565b6b5fb59c761ca36bf8d5637d7b0f5 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sat, 10 Sep 2022 11:38:31 +0930 Subject: [PATCH] devtools/bolt-catchup.sh: a tool to update the specs, one commit at a time. This would be more effective if we didn't *merge* in the specs repo, but still. Usage: ./devtools/bolt-catchup.sh It goes through one commit at a time, up to current HEAD, and stops when there are changes, or quotes change. Signed-off-by: Rusty Russell --- devtools/bolt-catchup.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 devtools/bolt-catchup.sh diff --git a/devtools/bolt-catchup.sh b/devtools/bolt-catchup.sh new file mode 100755 index 000000000..60f5662e5 --- /dev/null +++ b/devtools/bolt-catchup.sh @@ -0,0 +1,25 @@ +#! /bin/sh +# A script to upgrade spec versions one at a time, stop when something changes. + +set -e +BOLTDIR=${1:-../bolts} + +HEAD=$(git -C "$BOLTDIR" show --format=%H -s) +VERSION=$(sed -n 's/^DEFAULT_BOLTVERSION[ ]*:=[ ]*\([0-9a-f]*\)/\1/p' < Makefile) + +# We only change Makefile at exit, otherwise git diff shows the difference, of course! +finalize_and_exit() +{ + sed "s/^DEFAULT_BOLTVERSION[ ]*:=[ ]*\([0-9a-f]*\)/DEFAULT_BOLTVERSION := $v/" < Makefile > Makefile.$$ && mv Makefile.$$ Makefile + exit 0 +} + +for v in $(git -C "$BOLTDIR" show "$VERSION..$HEAD" --format=%H -s | tac); do + echo "Trying $v..." + make -s extract-bolt-csv DEFAULT_BOLTVERSION="$v" || finalize_and_exit + git diff --exit-code || finalize_and_exit + make -s check-source-bolt DEFAULT_BOLTVERSION="$v" || finalize_and_exit +done + +echo "No changes, simply upgrading to $v..." +finalize_and_exit