Fix workdir feature for release scripts.
BUG=408523 LOG=n TEST=script_test.py TBR=tandrii@chromium.org Review URL: https://codereview.chromium.org/700493002 Cr-Commit-Position: refs/heads/master@{#25058} git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@25058 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
c65edf93b1
commit
06f17c14c1
@ -118,6 +118,8 @@ class PushToCandidates(Step):
|
||||
args.extend(["--svn-config", self._options.svn_config])
|
||||
if self._options.vc_interface:
|
||||
args.extend(["--vc-interface", self._options.vc_interface])
|
||||
if self._options.work_dir:
|
||||
args.extend(["--work-dir", self._options.work_dir])
|
||||
|
||||
# TODO(machenbach): Update the script before calling it.
|
||||
if self._options.push:
|
||||
|
@ -99,6 +99,8 @@ class RollChromium(Step):
|
||||
"--sheriff", "--googlers-mapping", self._options.googlers_mapping])
|
||||
if self._options.dry_run:
|
||||
args.extend(["--dry-run"])
|
||||
if self._options.work_dir:
|
||||
args.extend(["--work-dir", self._options.work_dir])
|
||||
self._side_effect_handler.Call(chromium_roll.ChromiumRoll().Run, args)
|
||||
|
||||
|
||||
|
@ -608,18 +608,6 @@ class Step(GitRecipesMixin):
|
||||
msg = "Can't continue. Please delete branch %s and try again." % name
|
||||
self.Die(msg)
|
||||
|
||||
def BootstrapV8Checkout(self):
|
||||
if os.path.realpath(self.default_cwd) == os.path.realpath(V8_BASE):
|
||||
self.Die("Can't use v8 checkout with calling script as work checkout.")
|
||||
# Directory containing the working v8 checkout.
|
||||
work_dir = os.path.dirname(self.default_cwd)
|
||||
assert os.path.join(work_dir, "v8") == self.default_cwd
|
||||
|
||||
if not os.path.exits(work_dir):
|
||||
os.makedirs(work_dir)
|
||||
if not os.path.exits(self.default_cwd):
|
||||
self.Command("fetch", "v8")
|
||||
|
||||
def InitialEnvironmentChecks(self, cwd):
|
||||
# Cancel if this is not a git checkout.
|
||||
if not os.path.exists(os.path.join(cwd, ".git")): # pragma: no cover
|
||||
@ -757,6 +745,19 @@ class Step(GitRecipesMixin):
|
||||
cwd=self._options.svn)
|
||||
|
||||
|
||||
class BootstrapStep(Step):
|
||||
MESSAGE = "Bootstapping v8 checkout."
|
||||
|
||||
def RunStep(self):
|
||||
if os.path.realpath(self.default_cwd) == os.path.realpath(V8_BASE):
|
||||
self.Die("Can't use v8 checkout with calling script as work checkout.")
|
||||
# Directory containing the working v8 checkout.
|
||||
if not os.path.exists(self._options.work_dir):
|
||||
os.makedirs(self._options.work_dir)
|
||||
if not os.path.exists(self.default_cwd):
|
||||
self.Command("fetch", "v8", cwd=self._options.work_dir)
|
||||
|
||||
|
||||
class UploadStep(Step):
|
||||
MESSAGE = "Upload for code review."
|
||||
|
||||
@ -928,7 +929,7 @@ class ScriptsBase(object):
|
||||
os.remove(state_file)
|
||||
|
||||
steps = []
|
||||
for (number, step_class) in enumerate(step_classes):
|
||||
for (number, step_class) in enumerate([BootstrapStep] + step_classes):
|
||||
steps.append(MakeStep(step_class, number, self._state, self._config,
|
||||
options, self._side_effect_handler))
|
||||
for step in steps[options.step:]:
|
||||
|
@ -694,6 +694,21 @@ Performance and stability improvements on all platforms."""
|
||||
commit_msg = """Line with "quotation marks"."""
|
||||
self._TestSquashCommits(change_log, commit_msg)
|
||||
|
||||
def testBootstrapper(self):
|
||||
work_dir = self.MakeEmptyTempDirectory()
|
||||
class FakeScript(ScriptsBase):
|
||||
def _Steps(self):
|
||||
return []
|
||||
|
||||
# Use the test configuration without the fake testing default work dir.
|
||||
fake_config = dict(TEST_CONFIG)
|
||||
del(fake_config["DEFAULT_CWD"])
|
||||
|
||||
self.Expect([
|
||||
Cmd("fetch v8", "", cwd=work_dir),
|
||||
])
|
||||
FakeScript(fake_config, self).Run(["--work-dir", work_dir])
|
||||
|
||||
def _PushToTrunk(self, force=False, manual=False):
|
||||
TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git"))
|
||||
|
||||
@ -1319,7 +1334,7 @@ LOG=N
|
||||
lambda: MergeToBranch(TEST_CONFIG, self).Run(args))
|
||||
|
||||
# Test that state recovery after restarting the script works.
|
||||
args += ["-s", "3"]
|
||||
args += ["-s", "4"]
|
||||
MergeToBranch(TEST_CONFIG, self).Run(args)
|
||||
|
||||
def testMergeToBranchNewGit(self):
|
||||
@ -1460,7 +1475,7 @@ LOG=N
|
||||
lambda: MergeToBranch(TEST_CONFIG, self).Run(args))
|
||||
|
||||
# Test that state recovery after restarting the script works.
|
||||
args += ["-s", "3"]
|
||||
args += ["-s", "4"]
|
||||
MergeToBranch(TEST_CONFIG, self).Run(args)
|
||||
|
||||
def testReleases(self):
|
||||
|
Loading…
Reference in New Issue
Block a user