Skip to content

Commit fe85e05

Browse files
marco-ippolitotargos
authored andcommitted
tools: fix c-ares update script
PR-URL: #53414 Fixes: #53407 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 8eb7bdf commit fe85e05

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

tools/dep_updaters/update-c-ares.sh

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,25 @@ DEPS_DIR="$BASE_DIR/deps"
1111
# shellcheck disable=SC1091
1212
. "$BASE_DIR/tools/dep_updaters/utils.sh"
1313

14-
NEW_VERSION="$("$NODE" --input-type=module <<'EOF'
14+
NEW_VERSION_METADATA="$("$NODE" --input-type=module <<'EOF'
1515
const res = await fetch('https://api.github.com/repos/c-ares/c-ares/releases/latest',
1616
process.env.GITHUB_TOKEN && {
1717
headers: {
1818
"Authorization": `Bearer ${process.env.GITHUB_TOKEN}`
1919
},
2020
});
2121
if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res });
22-
const { tag_name } = await res.json();
23-
console.log(tag_name.replace('cares-', '').replaceAll('_', '.'));
22+
const { tag_name, assets } = await res.json();
23+
const { browser_download_url, name } = assets.find(({ name }) => name.endsWith('.tar.gz'));
24+
if(!browser_download_url || !name) throw new Error('No tarball found');
25+
console.log(`${tag_name} ${browser_download_url} ${name}`);
2426
EOF
2527
)"
2628

29+
IFS=' ' read -r NEW_VERSION NEW_VERSION_URL ARES_TARBALL <<EOF
30+
$NEW_VERSION_METADATA
31+
EOF
32+
2733
CURRENT_VERSION=$(grep "#define ARES_VERSION_STR" ./deps/cares/include/ares_version.h | sed -n "s/^.*VERSION_STR \"\(.*\)\"/\1/p")
2834

2935
# This function exit with 0 if new version and current version are the same
@@ -41,17 +47,17 @@ cleanup () {
4147

4248
trap cleanup INT TERM EXIT
4349

44-
ARES_REF="cares-$(echo "$NEW_VERSION" | tr . _)"
45-
ARES_TARBALL="c-ares-$NEW_VERSION.tar.gz"
46-
4750
cd "$WORKSPACE"
4851

4952
echo "Fetching c-ares source archive"
50-
curl -sL -o "$ARES_TARBALL" "https://github.com/c-ares/c-ares/releases/download/$ARES_REF/$ARES_TARBALL"
53+
curl -sL -o "$ARES_TARBALL" "$NEW_VERSION_URL"
5154
log_and_verify_sha256sum "c-ares" "$ARES_TARBALL"
5255
gzip -dc "$ARES_TARBALL" | tar xf -
53-
rm "$ARES_TARBALL"
54-
mv "c-ares-$NEW_VERSION" cares
56+
rm -- "$ARES_TARBALL"
57+
58+
FOLDER=$(ls -d -- */)
59+
60+
mv -- "$FOLDER" cares
5561

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy