From 59444de62df9128a0479d0f8352a20fd3e330118 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Wed, 27 Sep 2023 14:52:32 +0800 Subject: [PATCH] tweaks --- Makefile | 6 ++++-- scripts/update-mod.sh | 11 +++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index a51a373..ff54e0a 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,8 @@ # Note: Top-level package code is shared, but commands are in separate modules to prevent # go-ethereum import conflicts +ALL := dumpdiff.geth dumpdiff.plugeth dumpdiff.plugeth-parallel + dumpdiff.geth: dumpdiff-geth/* cd dumpdiff-geth && go build -tags geth -o ../$@ . @@ -11,7 +13,7 @@ dumpdiff.plugeth-parallel: cd dumpdiff-plugeth-parallel && go build -tags plugeth_parallel -o ../$@ . clean: - rm -f dumpdiff.geth dumpdiff.plugeth dumpdiff.plugeth-parallel + rm -f $(ALL) -all: dumpdiff.geth dumpdiff.plugeth dumpdiff.plugeth-parallel +all: $(ALL) .PHONY: all diff --git a/scripts/update-mod.sh b/scripts/update-mod.sh index 0684073..54dfd88 100755 --- a/scripts/update-mod.sh +++ b/scripts/update-mod.sh @@ -1,7 +1,10 @@ #!/bin/sh +# Usage: update-mod.sh -PLUGETH_STATEDIFF_DIR=`echo "$(cd "$(dirname "$1")"; pwd)/$(basename "$1")"` -TARGET_GOMOD_DIR=${2} +set -u + +PLUGETH_STATEDIFF_DIR=$(readlink -f "$1") +TARGET_GOMOD_DIR=${2} cd $TARGET_GOMOD_DIR if [ $? -ne 0 ]; then @@ -17,7 +20,7 @@ if [ $? -eq 0 ]; then go mod edit --replace "github.com/cerc-io/plugeth-statediff=${PLUGETH_STATEDIFF_DIR}" fi -for r in `go mod edit --json ${PLUGETH_STATEDIFF_DIR}/go.mod | jq -r '.Replace[] | "\(.Old.Path)=\(.New.Path)@\(.New.Version)"'`; do +for r in $(go mod edit --json "${PLUGETH_STATEDIFF_DIR}/go.mod" | jq -r '.Replace[] | "\(.Old.Path)=\(.New.Path)@\(.New.Version)"'); do orig=$(echo $r | cut -d'=' -f1) rep=$(echo $r | cut -d'=' -f2 | cut -d'@' -f1) echo "$CURRENT_REPLACEMENTS" | grep "$orig" | grep "$rep" > /dev/null @@ -28,4 +31,4 @@ for r in `go mod edit --json ${PLUGETH_STATEDIFF_DIR}/go.mod | jq -r '.Replace[] go mod edit --replace "$r" done -go mod tidy -e 2>/dev/null +exec go mod tidy -e 2>/dev/null