Skip to content

Commit

Permalink
tools: fix linting problem in update-llhttp
Browse files Browse the repository at this point in the history
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Co-authored-by: Tobias Nießen <tniessen@tnie.de>
Co-authored-by: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
4 people committed Sep 16, 2022
1 parent fec21fc commit bcb763f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
6 changes: 3 additions & 3 deletions doc/contributing/maintaining-http.md
Expand Up @@ -78,12 +78,12 @@ are maintained in the [llhttp](https://github.com/nodejs/llhttp)
repository. Updates are pulled into Node.js under
[deps/llhttp](https://github.com/nodejs/node/tree/HEAD/deps/llhttp).

In order to update Node.js with a new version of llhttp you can use the
In order to update Node.js with a new version of llhttp you can use the
`tools/update-llhttp.sh` script.

The contents of the `deps/llhttp` folder should look like the following:

```sh
```bash
$ find deps/llhttp

deps/llhttp/
Expand All @@ -102,7 +102,7 @@ deps/llhttp/src/llhttp.c
```

After updating, make sure the version in `CMakeLists.txt` and `include/llhttp.h`
are the same and that they match the one you are expecting.
are the same and that they match the one you are expecting.

The low-level implementation is made available in the Node.js API through
JavaScript code in the [lib](https://github.com/nodejs/node/tree/HEAD/lib)
Expand Down
29 changes: 15 additions & 14 deletions tools/update-llhttp.sh
@@ -1,10 +1,11 @@
#!/bin/sh
set -e
# Shell script to update nghttp2 in the source treee to specific version
#!/bin/bash
set -euo pipefail
shopt -s inherit_errexit
# Shell script to update llhttp in the source tree to specific version

BASE_DIR="$( pwd )"/
DEPS_DIR="$BASE_DIR"deps/
LLHTTP_VERSION=$1
DEPS_DIR="${BASE_DIR}deps/"
LLHTTP_VERSION="$1"

if [ "$#" -le 0 ]; then
echo "Error: Please provide an llhttp version to update to."
Expand All @@ -24,32 +25,32 @@ trap cleanup INT TERM EXIT

cd "$WORKSPACE"

if echo $LLHTTP_VERSION | grep -s "/" > /dev/null; then # Download a release
REPO=git@github.com:$LLHTTP_VERSION.git
if echo "$LLHTTP_VERSION" | grep -qs "/" ; then # Download a release
REPO="git@github.com:$LLHTTP_VERSION.git"
BRANCH=$2
[ -z $BRANCH ] && BRANCH=main
[ -z "$BRANCH" ] && BRANCH=main

echo "Cloning llhttp source archive $REPO ..."
git clone $REPO llhttp
git clone "$REPO" llhttp
cd llhttp
echo "Checking out branch $BRANCH ..."
git checkout $BRANCH
git checkout "$BRANCH"

echo "Building llhtttp ..."
npm install
make release

echo "Copying llhtttp release ..."
rm -rf $DEPS_DIR/llhttp
cp -a release $DEPS_DIR/llhttp
rm -rf "$DEPS_DIR/llhttp"
cp -a release "$DEPS_DIR/llhttp"
else
echo "Download llhttp release $LLHTTP_VERSION ..."
curl -sL -o llhttp.tar.gz "https://github.com/nodejs/llhttp/archive/refs/tags/release/v$LLHTTP_VERSION.tar.gz"
gzip -dc llhttp.tar.gz | tar xf -

echo "Copying llhtttp release ..."
rm -rf $DEPS_DIR/llhttp
cp -a llhttp-release-v$LLHTTP_VERSION $DEPS_DIR/llhttp
rm -rf "$DEPS_DIR/llhttp"
cp -a "llhttp-release-v$LLHTTP_VERSION" "$DEPS_DIR/llhttp"
fi

echo ""
Expand Down

0 comments on commit bcb763f

Please sign in to comment.