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 b133019

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 ff86b1d commit b133019
Copy full SHA for b133019

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"
@@ -36,29 +36,24 @@ compare_dependency_version "undici" "$NEW_VERSION" "$CURRENT_VERSION"
3636
rm -rf deps/undici/src
3737
rm -f deps/undici/undici.js
3838

39-
WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp')
40-
echo "$WORKSPACE"
39+
TARBALL=$(mktemp 2> /dev/null || mktemp -t 'tmp')
40+
4141
cleanup () {
4242
EXIT_CODE=$?
43-
[ -d "$WORKSPACE" ] && rm -rf "$WORKSPACE"
43+
[ -e "$TARBALL" ] && rm "$TARBALL"
4444
exit $EXIT_CODE
4545
}
4646

4747
trap cleanup INT TERM EXIT
4848

49-
UNDICI_ZIP="undici-$NEW_VERSION"
50-
cd "$WORKSPACE"
51-
5249
echo "Fetching UNDICI source archive..."
53-
curl -sL -o "$UNDICI_ZIP.zip" "https://github.com/nodejs/undici/archive/refs/tags/v$NEW_VERSION.zip"
50+
curl -fsSLo "$TARBALL" "https://github.com/nodejs/undici/archive/refs/tags/v$NEW_VERSION.tar.gz"
5451

55-
log_and_verify_sha256sum "undici" "$UNDICI_ZIP.zip"
52+
log_and_verify_sha256sum "undici" "$TARBALL"
5653

5754
echo "Unzipping..."
58-
unzip "$UNDICI_ZIP.zip" -d "src"
59-
mv "src/$UNDICI_ZIP" "$DEPS_DIR/undici/src"
60-
rm "$UNDICI_ZIP.zip"
61-
cd "$ROOT"
55+
tar -xzf "$TARBALL" -C "$DEPS_DIR/undici"
56+
mv "$DEPS_DIR/undici"/undici-* "$DEPS_DIR/undici/src"
6257

6358
(
6459
cd "$DEPS_DIR/undici/src"
@@ -92,8 +87,8 @@ cat > "$ROOT/src/undici_version.h" <<EOF
9287
#endif // SRC_UNDICI_VERSION_H_
9388
EOF
9489

95-
mv deps/undici/src/undici-fetch.js deps/undici/undici.js
96-
cp deps/undici/src/LICENSE deps/undici/LICENSE
90+
mv "$DEPS_DIR/undici/src/undici-fetch.js" "$DEPS_DIR/undici/undici.js"
91+
cp "$DEPS_DIR/undici/src/LICENSE" "$DEPS_DIR/undici/LICENSE"
9792

9893
# Update the version number on maintaining-dependencies.md
9994
# 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.