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

Side by Side 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: Response to review Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « build/config/mojo.gni ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import argparse 6 import argparse
7 import json 7 import json
8 import os 8 import os
9 import subprocess 9 import subprocess
10 import sys 10 import sys
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 # These directories are temporarily cloned in order to support the network 81 # These directories are temporarily cloned in order to support the network
82 # bootstrap library until we get that sorted out. 82 # bootstrap library until we get that sorted out.
83 net_dirs = [ 83 net_dirs = [
84 "crypto", 84 "crypto",
85 "net", 85 "net",
86 "mojo/services/network"] 86 "mojo/services/network"]
87 87
88 files_to_copy = ["sandbox/sandbox_export.h", 88 files_to_copy = ["sandbox/sandbox_export.h",
89 ".clang-format"] 89 ".clang-format"]
90 90
91 # The contents of these files before the roll will be preserved after the roll,
92 # even though they live in directories rolled in from Chromium.
93 files_not_to_roll = [ "build/config/mojo.gni" ]
94
91 dirs = dirs_to_snapshot + net_dirs 95 dirs = dirs_to_snapshot + net_dirs
92 96
93 def chromium_rev_number(src_commit): 97 def chromium_rev_number(src_commit):
94 base_url = "https://cr-rev.appspot.com/_ah/api/crrev/v1/commit/" 98 base_url = "https://cr-rev.appspot.com/_ah/api/crrev/v1/commit/"
95 commit_info = json.load(urllib2.urlopen(base_url + src_commit)) 99 commit_info = json.load(urllib2.urlopen(base_url + src_commit))
96 return commit_info["numberings"][0]["number"] 100 return commit_info["numberings"][0]["number"]
97 101
98 def rev(source_dir): 102 def rev(source_dir):
99 for d in dirs: 103 for d in dirs:
100 print "removing directory %s" % d 104 print "removing directory %s" % d
(...skipping 15 matching lines...) Expand all
116 system(["git", "add", "."], cwd=mojo_root_dir) 120 system(["git", "add", "."], cwd=mojo_root_dir)
117 src_commit = system(["git", "rev-parse", "HEAD"], cwd=source_dir).strip() 121 src_commit = system(["git", "rev-parse", "HEAD"], cwd=source_dir).strip()
118 src_rev = chromium_rev_number(src_commit) 122 src_rev = chromium_rev_number(src_commit)
119 commit("Update from https://crrev.com/" + src_rev, cwd=mojo_root_dir) 123 commit("Update from https://crrev.com/" + src_rev, cwd=mojo_root_dir)
120 124
121 def main(): 125 def main():
122 parser = argparse.ArgumentParser(description="Update the mojo repo's " + 126 parser = argparse.ArgumentParser(description="Update the mojo repo's " +
123 "snapshot of things imported from chromium.") 127 "snapshot of things imported from chromium.")
124 parser.add_argument("chromium_dir", help="chromium source dir") 128 parser.add_argument("chromium_dir", help="chromium source dir")
125 args = parser.parse_args() 129 args = parser.parse_args()
130 pre_roll_commit = system(
131 ["git", "rev-parse", "HEAD"], cwd=mojo_root_dir).strip()
132
126 rev(args.chromium_dir) 133 rev(args.chromium_dir)
127 patch.patch() 134 patch.patch()
135
136 print "Restoring files whose contents don't track Chromium"
137 for f in files_not_to_roll:
138 system(["git", "checkout", pre_roll_commit, "--", f], cwd=mojo_root_dir)
139 if files_not_to_roll:
140 commit("Restored pre-roll versions of files that don't get rolled")
128 return 0 141 return 0
129 142
130 if __name__ == "__main__": 143 if __name__ == "__main__":
131 sys.exit(main()) 144 sys.exit(main())
OLDNEW
« no previous file with comments | « build/config/mojo.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698