Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added tools/dep_updaters/c-ares.kbx
Binary file not shown.
33 changes: 17 additions & 16 deletions tools/dep_updaters/update-c-ares.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
set -e
set -ex
# Shell script to update c-ares in the source tree to a specific version

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

IFS=' ' read -r NEW_VERSION NEW_VERSION_URL ARES_TARBALL <<EOF
IFS=' ' read -r NEW_VERSION NEW_VERSION_URL <<EOF
$NEW_VERSION_METADATA
EOF

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

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

cleanup () {
EXIT_CODE=$?
Expand All @@ -47,29 +48,29 @@ cleanup () {

trap cleanup INT TERM EXIT

cd "$WORKSPACE"

echo "Fetching c-ares source archive"
curl -sL -o "$ARES_TARBALL" "$NEW_VERSION_URL"
log_and_verify_sha256sum "c-ares" "$ARES_TARBALL"
gzip -dc "$ARES_TARBALL" | tar xf -
rm -- "$ARES_TARBALL"

FOLDER=$(ls -d -- */)
echo "Verifying PGP signature"
curl -sL -o "$ARES_TARBALL.asc" "$NEW_VERSION_URL.asc"
gpgv --keyring "$BASE_DIR/tools/dep_updaters/c-ares.kbx" "${ARES_TARBALL}.asc" "${ARES_TARBALL}"

log_and_verify_sha256sum "c-ares" "$ARES_TARBALL"
tar -C "$WORKSPACE" -xzf "$ARES_TARBALL"

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

echo "Removing tests"
rm -rf "$WORKSPACE/cares/test"
rm -rf "$ARES_FOLDER/test"

echo "Copying existing .gitignore, config, gyp and gn files"
cp -R "$DEPS_DIR/cares/config" "$WORKSPACE/cares"
cp "$DEPS_DIR/cares/.gitignore" "$WORKSPACE/cares"
cp "$DEPS_DIR/cares/cares.gyp" "$WORKSPACE/cares"
cp "$DEPS_DIR/cares/"*.gn "$DEPS_DIR/cares/"*.gni "$WORKSPACE/cares"
cp -R "$DEPS_DIR/cares/config" "$ARES_FOLDER"
cp "$DEPS_DIR/cares/.gitignore" "$ARES_FOLDER"
cp "$DEPS_DIR/cares/cares.gyp" "$ARES_FOLDER"
cp "$DEPS_DIR/cares/"*.gn "$DEPS_DIR/cares/"*.gni "$ARES_FOLDER"

echo "Replacing existing c-ares"
replace_dir "$DEPS_DIR/cares" "$WORKSPACE/cares"
replace_dir "$DEPS_DIR/cares" "$ARES_FOLDER"

echo "Updating cares.gyp"
"$NODE" "$ROOT/tools/dep_updaters/update-c-ares.mjs"
Expand Down
Loading