|
5 | 5 | # This script must be in the tools directory when it runs because it uses the |
6 | 6 | # script source file path to determine directories to work in. |
7 | 7 |
|
8 | | -set -e |
| 8 | +set -ex |
9 | 9 |
|
10 | 10 | ROOT=$(cd "$(dirname "$0")/../.." && pwd) |
11 | 11 | DEPS_DIR="$ROOT/deps" |
@@ -40,29 +40,24 @@ compare_dependency_version "undici" "$NEW_VERSION" "$CURRENT_VERSION" |
40 | 40 | rm -rf deps/undici/src |
41 | 41 | rm -f deps/undici/undici.js |
42 | 42 |
|
43 | | -WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp') |
44 | | -echo "$WORKSPACE" |
| 43 | +TARBALL=$(mktemp 2> /dev/null || mktemp -t 'tmp') |
| 44 | + |
45 | 45 | cleanup () { |
46 | 46 | EXIT_CODE=$? |
47 | | - [ -d "$WORKSPACE" ] && rm -rf "$WORKSPACE" |
| 47 | + [ -e "$TARBALL" ] && rm "$TARBALL" |
48 | 48 | exit $EXIT_CODE |
49 | 49 | } |
50 | 50 |
|
51 | 51 | trap cleanup INT TERM EXIT |
52 | 52 |
|
53 | | -UNDICI_ZIP="undici-$NEW_VERSION" |
54 | | -cd "$WORKSPACE" |
55 | | - |
56 | 53 | echo "Fetching UNDICI source archive..." |
57 | | -curl -sL -o "$UNDICI_ZIP.zip" "https://github.com/nodejs/undici/archive/refs/tags/v$NEW_VERSION.zip" |
| 54 | +curl -fsSLo "$TARBALL" "https://github.com/nodejs/undici/archive/refs/tags/v$NEW_VERSION.tar.gz" |
58 | 55 |
|
59 | | -log_and_verify_sha256sum "undici" "$UNDICI_ZIP.zip" |
| 56 | +log_and_verify_sha256sum "undici" "$TARBALL" |
60 | 57 |
|
61 | 58 | echo "Unzipping..." |
62 | | -unzip "$UNDICI_ZIP.zip" -d "src" |
63 | | -mv "src/$UNDICI_ZIP" "$DEPS_DIR/undici/src" |
64 | | -rm "$UNDICI_ZIP.zip" |
65 | | -cd "$ROOT" |
| 59 | +tar -xzf "$TARBALL" -C "$DEPS_DIR/undici" |
| 60 | +mv "$DEPS_DIR/undici"/undici-* "$DEPS_DIR/undici/src" |
66 | 61 |
|
67 | 62 | ( |
68 | 63 | cd "$DEPS_DIR/undici/src" |
@@ -96,8 +91,8 @@ cat > "$ROOT/src/undici_version.h" <<EOF |
96 | 91 | #endif // SRC_UNDICI_VERSION_H_ |
97 | 92 | EOF |
98 | 93 |
|
99 | | -mv deps/undici/src/undici-fetch.js deps/undici/undici.js |
100 | | -cp deps/undici/src/LICENSE deps/undici/LICENSE |
| 94 | +mv "$DEPS_DIR/undici/src/undici-fetch.js" "$DEPS_DIR/undici/undici.js" |
| 95 | +cp "$DEPS_DIR/undici/src/LICENSE" "$DEPS_DIR/undici/LICENSE" |
101 | 96 |
|
102 | 97 | # Update the version number on maintaining-dependencies.md |
103 | 98 | # and print the new version as the last line of the script as we need |
|
0 commit comments