Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 96370a5

Browse filesBrowse files
committed
tools: simplify update-undici.sh
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #63044 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Richard Lau <richard.lau@ibm.com>
1 parent 214a8c1 commit 96370a5
Copy full SHA for 96370a5

1 file changed

+10-15Lines changed: 10 additions & 15 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎tools/dep_updaters/update-undici.sh‎

Copy file name to clipboardExpand all lines: tools/dep_updaters/update-undici.sh
+10-15Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# This script must be in the tools directory when it runs because it uses the
66
# script source file path to determine directories to work in.
77

8-
set -e
8+
set -ex
99

1010
ROOT=$(cd "$(dirname "$0")/../.." && pwd)
1111
DEPS_DIR="$ROOT/deps"
@@ -40,29 +40,24 @@ compare_dependency_version "undici" "$NEW_VERSION" "$CURRENT_VERSION"
4040
rm -rf deps/undici/src
4141
rm -f deps/undici/undici.js
4242

43-
WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp')
44-
echo "$WORKSPACE"
43+
TARBALL=$(mktemp 2> /dev/null || mktemp -t 'tmp')
44+
4545
cleanup () {
4646
EXIT_CODE=$?
47-
[ -d "$WORKSPACE" ] && rm -rf "$WORKSPACE"
47+
[ -e "$TARBALL" ] && rm "$TARBALL"
4848
exit $EXIT_CODE
4949
}
5050

5151
trap cleanup INT TERM EXIT
5252

53-
UNDICI_ZIP="undici-$NEW_VERSION"
54-
cd "$WORKSPACE"
55-
5653
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"
5855

59-
log_and_verify_sha256sum "undici" "$UNDICI_ZIP.zip"
56+
log_and_verify_sha256sum "undici" "$TARBALL"
6057

6158
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"
6661

6762
(
6863
cd "$DEPS_DIR/undici/src"
@@ -96,8 +91,8 @@ cat > "$ROOT/src/undici_version.h" <<EOF
9691
#endif // SRC_UNDICI_VERSION_H_
9792
EOF
9893

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"
10196

10297
# Update the version number on maintaining-dependencies.md
10398
# and print the new version as the last line of the script as we need

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.