| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,19 +11,25 @@ DEPS_DIR="$BASE_DIR/deps" | |||
| 11 | 11 | # shellcheck disable=SC1091 | |
| 12 | 12 | . "$BASE_DIR/tools/dep_updaters/utils.sh" | |
| 13 | 13 | ||
| 14 | - NEW_VERSION="$("$NODE" --input-type=module <<'EOF' | ||
| 14 | + NEW_VERSION_METADATA="$("$NODE" --input-type=module <<'EOF' | ||
| 15 | 15 | const res = await fetch('https://api.github.com/repos/c-ares/c-ares/releases/latest', | |
| 16 | 16 | process.env.GITHUB_TOKEN && { | |
| 17 | 17 | headers: { | |
| 18 | 18 | "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` | |
| 19 | 19 | }, | |
| 20 | 20 | }); | |
| 21 | 21 | 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}`); | ||
| 24 | 26 | EOF | |
| 25 | 27 | )" | |
| 26 | 28 | ||
| 29 | + IFS=' ' read -r NEW_VERSION NEW_VERSION_URL ARES_TARBALL <<EOF | ||
| 30 | + $NEW_VERSION_METADATA | ||
| 31 | + EOF | ||
| 32 | + | ||
| 27 | 33 | CURRENT_VERSION=$(grep "#define ARES_VERSION_STR" ./deps/cares/include/ares_version.h | sed -n "s/^.*VERSION_STR \"\(.*\)\"/\1/p") | |
| 28 | 34 | ||
| 29 | 35 | # This function exit with 0 if new version and current version are the same | |
@@ -41,17 +47,17 @@ cleanup () { | |||
| 41 | 47 | ||
| 42 | 48 | trap cleanup INT TERM EXIT | |
| 43 | 49 | ||
| 44 | - ARES_REF="cares-$(echo "$NEW_VERSION" | tr . _)" | ||
| 45 | - ARES_TARBALL="c-ares-$NEW_VERSION.tar.gz" | ||
| 46 | - | ||
| 47 | 50 | cd "$WORKSPACE" | |
| 48 | 51 | ||
| 49 | 52 | 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" | ||
| 51 | 54 | log_and_verify_sha256sum "c-ares" "$ARES_TARBALL" | |
| 52 | 55 | 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 | ||
| 55 | 61 | ||
| 56 | 62 | echo "Removing tests" | |
| 57 | 63 | rm -rf "$WORKSPACE/cares/test" | |
| Back | FazBrowse Home | New Git URL |
0 commit comments