Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Unified Diff: mojo/tools/roll/update_from_chromium.py

Issue 864953003: Teach update_from_chromium.py to preserve certain files through roll. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: nit Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/tools/roll/update_from_chromium.py
diff --git a/mojo/tools/roll/update_from_chromium.py b/mojo/tools/roll/update_from_chromium.py
index 5d2bd4475f757e725a77eb6a82e80bfa4701f4d2..c4d5eacac2a9ca3f8d859449afc08e29be3e9bab 100755
--- a/mojo/tools/roll/update_from_chromium.py
+++ b/mojo/tools/roll/update_from_chromium.py
@@ -12,6 +12,7 @@ import urllib2
from utils import commit
from utils import mojo_root_dir
from utils import system
+from utils import temp_dir
import patch
@@ -88,6 +89,10 @@ net_dirs = [
files_to_copy = ["sandbox/sandbox_export.h",
".clang-format"]
+# The contents of these files before the roll will be preserved after the roll,
+# even though they live in directories rolled in from Chromium.
+files_not_to_roll = [ "build/config/mojo.gni" ]
+
dirs = dirs_to_snapshot + net_dirs
def chromium_rev_number(src_commit):
@@ -123,8 +128,20 @@ def main():
"snapshot of things imported from chromium.")
parser.add_argument("chromium_dir", help="chromium source dir")
args = parser.parse_args()
- rev(args.chromium_dir)
- patch.patch()
+ with temp_dir() as tempd:
+ for f in files_not_to_roll:
+ system(["mkdir", "-p", os.path.dirname(f)], cwd=tempd)
+ system(["cp", os.path.join(mojo_root_dir, f), os.path.join(tempd, f)])
+
+ rev(args.chromium_dir)
+ patch.patch()
+
+ print "Restoring files whose contents don't track Chromium"
+ for f in files_not_to_roll:
+ system(["mkdir", "-p", os.path.dirname(f)], cwd=mojo_root_dir)
+ system(["cp", os.path.join(tempd, f), os.path.join(mojo_root_dir, f)])
+ system(["git", "add", "."], cwd=mojo_root_dir)
+ commit("Restored pre-roll versions of files that don't get rolled")
return 0
if __name__ == "__main__":
« build/config/mojo.gni ('K') | « build/config/mojo.gni ('k') | mojo/tools/roll/utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698