mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
tools: standardize update-nghttp2.sh
PR-URL: https://github.com/nodejs/node/pull/47197 Refs: https://github.com/nodejs/security-wg/issues/828 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
1 parent
7019d48ba1
commit
05cb503f02
3 files changed
+32
-23
No files matched your search
@@ -134,12 +134,10 @@ jobs:
|
||||
subsystem: deps
|
||||
label: dependencies
|
||||
run: |
|
||||
NEW_VERSION=$(gh api repos/nghttp2/nghttp2/releases/latest -q '.tag_name|ltrimstr("v")')
|
||||
CURRENT_VERSION=$(grep "#define NGHTTP2_VERSION" ./deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h | sed -n "s/^.*VERSION \(.*\)/\1/p")
|
||||
if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then
|
||||
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
|
||||
./tools/update-nghttp2.sh "$NEW_VERSION"
|
||||
fi
|
||||
./tools/dep_updaters/nghttp2.sh > temp-output
|
||||
cat temp-output
|
||||
tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
|
||||
rm temp-output
|
||||
- id: llhttp
|
||||
subsystem: deps
|
||||
label: dependencies
|
||||
|
||||
@@ -13,16 +13,9 @@ directory and C++ code in the
|
||||
|
||||
## Step 1: Updating nghttp2
|
||||
|
||||
The `tools/update-nghttp2.sh` script automates the update of the
|
||||
The `tools/dep_updaters/update-nghttp2.sh` script automates the update of the
|
||||
postject source files.
|
||||
|
||||
In the following examples, `x.y.z` should match the nghttp2
|
||||
version to update to.
|
||||
|
||||
```console
|
||||
$ ./tools/update-nghttp2.sh x.y.z
|
||||
```
|
||||
|
||||
## Step 2: Test the build
|
||||
|
||||
```console
|
||||
|
||||
@@ -2,13 +2,27 @@
|
||||
set -e
|
||||
# Shell script to update nghttp2 in the source tree to specific version
|
||||
|
||||
BASE_DIR=$(cd "$(dirname "$0")/.." && pwd)
|
||||
BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd)
|
||||
DEPS_DIR="$BASE_DIR/deps"
|
||||
NGHTTP2_VERSION=$1
|
||||
|
||||
if [ "$#" -le 0 ]; then
|
||||
echo "Error: please provide an nghttp2 version to update to"
|
||||
exit 1
|
||||
[ -z "$NODE" ] && NODE="$BASE_DIR/out/Release/node"
|
||||
[ -x "$NODE" ] || NODE=$(command -v node)
|
||||
|
||||
NEW_VERSION="$("$NODE" --input-type=module <<'EOF'
|
||||
const res = await fetch('https://api.github.com/repos/nghttp2/nghttp2/releases/latest');
|
||||
if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res });
|
||||
const { tag_name } = await res.json();
|
||||
console.log(tag_name.replace('v', ''));
|
||||
EOF
|
||||
)"
|
||||
|
||||
CURRENT_VERSION=$(grep "#define NGHTTP2_VERSION" ./deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h | sed -n "s/^.*VERSION \"\(.*\)\"/\1/p")
|
||||
|
||||
echo "Comparing $NEW_VERSION with $CURRENT_VERSION"
|
||||
|
||||
if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then
|
||||
echo "Skipped because nghttp2 is on the latest version."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Making temporary workspace"
|
||||
@@ -23,8 +37,8 @@ cleanup () {
|
||||
|
||||
trap cleanup INT TERM EXIT
|
||||
|
||||
NGHTTP2_REF="v$NGHTTP2_VERSION"
|
||||
NGHTTP2_TARBALL="nghttp2-$NGHTTP2_VERSION.tar.gz"
|
||||
NGHTTP2_REF="v$NEW_VERSION"
|
||||
NGHTTP2_TARBALL="nghttp2-$NEW_VERSION.tar.gz"
|
||||
|
||||
cd "$WORKSPACE"
|
||||
|
||||
@@ -32,7 +46,7 @@ echo "Fetching nghttp2 source archive"
|
||||
curl -sL -o "$NGHTTP2_TARBALL" "https://github.com/nghttp2/nghttp2/releases/download/$NGHTTP2_REF/$NGHTTP2_TARBALL"
|
||||
gzip -dc "$NGHTTP2_TARBALL" | tar xf -
|
||||
rm "$NGHTTP2_TARBALL"
|
||||
mv "nghttp2-$NGHTTP2_VERSION" nghttp2
|
||||
mv "nghttp2-$NEW_VERSION" nghttp2
|
||||
|
||||
echo "Removing everything, except lib/ and COPYING"
|
||||
cd nghttp2
|
||||
@@ -59,5 +73,9 @@ echo ""
|
||||
echo "Please git add nghttp2, commit the new version:"
|
||||
echo ""
|
||||
echo "$ git add -A deps/nghttp2"
|
||||
echo "$ git commit -m \"deps: update nghttp2 to $NGHTTP2_VERSION\""
|
||||
echo "$ git commit -m \"deps: update nghttp2 to $NEW_VERSION\""
|
||||
echo ""
|
||||
|
||||
# The last line of the script should always print the new version,
|
||||
# as we need to add it to $GITHUB_ENV variable.
|
||||
echo "NEW_VERSION=$NEW_VERSION"
|
||||
Reference in new issue
Block a user