Skip to content

Commit 6e187db

Browse files
aduh95richardlau
authored andcommitted
tools: update c-ares updater script
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #64194 Reviewed-By: Richard Lau <richard.lau@ibm.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
1 parent 4e0236d commit 6e187db

2 files changed

Lines changed: 17 additions & 16 deletions

File tree

tools/dep_updaters/c-ares.kbx

4.12 KB
Binary file not shown.

tools/dep_updaters/update-c-ares.sh

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/sh
2-
set -e
2+
set -ex
33
# Shell script to update c-ares in the source tree to a specific version
44

55
BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd)
@@ -22,11 +22,11 @@ if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { ca
2222
const { tag_name, assets } = await res.json();
2323
const { browser_download_url, name } = assets.find(({ name }) => name.endsWith('.tar.gz'));
2424
if(!browser_download_url || !name) throw new Error('No tarball found');
25-
console.log(`${tag_name} ${browser_download_url} ${name}`);
25+
console.log(`${tag_name.replace(/^v/, '')} ${browser_download_url}`);
2626
EOF
2727
)"
2828

29-
IFS=' ' read -r NEW_VERSION NEW_VERSION_URL ARES_TARBALL <<EOF
29+
IFS=' ' read -r NEW_VERSION NEW_VERSION_URL <<EOF
3030
$NEW_VERSION_METADATA
3131
EOF
3232

@@ -38,6 +38,7 @@ compare_dependency_version "c-ares" "$NEW_VERSION" "$CURRENT_VERSION"
3838
echo "Making temporary workspace"
3939

4040
WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp')
41+
ARES_TARBALL="$WORKSPACE/c-ares.tgz"
4142

4243
cleanup () {
4344
EXIT_CODE=$?
@@ -47,29 +48,29 @@ cleanup () {
4748

4849
trap cleanup INT TERM EXIT
4950

50-
cd "$WORKSPACE"
51-
5251
echo "Fetching c-ares source archive"
5352
curl -sL -o "$ARES_TARBALL" "$NEW_VERSION_URL"
54-
log_and_verify_sha256sum "c-ares" "$ARES_TARBALL"
55-
gzip -dc "$ARES_TARBALL" | tar xf -
56-
rm -- "$ARES_TARBALL"
5753

58-
FOLDER=$(ls -d -- */)
54+
echo "Verifying PGP signature"
55+
curl -sL -o "$ARES_TARBALL.asc" "$NEW_VERSION_URL.asc"
56+
gpgv --keyring "$BASE_DIR/tools/dep_updaters/c-ares.kbx" "${ARES_TARBALL}.asc" "${ARES_TARBALL}"
57+
58+
log_and_verify_sha256sum "c-ares" "$ARES_TARBALL"
59+
tar -C "$WORKSPACE" -xzf "$ARES_TARBALL"
5960

60-
mv -- "$FOLDER" cares
61+
ARES_FOLDER=$(find "$WORKSPACE" -mindepth 1 -maxdepth 1 -type d -print -quit)
6162

6263
echo "Removing tests"
63-
rm -rf "$WORKSPACE/cares/test"
64+
rm -rf "$ARES_FOLDER/test"
6465

6566
echo "Copying existing .gitignore, config, gyp and gn files"
66-
cp -R "$DEPS_DIR/cares/config" "$WORKSPACE/cares"
67-
cp "$DEPS_DIR/cares/.gitignore" "$WORKSPACE/cares"
68-
cp "$DEPS_DIR/cares/cares.gyp" "$WORKSPACE/cares"
69-
cp "$DEPS_DIR/cares/"*.gn "$DEPS_DIR/cares/"*.gni "$WORKSPACE/cares"
67+
cp -R "$DEPS_DIR/cares/config" "$ARES_FOLDER"
68+
cp "$DEPS_DIR/cares/.gitignore" "$ARES_FOLDER"
69+
cp "$DEPS_DIR/cares/cares.gyp" "$ARES_FOLDER"
70+
cp "$DEPS_DIR/cares/"*.gn "$DEPS_DIR/cares/"*.gni "$ARES_FOLDER"
7071

7172
echo "Replacing existing c-ares"
72-
replace_dir "$DEPS_DIR/cares" "$WORKSPACE/cares"
73+
replace_dir "$DEPS_DIR/cares" "$ARES_FOLDER"
7374

7475
echo "Updating cares.gyp"
7576
"$NODE" "$ROOT/tools/dep_updaters/update-c-ares.mjs"

0 commit comments

Comments
 (0)