-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b8c7a1e
commit 03b4a51
Showing
2 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/bin/sh | ||
set -e | ||
# Shell script to update v8 patch update | ||
|
||
BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd) | ||
DEPS_DIR="$BASE_DIR/deps" | ||
|
||
CURRENT_MAJOR_VERSION=$(grep "#define V8_MAJOR_VERSION" "$DEPS_DIR/v8/include/v8-version.h" | cut -d ' ' -f3) | ||
CURRENT_MINOR_VERSION=$(grep "#define V8_MINOR_VERSION" "$DEPS_DIR/v8/include/v8-version.h" | cut -d ' ' -f3) | ||
CURRENT_BUILD_VERSION=$(grep "#define V8_BUILD_NUMBER" "$DEPS_DIR/v8/include/v8-version.h" | cut -d ' ' -f3) | ||
CURRENT_PATCH_VERSION=$(grep "#define V8_PATCH_LEVEL" "$DEPS_DIR/v8/include/v8-version.h" | cut -d ' ' -f3) | ||
|
||
CURRENT_VERSION_NO_PATCH="$CURRENT_MAJOR_VERSION.$CURRENT_MINOR_VERSION.$CURRENT_BUILD_VERSION" | ||
|
||
NEW_VERSION=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://chromium.googlesource.com/v8/v8 "$CURRENT_VERSION_NO_PATCH.*" | tail -n1 | cut -d '/' -f3) | ||
|
||
LATEST_PATCH_VERSION=$(echo "$NEW_VERSION" | cut -d '.' -f4) | ||
|
||
if [ -z "$LATEST_PATCH_VERSION" ]; then | ||
echo "Skipped because latest patch is not available." | ||
exit 0 | ||
fi | ||
|
||
echo "Comparing current patch version $CURRENT_PATCH_VERSION with latest patch $LATEST_PATCH_VERSION" | ||
|
||
if [ "$CURRENT_PATCH_VERSION" = "$LATEST_PATCH_VERSION" ]; then | ||
echo "Skipped because v8 is on the latest version." | ||
exit 0 | ||
fi | ||
|
||
NEW_VERSION="$CURRENT_VERSION_NO_PATCH.$LATEST_PATCH_VERSION" | ||
|
||
CURRENT_VERSION="$CURRENT_VERSION_NO_PATCH.$CURRENT_PATCH_VERSION" | ||
|
||
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 "Cloning v8 repository..." | ||
|
||
git clone https://chromium.googlesource.com/v8/v8 | ||
|
||
cd v8 | ||
|
||
PATCH_DIFF="v8_patch.diff" | ||
|
||
echo "Generating patch file..." | ||
|
||
git format-patch "$CURRENT_VERSION...$NEW_VERSION" --stdout > "$WORKSPACE/$PATCH_DIFF" | ||
|
||
cd "$DEPS_DIR/v8" | ||
|
||
echo "Applying patch file..." | ||
|
||
git apply "$WORKSPACE/$PATCH_DIFF" | ||
|
||
echo "All done!" | ||
echo "" | ||
echo "Please git add v8, commit the new version:" | ||
echo "" | ||
echo "$ git add -A deps/v8" | ||
echo "$ git commit -m \"deps: update v8 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" |