29
29
os.environ["PYTHONDONTWRITEBYTECODE"] = "1"
31
31
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "build", "python"))
32
from oxide_utils import CheckCall, CheckOutput, CHROMIUMDIR, CHROMIUMSRCDIR, TOPSRCDIR
32
from oxide_utils import CheckCall, CheckOutput, CHROMIUMSRCDIR, TOPSRCDIR
33
33
from patch_utils import SyncablePatchSet, SyncError
35
DEPOT_TOOLS = "https://chromium.googlesource.com/chromium/tools/depot_tools.git"
36
DEPOT_TOOLS_REV = "d9839e8e7a078df40b33b76bf25c4a2f3199d3be"
35
DEPOT_TOOLS_GIT_URL = "https://chromium.googlesource.com/chromium/tools/depot_tools.git"
36
DEPOT_TOOLS_GIT_REV = "d9839e8e7a078df40b33b76bf25c4a2f3199d3be"
37
DEPOT_TOOLS_PATH = os.path.join(TOPSRCDIR, "third_party", "depot_tools")
38
DEPOT_TOOLS_OLD_PATH = os.path.join(TOPSRCDIR, "chromium", "depot_tools")
38
40
GCLIENTFILE = os.path.join(TOPSRCDIR, "gclient.conf")
39
GCLIENTFILECOPY = os.path.join(CHROMIUMDIR, ".gclient")
40
DEPOTTOOLSPATH = os.path.join(CHROMIUMDIR, "depot_tools")
41
GCLIENTFILECOPY = os.path.join(os.path.dirname(CHROMIUMSRCDIR), ".gclient")
43
def is_git_repo(repo):
45
CheckCall(["git", "status"], repo)
42
50
def get_svn_info(repo):
43
51
for line in CheckOutput(["svn", "info", repo]).split("\n"):
61
69
return SplitUrlRevision(gclient_dict["solutions"][0]["url"])
63
71
def prepare_depot_tools():
64
if not os.path.isdir(DEPOTTOOLSPATH):
65
CheckCall(["git", "clone", DEPOT_TOOLS, DEPOTTOOLSPATH])
72
if is_git_repo(DEPOT_TOOLS_OLD_PATH) and not is_git_repo(DEPOT_TOOLS_PATH):
73
os.rename(DEPOT_TOOLS_OLD_PATH, DEPOT_TOOLS_PATH)
75
if not os.path.isdir(DEPOT_TOOLS_PATH):
76
CheckCall(["git", "clone", DEPOT_TOOLS_GIT_URL, DEPOT_TOOLS_PATH])
67
CheckCall(["git", "pull", "origin", "master"], DEPOTTOOLSPATH)
68
CheckCall(["git", "checkout", DEPOT_TOOLS_REV], DEPOTTOOLSPATH)
78
CheckCall(["git", "pull", "origin", "master"], DEPOT_TOOLS_PATH)
79
CheckCall(["git", "checkout", DEPOT_TOOLS_GIT_REV], DEPOT_TOOLS_PATH)
70
sys.path.insert(0, DEPOTTOOLSPATH)
71
os.environ["PATH"] = DEPOTTOOLSPATH + ":" + os.getenv("PATH")
81
sys.path.insert(0, DEPOT_TOOLS_PATH)
82
os.environ["PATH"] = DEPOT_TOOLS_PATH + ":" + os.getenv("PATH")
73
84
def ensure_patch_consistency():
74
85
patchset = SyncablePatchSet()
131
142
os.remove(os.path.join(CHROMIUMSRCDIR, ".hgignore"))
133
144
# Don't use the gclient shell wrapper, as it updates depot_tools
134
CheckCall([sys.executable, os.path.join(DEPOTTOOLSPATH, "gclient.py"),
135
"sync", "-D"], CHROMIUMDIR)
145
CheckCall([sys.executable, os.path.join(DEPOT_TOOLS_PATH, "gclient.py"),
146
"sync", "-D"], os.path.dirname(CHROMIUMSRCDIR))
137
148
with open(os.path.join(CHROMIUMSRCDIR, ".hgignore"), "w") as f:
175
186
(need_sync, full_sync) = check_chromium_status()
188
chromium_dir = os.path.dirname(CHROMIUMSRCDIR)
189
if not os.path.isdir(chromium_dir):
190
os.makedirs(chromium_dir)
177
192
shutil.copyfile(GCLIENTFILE, GCLIENTFILECOPY)
178
193
shutil.copystat(GCLIENTFILE, GCLIENTFILECOPY)
195
old_chromium_dir = os.path.join(TOPSRCDIR, "chromium")
196
if os.path.isdir(old_chromium_dir):
197
shutil.rmtree(old_chromium_dir)
180
199
if full_sync and os.path.isdir(CHROMIUMSRCDIR):
181
200
shutil.rmtree(CHROMIUMSRCDIR)