Title: [270063] trunk
Revision
270063
Author
jdarpin...@chromium.org
Date
2020-11-19 17:23:54 -0800 (Thu, 19 Nov 2020)

Log Message

Improve update-angle script and move to Tools/Scripts
https://bugs.webkit.org/show_bug.cgi?id=218831

Reviewed by Kenneth Russell.

update-angle fetches changes from upstream ANGLE into Source/ThirdParty/ANGLE,
updates WebKit's build files and helps merge WebKit's local changes.

Source/ThirdParty/ANGLE:

  - Moved to Tools/Scripts so that it doesn't overwrite itself during the
    update process.
  - Reversed direction of rebase. Before the script rebased ANGLE on WebKit;
    now it rebases WebKit's ANGLE changes on upstream ANGLE master. This
    makes a lot more sense and results in fewer changes to rebase. This
    requires the use of git-filter-repo to make the rebase not prohibitively
    slow.
  - Removed bash dependency.
  - Fixed all issues identified by shellcheck.
  - Fixed changes.diff to show added files, while filtering files added by
    WebKit's build process.
  - Fixed changes.diff to ignore whitespace changes.
  - Added --regenerate-changes-diff option to update changes.diff in between
    ANGLE updates.
  - Updated [angle_]commit.h generation for upstream changes.
  - Removed need to run the script multiple times during the rebase process.

* update-angle.sh: Removed.

Tools:

 - Moved to Tools/Scripts so that it doesn't overwrite itself during the
   update process.
 - Reversed direction of rebase. Before the script rebased ANGLE on WebKit;
   now it rebases WebKit's ANGLE changes on upstream ANGLE master. This
   makes a lot more sense and results in fewer changes to rebase. This
   requires the use of git-filter-repo to make the rebase not prohibitively
   slow.
 - Removed bash dependency.
 - Fixed all issues identified by shellcheck.
 - Fixed changes.diff to show added files, while filtering files added by
   WebKit's build process.
 - Fixed changes.diff to ignore whitespace changes.
 - Added --regenerate-changes-diff option to update changes.diff in between
   ANGLE updates.
 - Updated [angle_]commit.h generation for upstream changes.
 - Removed need to run the script multiple times during the rebase process.

* Scripts/update-angle: Added.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/ThirdParty/ANGLE/ChangeLog (270062 => 270063)


--- trunk/Source/ThirdParty/ANGLE/ChangeLog	2020-11-20 01:16:15 UTC (rev 270062)
+++ trunk/Source/ThirdParty/ANGLE/ChangeLog	2020-11-20 01:23:54 UTC (rev 270063)
@@ -1,3 +1,32 @@
+2020-11-19  James Darpinian  <jdarpin...@chromium.org>
+
+        Improve update-angle script and move to Tools/Scripts
+        https://bugs.webkit.org/show_bug.cgi?id=218831
+
+        Reviewed by Kenneth Russell.
+
+        update-angle fetches changes from upstream ANGLE into Source/ThirdParty/ANGLE,
+        updates WebKit's build files and helps merge WebKit's local changes.
+
+          - Moved to Tools/Scripts so that it doesn't overwrite itself during the
+            update process.
+          - Reversed direction of rebase. Before the script rebased ANGLE on WebKit;
+            now it rebases WebKit's ANGLE changes on upstream ANGLE master. This
+            makes a lot more sense and results in fewer changes to rebase. This
+            requires the use of git-filter-repo to make the rebase not prohibitively
+            slow.
+          - Removed bash dependency.
+          - Fixed all issues identified by shellcheck.
+          - Fixed changes.diff to show added files, while filtering files added by
+            WebKit's build process.
+          - Fixed changes.diff to ignore whitespace changes.
+          - Added --regenerate-changes-diff option to update changes.diff in between
+            ANGLE updates.
+          - Updated [angle_]commit.h generation for upstream changes.
+          - Removed need to run the script multiple times during the rebase process.
+
+        * update-angle.sh: Removed.
+
 2020-11-19  Dean Jackson  <d...@apple.com>
 
         Add schemes for ANGLE to Xcode project

Deleted: trunk/Source/ThirdParty/ANGLE/update-angle.sh (270062 => 270063)


--- trunk/Source/ThirdParty/ANGLE/update-angle.sh	2020-11-20 01:16:15 UTC (rev 270062)
+++ trunk/Source/ThirdParty/ANGLE/update-angle.sh	2020-11-20 01:23:54 UTC (rev 270063)
@@ -1,115 +0,0 @@
-#!/bin/bash
-
-set -e
-cd "$(dirname ${BASH_SOURCE[0]})"
-
-ANGLE_DIR="$PWD"
-
-function print_rebase_message_and_exit {
-    echo
-    echo "*** When you are ready, Instead of running git rebase --continue, run"
-    echo "*** update-angle.sh again."
-    exit 1
-}
-
-function cleanup_after_successful_rebase_and_exit {
-    cd "$ANGLE_DIR"
-    echo
-    echo "Regenerating changes.diff."
-    git diff origin/master --diff-filter=a > changes.diff
-    echo "Pausing to let you examine changes.diff, and the files in"
-    echo "Source/ThirdParty/ANGLE relative to upstream, using git tools."
-    echo "At this point you may undo any undesired changes that you see in"
-    echo "changes.diff."
-    echo "To see the current changes relative to upstream ANGLE, run the"
-    echo "following command in Source/ThirdParty/ANGLE:"
-    echo "    git diff origin/master --diff-filter=a"
-    echo "changes.diff will be regenerated again when this script proceeds;"
-    echo "it isn't necessary to do it manually."
-    read -p "Press ENTER to continue: "
-    echo "Regenerating changes.diff again."
-    git diff origin/master --diff-filter=a > changes.diff
-    rm -rf .git
-    git add -A .
-    echo
-    git --no-pager diff --cached Compiler.cmake GLESv2.cmake
-    echo
-    echo "Success! Rebase complete."
-    echo "Above are the changes to Compiler.cmake and GLESv2.cmake."
-    echo "Now you'll need to apply the equivalent changes to the ANGLE XCode"
-    echo "project. Once that's done you should be ready to upload your patch."
-    echo
-    exit 0
-}
-
-if test -d .git && (test -d "$(git rev-parse --git-path rebase-merge)" || test -d "$(git rev-parse --git-path rebase-apply)"); then
-    if ! git rebase --continue; then
-        print_rebase_message_and_exit
-    fi
-    cleanup_after_successful_rebase_and_exit
-fi
-
-echo "This script will check out the latest ANGLE and start a git rebase"
-echo "to apply WebKit's local ANGLE changes on top of the latest ANGLE master"
-echo "branch."
-echo
-echo "This will clobber any changes you have made in:"
-echo "$ANGLE_DIR"
-read -p "Are you sure? [y/N] "
-echo
-if [[ ! $REPLY =~ ^[Yy]$ ]]; then
-    echo "Canceled."
-    exit
-fi
-
-PREVIOUS_COMMIT_HASH=`grep -m 1 -o -E "[a-z0-9]{40}" ANGLE.plist`
-
-echo "Downloading latest ANGLE via git clone."
-# Remove all files including hidden ones, but not . or ..
-rm -rf ..?* .[!.]* *
-git clone https://chromium.googlesource.com/angle/angle .
-echo "Successfully downloaded latest ANGLE."
-echo -n "Commit hash: "
-COMMIT_HASH=`git rev-parse HEAD`
-echo "$COMMIT_HASH"
-echo ""
-
-echo "Generating commit.h"
-./src/commit_id.py gen commit.h.TEMP
-
-echo "Applying WebKit's local ANGLE changes to the old ANGLE version."
-git checkout -B downstream-changes "$PREVIOUS_COMMIT_HASH"
-pushd .. &> /dev/null
-git checkout HEAD -- ANGLE
-popd &> /dev/null
-
-echo "Copying commit.h to src/id/commit.h"
-mkdir -p src/id
-cp commit.h.TEMP src/id/commit.h
-rm commit.h.TEMP
-
-echo "Updating ANGLE.plist commit hashes."
-sed -i.bak -e "s/\([^a-z0-9]\)[a-z0-9]\{40\}\([^a-z0-9]\)/\1$COMMIT_HASH\2/g" ANGLE.plist
-echo "Updating ANGLE.plist date."
-sed -i.bak -e "s/<string>[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]<\/string>/<string>`date +%Y-%m-%d`<\/string>/g" ANGLE.plist
-rm ANGLE.plist.bak
-
-echo "Translating gni build files to cmake."
-git checkout origin/master -- src/compiler.gni src/libGLESv2.gni
-./gni-to-cmake.py src/compiler.gni Compiler.cmake
-./gni-to-cmake.py src/libGLESv2.gni GLESv2.cmake
-git checkout src/compiler.gni src/libGLESv2.gni
-
-echo "Rebasing WebKit's local changes on latest ANGLE master."
-git add -A
-git commit -m "WebKit changes since last ANGLE update."
-git checkout -B upstream-rebased-on-webkit origin/master
-if ! git rebase downstream-changes; then
-    echo
-    echo "There is now a git repo in Source/ThirdParty/ANGLE with a rebase in progress."
-    echo "You must resolve the merge conflict and continue the rebase. Make sure to do"
-    echo "this in the Source/ThirdParty/ANGLE repo, not the main WebKit repo."
-    echo
-    print_rebase_message_and_exit
-fi
-cleanup_after_successful_rebase_and_exit

Modified: trunk/Tools/ChangeLog (270062 => 270063)


--- trunk/Tools/ChangeLog	2020-11-20 01:16:15 UTC (rev 270062)
+++ trunk/Tools/ChangeLog	2020-11-20 01:23:54 UTC (rev 270063)
@@ -1,3 +1,32 @@
+2020-11-19  James Darpinian  <jdarpin...@chromium.org>
+
+        Improve update-angle script and move to Tools/Scripts
+        https://bugs.webkit.org/show_bug.cgi?id=218831
+
+        Reviewed by Kenneth Russell.
+
+        update-angle fetches changes from upstream ANGLE into Source/ThirdParty/ANGLE,
+        updates WebKit's build files and helps merge WebKit's local changes.
+
+         - Moved to Tools/Scripts so that it doesn't overwrite itself during the
+           update process.
+         - Reversed direction of rebase. Before the script rebased ANGLE on WebKit;
+           now it rebases WebKit's ANGLE changes on upstream ANGLE master. This
+           makes a lot more sense and results in fewer changes to rebase. This
+           requires the use of git-filter-repo to make the rebase not prohibitively
+           slow.
+         - Removed bash dependency.
+         - Fixed all issues identified by shellcheck.
+         - Fixed changes.diff to show added files, while filtering files added by
+           WebKit's build process.
+         - Fixed changes.diff to ignore whitespace changes.
+         - Added --regenerate-changes-diff option to update changes.diff in between
+           ANGLE updates.
+         - Updated [angle_]commit.h generation for upstream changes.
+         - Removed need to run the script multiple times during the rebase process.
+
+        * Scripts/update-angle: Added.
+
 2020-11-19  Jonathan Bedard  <jbed...@apple.com>
 
         [webkitpy] Resolve baseline search path for Big Sur as default version

Added: trunk/Tools/Scripts/update-angle (0 => 270063)


--- trunk/Tools/Scripts/update-angle	                        (rev 0)
+++ trunk/Tools/Scripts/update-angle	2020-11-20 01:23:54 UTC (rev 270063)
@@ -0,0 +1,192 @@
+#!/bin/sh
+set -e
+cd "$(dirname "$0")/../../Source/ThirdParty/ANGLE"
+ANGLE_DIR="$PWD"
+
+regenerate_changes_diff() {
+    echo "Regenerating changes.diff."
+    # Exclude WebKit-added build files from the diff.
+    git diff "$1" --cached -b --ignore-cr-at-eol -- . \
+        ':(exclude)ChangeLog' \
+        ':(exclude)ANGLE.plist' \
+        ':(exclude)ANGLE.xcodeproj' \
+        ':(exclude)Configurations' \
+        ':(exclude)**CMakeLists.txt' \
+        ':(exclude)*.cmake' \
+        ':(exclude)adjust-angle-include-paths*' \
+        ':(exclude)changes.diff' \
+        ':(exclude)gni-to-cmake.py' \
+        ':(exclude)src/angle_commit.h' \
+        ':(exclude)Makefile' \
+        ':(exclude)src/empty.cpp' \
+        ':(exclude)third_party/zlib/google/compression_utils_portable*' \
+        ':(exclude)**.DS_Store' \
+        ':(exclude)update-angle.sh' \
+        ':(exclude)WebKitBuild' \
+        > changes.diff
+}
+
+if [ ! -z "$1" ] ; then
+    if [ "$1" = "--regenerate-changes-diff" ] ; then
+        echo "Regenerating Source/ThirdParty/ANGLE/changes.diff"
+        PREVIOUS_ANGLE_COMMIT_HASH=$(grep -m 1 -o -E "[a-z0-9]{40}" ANGLE.plist)
+        rm -rf .git
+        git init
+        git remote add origin https://chromium.googlesource.com/angle/angle
+        git fetch --depth 1 origin "$PREVIOUS_ANGLE_COMMIT_HASH"
+        git add -A
+        regenerate_changes_diff "$PREVIOUS_ANGLE_COMMIT_HASH"
+        rm -rf .git
+        cat changes.diff
+        echo
+        echo "Success."
+        exit 0
+    fi
+    echo "Unrecognized argument: $1"
+    exit 1
+fi
+
+echo "This script helps you update the copy of ANGLE in Source/ThirdParty/ANGLE"
+echo "with the latest changes from upstream, without clobbering WebKit's local"
+echo "changes."
+echo
+
+
+if ! which git-filter-repo > /dev/null; then
+    echo "Please install git-filter-repo from https://github.com/newren/git-filter-repo"
+    echo "git-filter-repo is recommended by the git project itself as a better"
+    echo "alternative to the built-in git filter-branch."
+    exit 1
+fi
+
+in_rebase() {
+    test -d .git && { test -d "$(git rev-parse --git-path rebase-merge)" || test -d "$(git rev-parse --git-path rebase-apply)"; } ;
+}
+
+wait_for_rebase_to_complete() {
+    if ! in_rebase; then
+        return 1
+    fi
+    echo
+    echo "For patches that have been upstreamed, you should choose the 'ours' version,"
+    echo "and the resulting commits after rebase should be mostly empty. For patches"
+    echo "that haven't been upstreamed, resolve conflicts prioritizing 'theirs' when"
+    echo "possible to preserve WebKit's changes."
+    echo
+    echo "The script will pause now. Please complete the rebase, then come back and"
+    echo "press Enter to continue:"
+    read -r
+    while in_rebase && ! GIT_EDITOR=true git rebase --continue; do
+        echo
+        echo "Rebase still in progress. Complete the rebase and press Enter to continue:"
+        read -r
+    done
+}
+
+cleanup_after_successful_rebase_and_exit() {
+    cd "$ANGLE_DIR"
+    echo
+    regenerate_changes_diff "origin/master"
+    git --no-pager diff -b --cached "$LAST_ROLL_COMMIT_HASH" -- Compiler.cmake GLESv2.cmake
+    echo
+    echo "Rebase complete!"
+    echo "Above are the changes to Compiler.cmake and GLESv2.cmake."
+    echo "Now you'll need to apply the equivalent changes to the ANGLE XCode"
+    echo "project and make sure it builds. Please examine changes.diff and"
+    echo "undo any unintentional changes or unnecessary added files."
+    echo "You can examine the rebased history in the temporary git repository in"
+    echo "Source/ThirdParty/ANGLE to see where changes came from."
+    echo
+    echo "This script will pause now. Press Enter to continue when you're"
+    echo "done. The script will regenerate changes.diff and delete the"
+    echo "temporary git repository in Source/ThirdParty/ANGLE."
+    echo
+    echo "Press Enter to continue after fixing build:"
+    read -r
+    regenerate_changes_diff "origin/master"
+    echo "Removing temporary git repository from Source/ThirdParty/ANGLE"
+    rm -rf .git
+    git add -A .
+    echo
+    echo "ANGLE update is now staged. Ready to commit and upload patch."
+    exit 0
+}
+
+if wait_for_rebase_to_complete ; then
+    cleanup_after_successful_rebase_and_exit
+fi
+
+if [ -n "$(git status -s .)" ] ; then
+    git status -s .
+    echo "Error: ANGLE directory Source/ThirdParty/ANGLE has local uncommitted"
+    echo "changes. Please stash your changes first and start with a clean"
+    echo "checkout of WebKit master."
+    exit 1
+fi
+
+PREVIOUS_ANGLE_COMMIT_HASH=$(grep -m 1 -o -E "[a-z0-9]{40}" ANGLE.plist)
+
+cd ../../..
+echo "Creating WebKit branch that only contains ANGLE changes, using git-filter-repo."
+echo "This may take a few minutes, but massively speeds up rebasing later."
+git branch -f just-angle master && git-filter-repo --refs refs/heads/just-angle --path Source/ThirdParty/ANGLE --path-rename Source/ThirdParty/ANGLE/: --force
+cd "$ANGLE_DIR"
+
+echo "Downloading latest ANGLE via git clone."
+# Remove all files including hidden ones, but not . or ..
+rm -rf ..?* .[!.]* ./*
+git clone --branch master https://chromium.googlesource.com/angle/angle .
+echo "Successfully downloaded latest ANGLE."
+echo "Commit hash: "
+COMMIT_HASH=$(git rev-parse HEAD)
+echo "$COMMIT_HASH"
+echo ""
+
+echo "Generating angle_commit.h"
+./src/commit_id.py gen src/angle_commit.h.TEMP
+
+echo "Applying WebKit's local ANGLE changes to the old ANGLE version."
+echo "Fetching WebKit changes into ANGLE repo."
+git remote add webkit ../../.. -t just-angle
+git fetch webkit
+git checkout just-angle
+
+PREVIOUS_ANGLE_COMMIT_HASH=$(grep -m 1 -o -E "[a-z0-9]{40}" ANGLE.plist)
+LAST_ROLL_COMMIT_HASH=$(git log --format="%H" -1 ANGLE.plist)
+
+echo "Updating ANGLE.plist commit hashes."
+sed -i.bak -e "s/\([^a-z0-9]\)[a-z0-9]\{40\}\([^a-z0-9]\)/\1$COMMIT_HASH\2/g" ANGLE.plist
+echo "Updating ANGLE.plist date."
+sed -i.bak -e "s/<string>[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]<\/string>/<string>$(date +%Y-%m-%d)<\/string>/g" ANGLE.plist
+rm ANGLE.plist.bak
+
+echo "Translating gni build files to cmake."
+git checkout origin/master -- src/compiler.gni src/libGLESv2.gni src/libANGLE/renderer/d3d/BUILD.gn
+./gni-to-cmake.py src/compiler.gni Compiler.cmake ''
+./gni-to-cmake.py src/libGLESv2.gni GLESv2.cmake ''
+./gni-to-cmake.py src/libANGLE/renderer/d3d/BUILD.gn D3D.cmake 'src/libANGLE/renderer/d3d/'
+git checkout src/compiler.gni src/libGLESv2.gni
+
+echo "Moving angle_commit.h into place"
+mv src/angle_commit.h.TEMP src/angle_commit.h
+
+git add -A .
+git commit -m "Updated ANGLE.plist, angle_commit.h and cmake files."
+
+# Graft the WebKit commit history on top of the ANGLE commit history at
+# the point of the last ANGLE roll. This will allow us to rebase just
+# the WebKit changes since the last roll on top of ANGLE master.
+git replace --graft "$LAST_ROLL_COMMIT_HASH" "$PREVIOUS_ANGLE_COMMIT_HASH"
+# Rebase the WebKit commit history on top of ANGLE master.
+git checkout -b rebased-webkit-changes
+
+echo "Rebasing WebKit's local changes on latest ANGLE master."
+if ! git rebase origin/master; then
+    echo
+    echo "There is now a temporary git repo in Source/ThirdParty/ANGLE with a"
+    echo "rebase in progress. You must resolve the merge conflict and continue"
+    echo "the rebase. Make sure to do this in the temporary"
+    echo "Source/ThirdParty/ANGLE repo, not the main WebKit repo."
+    wait_for_rebase_to_complete
+fi
+cleanup_after_successful_rebase_and_exit
Property changes on: trunk/Tools/Scripts/update-angle
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to