From: machenbach@chromium.org Date: Mon, 3 Nov 2014 09:31:13 +0000 (+0000) Subject: Fix workdir feature for release scripts. X-Git-Tag: upstream/4.7.83~5955 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=06f17c14c1458a85640dff47b74ad1d6ceb76a9d;p=platform%2Fupstream%2Fv8.git 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 --- diff --git a/tools/push-to-trunk/auto_push.py b/tools/push-to-trunk/auto_push.py index cec1489..b0f1b26 100755 --- a/tools/push-to-trunk/auto_push.py +++ b/tools/push-to-trunk/auto_push.py @@ -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: diff --git a/tools/push-to-trunk/auto_roll.py b/tools/push-to-trunk/auto_roll.py index 2cca070..00f45e0 100755 --- a/tools/push-to-trunk/auto_roll.py +++ b/tools/push-to-trunk/auto_roll.py @@ -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) diff --git a/tools/push-to-trunk/common_includes.py b/tools/push-to-trunk/common_includes.py index f545a24..e95d555 100644 --- a/tools/push-to-trunk/common_includes.py +++ b/tools/push-to-trunk/common_includes.py @@ -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:]: diff --git a/tools/push-to-trunk/test_scripts.py b/tools/push-to-trunk/test_scripts.py index bc52a1c..6eeb323 100644 --- a/tools/push-to-trunk/test_scripts.py +++ b/tools/push-to-trunk/test_scripts.py @@ -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):