From d4173293ceb9e847ea610572fa3d1faf1d0fec5a Mon Sep 17 00:00:00 2001 From: Chad Ostrowski <221614+chadoh@users.noreply.github.com> Date: Thu, 7 Dec 2023 13:22:28 -0500 Subject: [PATCH] build: make dependency-check script more verbose --- scripts/check-dependencies.bash | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/scripts/check-dependencies.bash b/scripts/check-dependencies.bash index 470ac65ec..7adb661c5 100755 --- a/scripts/check-dependencies.bash +++ b/scripts/check-dependencies.bash @@ -2,14 +2,19 @@ set -e +echo "Checking dependencies." + SED=sed if [ -z "$(sed --version 2>&1 | grep GNU)" ]; then - SED=gsed + echo "Using gsed instead of sed." + SED=gsed fi CURL="curl -sL --fail-with-body" CARGO_PACKAGE_REVISION_EXTRACT_SED_COMMAND='s/.*rev=\(.*\)#.*/\1/' +printf "Checking soroban-env-host... " + if ! CARGO_OUTPUT=$(cargo tree -p soroban-env-host 2>&1); then echo "The project depends on multiple versions of the soroban-env-host Rust library, please unify them." echo "Make sure the soroban-sdk dependency indirectly points to the same soroban-env-host dependency imported explicitly." @@ -24,6 +29,7 @@ if ! CARGO_OUTPUT=$(cargo tree -p soroban-env-host 2>&1); then exit 1 fi +echo ✔️ # revision of the https://github.com/stellar/rs-stellar-xdr library used by the Rust code RS_STELLAR_XDR_REVISION="" @@ -31,6 +37,8 @@ RS_STELLAR_XDR_REVISION="" # revision of https://github.com/stellar/stellar-xdr/ used by the Rust code STELLAR_XDR_REVISION_FROM_RUST="" +printf "Checking rs-stellar-xdr... " + if CARGO_OUTPUT=$(cargo tree --depth 0 -p stellar-xdr 2>&1); then RS_STELLAR_XDR_REVISION=$(echo $CARGO_OUTPUT | head -n 1 | $SED "$CARGO_PACKAGE_REVISION_EXTRACT_SED_COMMAND") STELLAR_XDR_REVISION_FROM_RUST=$($CURL https://raw.githubusercontent.com/stellar/rs-stellar-xdr/${RS_STELLAR_XDR_REVISION}/xdr/curr-version) @@ -44,6 +52,8 @@ else echo $CARGO_OUTPUT fi +echo " All good." + # Now, lets compare the Rust and Go XDR revisions # TODO: The sed extraction below won't work for version tags GO_XDR_REVISION=$(go list -m -f '{{.Version}}' github.com/stellar/go | $SED 's/.*-\(.*\)/\1/') @@ -51,6 +61,8 @@ GO_XDR_REVISION=$(go list -m -f '{{.Version}}' github.com/stellar/go | $SED 's/. # revision of https://github.com/stellar/stellar-xdr/ used by the Go code STELLAR_XDR_REVISION_FROM_GO=$($CURL https://raw.githubusercontent.com/stellar/go/${GO_XDR_REVISION}/xdr/xdr_commit_generated.txt) +printf "Checking stellar-xdr... " + if [ "$STELLAR_XDR_REVISION_FROM_GO" != "$STELLAR_XDR_REVISION_FROM_RUST" ]; then echo "Go and Rust dependencies are using different revisions of https://github.com/stellar/stellar-xdr" echo @@ -59,6 +71,8 @@ if [ "$STELLAR_XDR_REVISION_FROM_GO" != "$STELLAR_XDR_REVISION_FROM_RUST" ]; the exit 1 fi +echo ✔️ + # Now, lets make sure that the core and captive core version used in the tests use the same version and that they depend # on the same XDR revision @@ -66,6 +80,8 @@ fi CORE_CONTAINER_REVISION=$($SED -n 's/.*\/\(stellar-core\|unsafe-stellar-core\(-next\)\{0,1\}\)\:.*\..*-[^\.]*\.\(.*\)\..*/\3/p' < cmd/soroban-rpc/internal/test/docker-compose.yml) CAPTIVE_CORE_PKG_REVISION=$($SED -n 's/.*DEBIAN_PKG_VERSION:.*\..*-[^\.]*\.\(.*\)\..*/\1/p' < .github/workflows/soroban-rpc.yml) +printf "Checking Core and Captive Core versions... " + if [ "$CORE_CONTAINER_REVISION" != "$CAPTIVE_CORE_PKG_REVISION" ]; then echo "Soroban RPC integration tests are using different versions of the Core container and Captive Core Debian package." echo @@ -74,6 +90,8 @@ if [ "$CORE_CONTAINER_REVISION" != "$CAPTIVE_CORE_PKG_REVISION" ]; then exit 1 fi +echo ✔️ + # Revision of https://github.com/stellar/rs-stellar-xdr by Core. # We obtain it from src/rust/src/host-dep-tree-curr.txt but Alternatively/in addition we could: # * Check the rs-stellar-xdr revision of host-dep-tree-prev.txt @@ -82,6 +100,9 @@ CORE_HOST_DEP_TREE_CURR=$($CURL https://raw.githubusercontent.com/stellar/stella RS_STELLAR_XDR_REVISION_FROM_CORE=$(echo "$CORE_HOST_DEP_TREE_CURR" | grep stellar-xdr | head -n 1 | $SED "$CARGO_PACKAGE_REVISION_EXTRACT_SED_COMMAND") + +printf "Checking rs-stellar-xdr by Core... " + if [ "$RS_STELLAR_XDR_REVISION" != "$RS_STELLAR_XDR_REVISION_FROM_CORE" ]; then echo "The Core revision used in integration tests (${CORE_CONTAINER_REVISION}) uses a different revision of https://github.com/stellar/rs-stellar-xdr" echo @@ -90,5 +111,4 @@ if [ "$RS_STELLAR_XDR_REVISION" != "$RS_STELLAR_XDR_REVISION_FROM_CORE" ]; then exit 1 fi - - +echo ✔️