| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a21459e commit 0b78ac5
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -150,15 +150,10 @@ jobs: | |||
| 150 | 150 | subsystem: deps | |
| 151 | 151 | label: dependencies | |
| 152 | 152 | run: | | |
| 153 | - NEW_VERSION=$(gh api repos/nodejs/llhttp/releases/latest -q '.tag_name|ltrimstr("release/v")') | ||
| 154 | - CURRENT_MAJOR_VERSION=$(grep "#define LLHTTP_VERSION_MAJOR" ./deps/llhttp/include/llhttp.h | sed -n "s/^.*MAJOR \(.*\)/\1/p") | ||
| 155 | - CURRENT_MINOR_VERSION=$(grep "#define LLHTTP_VERSION_MINOR" ./deps/llhttp/include/llhttp.h | sed -n "s/^.*MINOR \(.*\)/\1/p") | ||
| 156 | - CURRENT_PATCH_VERSION=$(grep "#define LLHTTP_VERSION_PATCH" ./deps/llhttp/include/llhttp.h | sed -n "s/^.*PATCH \(.*\)/\1/p") | ||
| 157 | - CURRENT_VERSION="$CURRENT_MAJOR_VERSION.$CURRENT_MINOR_VERSION.$CURRENT_PATCH_VERSION" | ||
| 158 | - if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then | ||
| 159 | - echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV | ||
| 160 | - ./tools/update-llhttp.sh "$NEW_VERSION" | ||
| 161 | - fi | ||
| 153 | + ./tools/dep_updaters/update-llhttp.sh > temp-output | ||
| 154 | + cat temp-output | ||
| 155 | + tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true | ||
| 156 | + rm temp-output | ||
| 162 | 157 | - id: c-ares | |
| 163 | 158 | subsystem: deps | |
| 164 | 159 | label: dependencies | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -79,7 +79,7 @@ repository. Updates are pulled into Node.js under | |||
| 79 | 79 | [deps/llhttp](https://github.com/nodejs/node/tree/HEAD/deps/llhttp). | |
| 80 | 80 | ||
| 81 | 81 | In order to update Node.js with a new version of llhttp you can use the | |
| 82 | - `tools/update-llhttp.sh` script. | ||
| 82 | + `tools/dep_updaters/update-llhttp.sh` script. | ||
| 83 | 83 | ||
| 84 | 84 | The contents of the `deps/llhttp` folder should look like the following: | |
| 85 | 85 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,83 @@ | |||
| 1 | + #!/bin/sh | ||
| 2 | + set -e | ||
| 3 | + | ||
| 4 | + # Shell script to update llhttp in the source tree to specific version | ||
| 5 | + | ||
| 6 | + BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd) | ||
| 7 | + DEPS_DIR="${BASE_DIR}/deps" | ||
| 8 | + | ||
| 9 | + [ -z "$NODE" ] && NODE="$BASE_DIR/out/Release/node" | ||
| 10 | + [ -x "$NODE" ] || NODE=$(command -v node) | ||
| 11 | + | ||
| 12 | + NEW_VERSION="$("$NODE" --input-type=module <<'EOF' | ||
| 13 | + const res = await fetch('https://api.github.com/repos/nodejs/llhttp/releases/latest'); | ||
| 14 | + if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); | ||
| 15 | + const { tag_name } = await res.json(); | ||
| 16 | + console.log(tag_name.replace('release/v', '')); | ||
| 17 | + EOF | ||
| 18 | + )" | ||
| 19 | + | ||
| 20 | + CURRENT_MAJOR_VERSION=$(grep "#define LLHTTP_VERSION_MAJOR" ./deps/llhttp/include/llhttp.h | sed -n "s/^.*MAJOR \(.*\)/\1/p") | ||
| 21 | + CURRENT_MINOR_VERSION=$(grep "#define LLHTTP_VERSION_MINOR" ./deps/llhttp/include/llhttp.h | sed -n "s/^.*MINOR \(.*\)/\1/p") | ||
| 22 | + CURRENT_PATCH_VERSION=$(grep "#define LLHTTP_VERSION_PATCH" ./deps/llhttp/include/llhttp.h | sed -n "s/^.*PATCH \(.*\)/\1/p") | ||
| 23 | + CURRENT_VERSION="$CURRENT_MAJOR_VERSION.$CURRENT_MINOR_VERSION.$CURRENT_PATCH_VERSION" | ||
| 24 | + | ||
| 25 | + echo "Comparing $NEW_VERSION with $CURRENT_VERSION" | ||
| 26 | + | ||
| 27 | + if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then | ||
| 28 | + echo "Skipped because llhttp is on the latest version." | ||
| 29 | + exit 0 | ||
| 30 | + fi | ||
| 31 | + | ||
| 32 | + cleanup () { | ||
| 33 | + EXIT_CODE=$? | ||
| 34 | + [ -d "$WORKSPACE" ] && rm -rf "$WORKSPACE" | ||
| 35 | + exit $EXIT_CODE | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + echo "Making temporary workspace ..." | ||
| 39 | + WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp') | ||
| 40 | + trap cleanup INT TERM EXIT | ||
| 41 | + | ||
| 42 | + cd "$WORKSPACE" | ||
| 43 | + | ||
| 44 | + if echo "$NEW_VERSION" | grep -qs "/" ; then # Download a release | ||
| 45 | + REPO="git@github.com:$NEW_VERSION.git" | ||
| 46 | + BRANCH=$2 | ||
| 47 | + [ -z "$BRANCH" ] && BRANCH=main | ||
| 48 | + | ||
| 49 | + echo "Cloning llhttp source archive $REPO ..." | ||
| 50 | + git clone "$REPO" llhttp | ||
| 51 | + cd llhttp | ||
| 52 | + echo "Checking out branch $BRANCH ..." | ||
| 53 | + git checkout "$BRANCH" | ||
| 54 | + | ||
| 55 | + echo "Building llhtttp ..." | ||
| 56 | + npm install | ||
| 57 | + make release | ||
| 58 | + | ||
| 59 | + echo "Copying llhtttp release ..." | ||
| 60 | + rm -rf "$DEPS_DIR/llhttp" | ||
| 61 | + cp -a release "$DEPS_DIR/llhttp" | ||
| 62 | + else | ||
| 63 | + echo "Download llhttp release $NEW_VERSION ..." | ||
| 64 | + curl -sL -o llhttp.tar.gz "https://github.com/nodejs/llhttp/archive/refs/tags/release/v$NEW_VERSION.tar.gz" | ||
| 65 | + gzip -dc llhttp.tar.gz | tar xf - | ||
| 66 | + | ||
| 67 | + echo "Copying llhtttp release ..." | ||
| 68 | + rm -rf "$DEPS_DIR/llhttp" | ||
| 69 | + cp -a "llhttp-release-v$NEW_VERSION" "$DEPS_DIR/llhttp" | ||
| 70 | + fi | ||
| 71 | + | ||
| 72 | + echo "" | ||
| 73 | + echo "All done!" | ||
| 74 | + echo "" | ||
| 75 | + echo "Please git add llhttp, commit the new version:" | ||
| 76 | + echo "" | ||
| 77 | + echo "$ git add -A deps/llhttp" | ||
| 78 | + echo "$ git commit -m \"deps: update llhttp to $NEW_VERSION\"" | ||
| 79 | + echo "" | ||
| 80 | + | ||
| 81 | + # The last line of the script should always print the new version, | ||
| 82 | + # as we need to add it to $GITHUB_ENV variable. | ||
| 83 | + echo "NEW_VERSION=$NEW_VERSION" | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments