diff --git a/tools/dep_updaters/update-undici.sh b/tools/dep_updaters/update-undici.sh index 087038cfd45ed1..4ba532f99bf423 100755 --- a/tools/dep_updaters/update-undici.sh +++ b/tools/dep_updaters/update-undici.sh @@ -5,7 +5,7 @@ # This script must be in the tools directory when it runs because it uses the # script source file path to determine directories to work in. -set -e +set -ex ROOT=$(cd "$(dirname "$0")/../.." && pwd) DEPS_DIR="$ROOT/deps" @@ -40,29 +40,24 @@ compare_dependency_version "undici" "$NEW_VERSION" "$CURRENT_VERSION" rm -rf deps/undici/src rm -f deps/undici/undici.js -WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp') -echo "$WORKSPACE" +TARBALL=$(mktemp 2> /dev/null || mktemp -t 'tmp') + cleanup () { EXIT_CODE=$? - [ -d "$WORKSPACE" ] && rm -rf "$WORKSPACE" + [ -e "$TARBALL" ] && rm "$TARBALL" exit $EXIT_CODE } trap cleanup INT TERM EXIT -UNDICI_ZIP="undici-$NEW_VERSION" -cd "$WORKSPACE" - echo "Fetching UNDICI source archive..." -curl -sL -o "$UNDICI_ZIP.zip" "https://github.com/nodejs/undici/archive/refs/tags/v$NEW_VERSION.zip" +curl -fsSLo "$TARBALL" "https://github.com/nodejs/undici/archive/refs/tags/v$NEW_VERSION.tar.gz" -log_and_verify_sha256sum "undici" "$UNDICI_ZIP.zip" +log_and_verify_sha256sum "undici" "$TARBALL" echo "Unzipping..." -unzip "$UNDICI_ZIP.zip" -d "src" -mv "src/$UNDICI_ZIP" "$DEPS_DIR/undici/src" -rm "$UNDICI_ZIP.zip" -cd "$ROOT" +tar -xzf "$TARBALL" -C "$DEPS_DIR/undici" +mv "$DEPS_DIR/undici"/undici-* "$DEPS_DIR/undici/src" ( cd "$DEPS_DIR/undici/src" @@ -96,8 +91,8 @@ cat > "$ROOT/src/undici_version.h" <