tools: recognize GN files in dep_updaters

PR-URL: https://github.com/nodejs/node/pull/50693
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Tierney Cyren <hello@bnb.im>
Reviewed-By: Michael Dawson <midawson@redhat.com>
This commit is contained in:
Cheng Zhao 2023-11-15 13:37:09 +09:00 committed by GitHub
parent 5a94df4b53
commit 1d8483e713
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 53 additions and 23 deletions

View File

@ -54,8 +54,8 @@ rm "$ADA_ZIP"
curl -sL -o "$ADA_LICENSE" "https://raw.githubusercontent.com/ada-url/ada/HEAD/LICENSE-MIT"
echo "Replacing existing ada (except GYP build files)"
mv "$DEPS_DIR/ada/"*.gyp "$DEPS_DIR/ada/README.md" "$WORKSPACE/"
echo "Replacing existing ada (except GYP and GN build files)"
mv "$DEPS_DIR/ada/"*.gyp "$DEPS_DIR/ada/"*.gn "$DEPS_DIR/ada/"*.gni "$DEPS_DIR/ada/README.md" "$WORKSPACE/"
rm -rf "$DEPS_DIR/ada"
mv "$WORKSPACE" "$DEPS_DIR/ada"

View File

@ -60,12 +60,15 @@ mv "brotli-$NEW_VERSION" "brotli"
echo "Copying existing gyp file"
cp "$DEPS_DIR/brotli/brotli.gyp" "$WORKSPACE/brotli"
echo "Copying existing GN files"
cp "$DEPS_DIR/brotli/"*.gn "$DEPS_DIR/brotli/"*.gni "$WORKSPACE/brotli"
echo "Deleting existing brotli"
rm -rf "$DEPS_DIR/brotli"
mkdir "$DEPS_DIR/brotli"
echo "Update c and LICENSE"
mv "$WORKSPACE/brotli/c" "$WORKSPACE/brotli/LICENSE" "$WORKSPACE/brotli/brotli.gyp" "$DEPS_DIR/brotli"
mv "$WORKSPACE/brotli/"*.gn "$WORKSPACE/brotli/"*.gni "$WORKSPACE/brotli/c" "$WORKSPACE/brotli/LICENSE" "$WORKSPACE/brotli/brotli.gyp" "$DEPS_DIR/brotli"
# Update the version number on maintaining-dependencies.md
# and print the new version as the last line of the script as we need

View File

@ -56,10 +56,11 @@ mv "c-ares-$NEW_VERSION" cares
echo "Removing tests"
rm -rf "$WORKSPACE/cares/test"
echo "Copying existing .gitignore, config and gyp files"
echo "Copying existing .gitignore, config, gyp and gn files"
cp -R "$DEPS_DIR/cares/config" "$WORKSPACE/cares"
cp "$DEPS_DIR/cares/.gitignore" "$WORKSPACE/cares"
cp "$DEPS_DIR/cares/cares.gyp" "$WORKSPACE/cares"
cp "$DEPS_DIR/cares/"*.gn "$DEPS_DIR/cares/"*.gni "$WORKSPACE/cares"
echo "Replacing existing c-ares"
rm -rf "$DEPS_DIR/cares"

View File

@ -59,8 +59,8 @@ gzip -dc "$LIBUV_TARBALL" | tar xf -
rm "$LIBUV_TARBALL"
mv libuv-libuv-* uv
echo "Replacing existing libuv (except GYP build files)"
mv "$DEPS_DIR/uv/"*.gyp "$DEPS_DIR/uv/"*.gypi "$WORKSPACE/uv/"
echo "Replacing existing libuv (except GYP and GN build files)"
mv "$DEPS_DIR/uv/"*.gyp "$DEPS_DIR/uv/"*.gypi "$DEPS_DIR/uv/"*.gn "$DEPS_DIR/uv/"*.gni "$WORKSPACE/uv/"
rm -rf "$DEPS_DIR/uv"
mv "$WORKSPACE/uv" "$DEPS_DIR/"

View File

@ -45,6 +45,9 @@ trap cleanup INT TERM EXIT
cd "$WORKSPACE"
echo "Replacing existing llhttp (except GYP and GN build files)"
mv "$DEPS_DIR/llhttp/"*.gn "$DEPS_DIR/llhttp/"*.gni "$WORKSPACE/"
if echo "$NEW_VERSION" | grep -qs "/" ; then # Download a release
REPO="git@github.com:$NEW_VERSION.git"
BRANCH=$2
@ -74,6 +77,8 @@ else
cp -a "llhttp-release-v$NEW_VERSION" "$DEPS_DIR/llhttp"
fi
mv "$WORKSPACE/"*.gn "$WORKSPACE/"*.gni "$DEPS_DIR/llhttp"
# Update the version number on maintaining-dependencies.md
# and print the new version as the last line of the script as we need
# to add it to $GITHUB_ENV variable

View File

@ -73,6 +73,9 @@ cp "$DEPS_DIR/nghttp2/lib/includes/config.h" "$WORKSPACE/nghttp2/lib/includes"
echo "Copying existing gyp files"
cp "$DEPS_DIR/nghttp2/nghttp2.gyp" "$WORKSPACE/nghttp2"
echo "Copying existing GN files"
cp "$DEPS_DIR/nghttp2/"*.gn "$DEPS_DIR/nghttp2/"*.gni "$WORKSPACE/nghttp2"
echo "Replacing existing nghttp2"
rm -rf "$DEPS_DIR/nghttp2"
mv "$WORKSPACE/nghttp2" "$DEPS_DIR/"

View File

@ -7,13 +7,14 @@
set -ex
ROOT=$(cd "$(dirname "$0")/../.." && pwd)
[ -z "$NODE" ] && NODE="$ROOT/out/Release/node"
BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd)
DEPS_DIR="$BASE_DIR/deps"
[ -z "$NODE" ] && NODE="$BASE_DIR/out/Release/node"
[ -x "$NODE" ] || NODE=$(command -v node)
NPM="$ROOT/deps/npm/bin/npm-cli.js"
NPM="$BASE_DIR/deps/npm/bin/npm-cli.js"
# shellcheck disable=SC1091
. "$ROOT/tools/dep_updaters/utils.sh"
. "$BASE_DIR/tools/dep_updaters/utils.sh"
NEW_VERSION=$("$NODE" "$NPM" view postject dist-tags.latest)
CURRENT_VERSION=$("$NODE" -p "require('./test/fixtures/postject-copy/node_modules/postject/package.json').version")
@ -21,21 +22,34 @@ CURRENT_VERSION=$("$NODE" -p "require('./test/fixtures/postject-copy/node_module
# This function exit with 0 if new version and current version are the same
compare_dependency_version "postject" "$NEW_VERSION" "$CURRENT_VERSION"
cd "$( dirname "$0" )/../.." || exit
rm -rf test/fixtures/postject-copy
mkdir test/fixtures/postject-copy
cd test/fixtures/postject-copy || exit
echo "Making temporary workspace..."
WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp')
cleanup () {
EXIT_CODE=$?
[ -d "$WORKSPACE" ] && rm -rf "$WORKSPACE"
exit $EXIT_CODE
}
trap cleanup INT TERM EXIT
cd "$WORKSPACE"
echo "Installing postject npm package..."
"$NODE" "$NPM" init --yes
"$NODE" "$NPM" install --no-bin-links --ignore-scripts "postject@$NEW_VERSION"
# TODO(RaisinTen): Replace following with $WORKSPACE
cd ../../..
rm -rf deps/postject
mkdir deps/postject
cp test/fixtures/postject-copy/node_modules/postject/LICENSE deps/postject
cp test/fixtures/postject-copy/node_modules/postject/dist/postject-api.h deps/postject
echo "Replacing existing postject (except GN build files)"
mv "$DEPS_DIR/postject/"*.gn "$DEPS_DIR/postject/"*.gni "$WORKSPACE/"
rm -rf "$DEPS_DIR/postject"
mkdir "$DEPS_DIR/postject"
mv "$WORKSPACE/"*.gn "$WORKSPACE/"*.gni "$DEPS_DIR/postject"
mv "$WORKSPACE/node_modules/postject/LICENSE" "$DEPS_DIR/postject"
mv "$WORKSPACE/node_modules/postject/dist/postject-api.h" "$DEPS_DIR/postject"
# Update the version number on maintaining-dependencies.md
# and print the new version as the last line of the script as we need

View File

@ -54,8 +54,8 @@ rm ./*_demo.cpp
curl -sL -o "$SIMDUTF_LICENSE" "https://raw.githubusercontent.com/simdutf/simdutf/HEAD/LICENSE-MIT"
echo "Replacing existing simdutf (except GYP build files)"
mv "$DEPS_DIR/simdutf/"*.gyp "$DEPS_DIR/simdutf/README.md" "$WORKSPACE/"
echo "Replacing existing simdutf (except GYP and GN build files)"
mv "$DEPS_DIR/simdutf/"*.gyp "$DEPS_DIR/simdutf/"*.gn "$DEPS_DIR/simdutf/"*.gni "$DEPS_DIR/simdutf/README.md" "$WORKSPACE/"
rm -rf "$DEPS_DIR/simdutf"
mv "$WORKSPACE" "$DEPS_DIR/simdutf"

View File

@ -54,13 +54,17 @@ log_and_verify_sha256sum "uvwasi" "$UVWASI_ZIP.zip"
echo "Moving existing GYP build file"
mv "$DEPS_DIR/uvwasi/"*.gyp "$WORKSPACE/"
echo "Moving existing GN build file"
mv "$DEPS_DIR/uvwasi/"*.gn "$DEPS_DIR/uvwasi/"*.gni "$WORKSPACE/"
rm -rf "$DEPS_DIR/uvwasi/"
echo "Unzipping..."
unzip "$UVWASI_ZIP.zip" -d "$DEPS_DIR/uvwasi/"
rm "$UVWASI_ZIP.zip"
mv "$WORKSPACE/"*.gyp "$DEPS_DIR/uvwasi/"
mv "$WORKSPACE/"*.gyp "$WORKSPACE/"*.gn "$WORKSPACE/"*.gni "$DEPS_DIR/uvwasi/"
cd "$DEPS_DIR/uvwasi/"
echo "Copying new files to deps folder"