Index: tools/push-to-trunk/releases.py |
diff --git a/tools/push-to-trunk/releases.py b/tools/push-to-trunk/releases.py |
index b6893fe30bad1ce7a374ab269f91ccd9f16ece48..21eb46231203eb4fdee3c453f4bef17ec88c7db8 100755 |
--- a/tools/push-to-trunk/releases.py |
+++ b/tools/push-to-trunk/releases.py |
@@ -20,7 +20,6 @@ import sys |
from common_includes import * |
-DEPS_FILE = "DEPS_FILE" |
CHROMIUM = "CHROMIUM" |
CONFIG = { |
@@ -28,7 +27,6 @@ CONFIG = { |
PERSISTFILE_BASENAME: "/tmp/v8-releases-tempfile", |
DOT_GIT_LOCATION: ".git", |
VERSION_FILE: "src/version.cc", |
- DEPS_FILE: "DEPS", |
} |
# Expression for retrieving the bleeding edge revision from a commit message. |
@@ -268,60 +266,42 @@ class RetrieveV8Releases(Step): |
reverse=True) |
-# TODO(machenbach): Parts of the Chromium setup are c/p from the chromium_roll |
-# script -> unify. |
-class CheckChromium(Step): |
- MESSAGE = "Check the chromium checkout." |
- |
- def Run(self): |
- self["chrome_path"] = self._options.chromium |
- |
- |
class SwitchChromium(Step): |
MESSAGE = "Switch to Chromium checkout." |
- REQUIRES = "chrome_path" |
def RunStep(self): |
- self["v8_path"] = os.getcwd() |
- os.chdir(self["chrome_path"]) |
+ cwd = self._options.chromium |
# Check for a clean workdir. |
- if not self.GitIsWorkdirClean(): # pragma: no cover |
+ if not self.GitIsWorkdirClean(cwd=cwd): # pragma: no cover |
self.Die("Workspace is not clean. Please commit or undo your changes.") |
# Assert that the DEPS file is there. |
- if not os.path.exists(self.Config(DEPS_FILE)): # pragma: no cover |
+ if not os.path.exists(os.path.join(cwd, "DEPS")): # pragma: no cover |
self.Die("DEPS file not present.") |
class UpdateChromiumCheckout(Step): |
MESSAGE = "Update the checkout and create a new branch." |
- REQUIRES = "chrome_path" |
def RunStep(self): |
- os.chdir(self["chrome_path"]) |
- self.GitCheckout("master") |
- self.GitPull() |
- self.GitCreateBranch(self.Config(BRANCHNAME)) |
+ cwd = self._options.chromium |
+ self.GitCheckout("master", cwd=cwd) |
+ self.GitPull(cwd=cwd) |
+ self.GitCreateBranch(self.Config(BRANCHNAME), cwd=cwd) |
def ConvertToCommitNumber(step, revision): |
# Simple check for git hashes. |
if revision.isdigit() and len(revision) < 8: |
return revision |
- try: |
- # TODO(machenbach): Add cwd to git calls. |
- os.chdir(os.path.join(step["chrome_path"], "v8")) |
- return step.GitConvertToSVNRevision(revision) |
- finally: |
- os.chdir(step["chrome_path"]) |
+ return step.GitConvertToSVNRevision( |
+ revision, cwd=os.path.join(step._options.chromium, "v8")) |
class RetrieveChromiumV8Releases(Step): |
MESSAGE = "Retrieve V8 releases from Chromium DEPS." |
- REQUIRES = "chrome_path" |
def RunStep(self): |
- os.chdir(self["chrome_path"]) |
- |
+ cwd = self._options.chromium |
releases = filter( |
lambda r: r["branch"] in ["trunk", "bleeding_edge"], self["releases"]) |
if not releases: # pragma: no cover |
@@ -329,26 +309,22 @@ class RetrieveChromiumV8Releases(Step): |
return True |
# Update v8 checkout in chromium. |
- try: |
- # TODO(machenbach): Add cwd to git calls. |
- os.chdir(os.path.join(self["chrome_path"], "v8")) |
- self.GitFetchOrigin() |
- finally: |
- os.chdir(self["chrome_path"]) |
+ self.GitFetchOrigin(cwd=os.path.join(cwd, "v8")) |
oldest_v8_rev = int(releases[-1]["revision"]) |
cr_releases = [] |
try: |
- for git_hash in self.GitLog(format="%H", grep="V8").splitlines(): |
- if self._config[DEPS_FILE] not in self.GitChangedFiles(git_hash): |
+ for git_hash in self.GitLog( |
+ format="%H", grep="V8", cwd=cwd).splitlines(): |
+ if "DEPS" not in self.GitChangedFiles(git_hash, cwd=cwd): |
continue |
- if not self.GitCheckoutFileSafe(self._config[DEPS_FILE], git_hash): |
+ if not self.GitCheckoutFileSafe("DEPS", git_hash, cwd=cwd): |
break # pragma: no cover |
- deps = FileToText(self.Config(DEPS_FILE)) |
+ deps = FileToText(os.path.join(cwd, "DEPS")) |
match = DEPS_RE.search(deps) |
if match: |
- cr_rev = self.GetCommitPositionNumber(git_hash) |
+ cr_rev = self.GetCommitPositionNumber(git_hash, cwd=cwd) |
if cr_rev: |
v8_rev = ConvertToCommitNumber(self, match.group(1)) |
cr_releases.append([cr_rev, v8_rev]) |
@@ -364,7 +340,7 @@ class RetrieveChromiumV8Releases(Step): |
pass |
# Clean up. |
- self.GitCheckoutFileSafe(self._config[DEPS_FILE], "HEAD") |
+ self.GitCheckoutFileSafe("DEPS", "HEAD", cwd=cwd) |
# Add the chromium ranges to the v8 trunk and bleeding_edge releases. |
all_ranges = BuildRevisionRanges(cr_releases) |
@@ -376,11 +352,9 @@ class RetrieveChromiumV8Releases(Step): |
# TODO(machenbach): Unify common code with method above. |
class RietrieveChromiumBranches(Step): |
MESSAGE = "Retrieve Chromium branch information." |
- REQUIRES = "chrome_path" |
def RunStep(self): |
- os.chdir(self["chrome_path"]) |
- |
+ cwd = self._options.chromium |
trunk_releases = filter(lambda r: r["branch"] == "trunk", self["releases"]) |
if not trunk_releases: # pragma: no cover |
print "No trunk releases detected. Skipping chromium history." |
@@ -390,7 +364,7 @@ class RietrieveChromiumBranches(Step): |
# Filter out irrelevant branches. |
branches = filter(lambda r: re.match(r"branch-heads/\d+", r), |
- self.GitRemotes()) |
+ self.GitRemotes(cwd=cwd)) |
# Transform into pure branch numbers. |
branches = map(lambda r: int(re.match(r"branch-heads/(\d+)", r).group(1)), |
@@ -401,10 +375,11 @@ class RietrieveChromiumBranches(Step): |
cr_branches = [] |
try: |
for branch in branches: |
- if not self.GitCheckoutFileSafe(self._config[DEPS_FILE], |
- "branch-heads/%d" % branch): |
+ if not self.GitCheckoutFileSafe("DEPS", |
+ "branch-heads/%d" % branch, |
+ cwd=cwd): |
break # pragma: no cover |
- deps = FileToText(self.Config(DEPS_FILE)) |
+ deps = FileToText(os.path.join(cwd, "DEPS")) |
match = DEPS_RE.search(deps) |
if match: |
v8_rev = ConvertToCommitNumber(self, match.group(1)) |
@@ -421,7 +396,7 @@ class RietrieveChromiumBranches(Step): |
pass |
# Clean up. |
- self.GitCheckoutFileSafe(self._config[DEPS_FILE], "HEAD") |
+ self.GitCheckoutFileSafe("DEPS", "HEAD", cwd=cwd) |
# Add the chromium branches to the v8 trunk releases. |
all_ranges = BuildRevisionRanges(cr_branches) |
@@ -430,20 +405,12 @@ class RietrieveChromiumBranches(Step): |
trunk_dict.get(revision, {})["chromium_branch"] = ranges |
-class SwitchV8(Step): |
- MESSAGE = "Returning to V8 checkout." |
- REQUIRES = "chrome_path" |
- |
- def RunStep(self): |
- self.GitCheckout("master") |
- self.GitDeleteBranch(self.Config(BRANCHNAME)) |
- os.chdir(self["v8_path"]) |
- |
- |
class CleanUp(Step): |
MESSAGE = "Clean up." |
def RunStep(self): |
+ self.GitCheckout("master", cwd=self._options.chromium) |
+ self.GitDeleteBranch(self.Config(BRANCHNAME), cwd=self._options.chromium) |
self.CommonCleanup() |
@@ -488,12 +455,10 @@ class Releases(ScriptsBase): |
return [ |
Preparation, |
RetrieveV8Releases, |
- CheckChromium, |
SwitchChromium, |
UpdateChromiumCheckout, |
RetrieveChromiumV8Releases, |
RietrieveChromiumBranches, |
- SwitchV8, |
CleanUp, |
WriteOutput, |
] |