| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent cbdaaf6 commit 2e7ba31
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -163,6 +163,14 @@ jobs: | |||
| 163 | 163 | echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV | |
| 164 | 164 | ./tools/update-llhttp.sh "$NEW_VERSION" | |
| 165 | 165 | fi | |
| 166 | + - id: c-ares | ||
| 167 | + subsystem: deps | ||
| 168 | + label: dependencies | ||
| 169 | + run: | | ||
| 170 | + ./tools/dep_updaters/update-c-ares.sh > temp-output | ||
| 171 | + cat temp-output | ||
| 172 | + tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true | ||
| 173 | + rm temp-output | ||
| 166 | 174 | steps: | |
| 167 | 175 | - uses: actions/checkout@v3 | |
| 168 | 176 | with: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,19 +13,11 @@ Updates to the c-ares dependency involve the following steps: | |||
| 13 | 13 | ||
| 14 | 14 | ## Running the update script | |
| 15 | 15 | ||
| 16 | - The `tools/update-cares.sh` script automates the update of the c-ares source | ||
| 17 | - files, preserving the existing files added by Node.js. | ||
| 16 | + The `tools/dep_updaters/update-c-ares.sh` script automates the update of | ||
| 17 | + the c-ares source files, preserving the existing files added by Node.js. | ||
| 18 | 18 | ||
| 19 | - In the following examples, `x.y.z` should match the c-ares version to update to. | ||
| 20 | - | ||
| 21 | - ```console | ||
| 22 | - ./tools/update-cares.sh x.y.z | ||
| 23 | - ``` | ||
| 24 | - | ||
| 25 | - e.g. | ||
| 26 | - | ||
| 27 | - ```console | ||
| 28 | - ./tools/update-cares.sh 1.18.1 | ||
| 19 | + ```bash | ||
| 20 | + ./tools/dep_updaters/update-c-ares.sh | ||
| 29 | 21 | ``` | |
| 30 | 22 | ||
| 31 | 23 | ## Check that Node.js still builds and tests | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,71 @@ | |||
| 1 | + #!/bin/sh | ||
| 2 | + set -e | ||
| 3 | + # Shell script to update c-ares in the source tree to a specific version | ||
| 4 | + | ||
| 5 | + BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd) | ||
| 6 | + DEPS_DIR="$BASE_DIR/deps" | ||
| 7 | + | ||
| 8 | + [ -z "$NODE" ] && NODE="$BASE_DIR/out/Release/node" | ||
| 9 | + [ -x "$NODE" ] || NODE=$(command -v node) | ||
| 10 | + | ||
| 11 | + NEW_VERSION="$("$NODE" --input-type=module <<'EOF' | ||
| 12 | + const res = await fetch('https://api.github.com/repos/c-ares/c-ares/releases/latest'); | ||
| 13 | + if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); | ||
| 14 | + const { tag_name } = await res.json(); | ||
| 15 | + console.log(tag_name.replace('cares-', '').replaceAll('_', '.')); | ||
| 16 | + EOF | ||
| 17 | + )" | ||
| 18 | + | ||
| 19 | + CURRENT_VERSION=$(grep "#define ARES_VERSION_STR" ./deps/cares/include/ares_version.h | sed -n "s/^.*VERSION_STR \"\(.*\)\"/\1/p") | ||
| 20 | + | ||
| 21 | + echo "Comparing $NEW_VERSION with $CURRENT_VERSION" | ||
| 22 | + | ||
| 23 | + if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then | ||
| 24 | + echo "Skipped because c-ares is on the latest version." | ||
| 25 | + exit 0 | ||
| 26 | + fi | ||
| 27 | + | ||
| 28 | + echo "Making temporary workspace" | ||
| 29 | + | ||
| 30 | + WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp') | ||
| 31 | + | ||
| 32 | + cleanup () { | ||
| 33 | + EXIT_CODE=$? | ||
| 34 | + [ -d "$WORKSPACE" ] && rm -rf "$WORKSPACE" | ||
| 35 | + exit $EXIT_CODE | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + trap cleanup INT TERM EXIT | ||
| 39 | + | ||
| 40 | + ARES_REF="cares-$(echo "$NEW_VERSION" | tr . _)" | ||
| 41 | + ARES_TARBALL="c-ares-$NEW_VERSION.tar.gz" | ||
| 42 | + | ||
| 43 | + cd "$WORKSPACE" | ||
| 44 | + | ||
| 45 | + echo "Fetching c-ares source archive" | ||
| 46 | + curl -sL "https://github.com/c-ares/c-ares/releases/download/$ARES_REF/$ARES_TARBALL" | tar xz | ||
| 47 | + mv "c-ares-$NEW_VERSION" cares | ||
| 48 | + | ||
| 49 | + echo "Removing tests" | ||
| 50 | + rm -rf "$WORKSPACE/cares/test" | ||
| 51 | + | ||
| 52 | + echo "Copying existing .gitignore, config and gyp files" | ||
| 53 | + cp -R "$DEPS_DIR/cares/config" "$WORKSPACE/cares" | ||
| 54 | + cp "$DEPS_DIR/cares/.gitignore" "$WORKSPACE/cares" | ||
| 55 | + cp "$DEPS_DIR/cares/cares.gyp" "$WORKSPACE/cares" | ||
| 56 | + | ||
| 57 | + echo "Replacing existing c-ares" | ||
| 58 | + rm -rf "$DEPS_DIR/cares" | ||
| 59 | + mv "$WORKSPACE/cares" "$DEPS_DIR/" | ||
| 60 | + | ||
| 61 | + echo "All done!" | ||
| 62 | + echo "" | ||
| 63 | + echo "Please git add c-ares, commit the new version:" | ||
| 64 | + echo "" | ||
| 65 | + echo "$ git add -A deps/cares" | ||
| 66 | + echo "$ git commit -m \"deps: update c-ares to $NEW_VERSION\"" | ||
| 67 | + echo "" | ||
| 68 | + | ||
| 69 | + # The last line of the script should always print the new version, | ||
| 70 | + # as we need to add it to $GITHUB_ENV variable. | ||
| 71 | + echo "NEW_VERSION=$NEW_VERSION" | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments