Thomas E Lackey
353b68c395
All checks were successful
Test / Run unit tests (push) Successful in 12m32s
``` ❯ scripts/update-mod.sh ../plugeth-statediff dumpdiff-geth/ github.com/cerc-io/eth-testing=git.vdb.to/cerc-io/eth-testing@v0.3.1 ❯ scripts/update-mod.sh ../plugeth-statediff dumpdiff-plugeth github.com/cerc-io/plugeth-statediff=/home/telackey/cerc/plugeth-statediff github.com/cerc-io/eth-iterator-utils=git.vdb.to/cerc-io/eth-iterator-utils@v0.1.2 github.com/cerc-io/eth-testing=git.vdb.to/cerc-io/eth-testing@v0.3.1 github.com/ethereum/go-ethereum=git.vdb.to/cerc-io/plugeth@v0.0.0-20230808125822-691dc334fab1 github.com/openrelayxyz/plugeth-utils=git.vdb.to/cerc-io/plugeth-utils@v0.0.0-20230706160122-cd41de354c46 ❯ scripts/update-mod.sh ../plugeth-statediff dumpdiff-plugeth-parallel/ github.com/cerc-io/plugeth-statediff=/home/telackey/cerc/plugeth-statediff github.com/cerc-io/eth-iterator-utils=git.vdb.to/cerc-io/eth-iterator-utils@v0.1.2 github.com/cerc-io/eth-testing=git.vdb.to/cerc-io/eth-testing@v0.3.1 github.com/ethereum/go-ethereum=git.vdb.to/cerc-io/plugeth@v0.0.0-20230808125822-691dc334fab1 github.com/openrelayxyz/plugeth-utils=git.vdb.to/cerc-io/plugeth-utils@v0.0.0-20230706160122-cd41de354c46 ``` Co-authored-by: Roy Crihfield <roy@manteia.ltd> Reviewed-on: #3 Co-authored-by: Thomas E Lackey <telackey@bozemanpass.com> Co-committed-by: Thomas E Lackey <telackey@bozemanpass.com>
35 lines
1006 B
Bash
Executable File
35 lines
1006 B
Bash
Executable File
#!/bin/sh
|
|
# Usage: update-mod.sh <plugeth-statediff-dir> <target-go.mod-dir>
|
|
|
|
set -u
|
|
|
|
PLUGETH_STATEDIFF_DIR=$(readlink -f "$1")
|
|
TARGET_GOMOD_DIR=${2}
|
|
|
|
cd $TARGET_GOMOD_DIR
|
|
if [ $? -ne 0 ]; then
|
|
echo "Unable to cd to $TARGET_GOMOD_DIR"
|
|
exit 1
|
|
fi
|
|
|
|
CURRENT_REPLACEMENTS=$(go mod edit --json | jq -r '.Replace[] | "\(.Old.Path) \(.New.Path)"')
|
|
|
|
grep 'github.com/cerc-io/plugeth-statediff' go.mod >/dev/null
|
|
if [ $? -eq 0 ]; then
|
|
echo "github.com/cerc-io/plugeth-statediff=${PLUGETH_STATEDIFF_DIR}"
|
|
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
|
|
orig=$(echo $r | cut -d'=' -f1)
|
|
rep=$(echo $r | cut -d'=' -f2 | cut -d'@' -f1)
|
|
echo "$CURRENT_REPLACEMENTS" | grep "$orig" | grep "$rep" > /dev/null
|
|
if [ $? -ne 0 ]; then
|
|
continue;
|
|
fi
|
|
echo "$r"
|
|
go mod edit --replace "$r"
|
|
done
|
|
|
|
exec go mod tidy -e 2>/dev/null
|