Skip to content

Commit

Permalink
devtools/bolt-catchup.sh: a tool to update the specs, one commit at a…
Browse files Browse the repository at this point in the history
… 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 <[email protected]>
  • Loading branch information
rustyrussell committed Sep 12, 2022
1 parent 1a0f7dd commit fbcdf2c
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions devtools/bolt-catchup.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit fbcdf2c

Please sign in to comment.