From: machenbach@chromium.org Date: Mon, 3 Nov 2014 08:41:13 +0000 (+0000) Subject: Add workdir feature to release scripts. X-Git-Tag: upstream/4.7.83~5957 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=310000ae8550b151eec72978f6c2965652e4ff18;p=platform%2Fupstream%2Fv8.git Add workdir feature to release scripts. BUG=408523 LOG=n TEST=script_test.py TBR=tandrii@chromium.org Review URL: https://codereview.chromium.org/701463002 Cr-Commit-Position: refs/heads/master@{#25056} git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@25056 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/tools/push-to-trunk/common_includes.py b/tools/push-to-trunk/common_includes.py index 021b8bb..f545a24 100644 --- a/tools/push-to-trunk/common_includes.py +++ b/tools/push-to-trunk/common_includes.py @@ -48,7 +48,7 @@ from git_recipes import GitFailedException VERSION_FILE = os.path.join("src", "version.cc") # V8 base directory. -DEFAULT_CWD = os.path.dirname( +V8_BASE = os.path.dirname( os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) @@ -470,7 +470,8 @@ class Step(GitRecipesMixin): self.vc.InjectStep(self) # The testing configuration might set a different default cwd. - self.default_cwd = self._config.get("DEFAULT_CWD") or DEFAULT_CWD + self.default_cwd = (self._config.get("DEFAULT_CWD") or + os.path.join(self._options.work_dir, "v8")) assert self._number >= 0 assert self._config is not None @@ -607,6 +608,18 @@ 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 @@ -859,6 +872,9 @@ class ScriptsBase(object): parser.add_argument("--vc-interface", help=("Choose VC interface out of git_svn|" "git_read_svn_write.")) + parser.add_argument("--work-dir", + help=("Location where to bootstrap a working v8 " + "checkout.")) self._PrepareOptions(parser) if args is None: # pragma: no cover @@ -898,6 +914,8 @@ class ScriptsBase(object): if not options.vc_interface: options.vc_interface = "git_read_svn_write" + if not options.work_dir: + options.work_dir = "/tmp/v8-release-scripts-work-dir" return options def RunSteps(self, step_classes, args=None): diff --git a/tools/push-to-trunk/test_scripts.py b/tools/push-to-trunk/test_scripts.py index d92c388..bc52a1c 100644 --- a/tools/push-to-trunk/test_scripts.py +++ b/tools/push-to-trunk/test_scripts.py @@ -967,7 +967,8 @@ Performance and stability improvements on all platforms.""", commit) args = ["-a", "author@chromium.org", "--revision", "push_hash", "--vc-interface", "git", "-f", "-r", "reviewer@chromium.org", - "--svn", svn_root, "--svn-config", "[CONFIG_DIR]"] + "--svn", svn_root, "--svn-config", "[CONFIG_DIR]", + "--work-dir", TEST_CONFIG["DEFAULT_CWD"]] PushToTrunk(TEST_CONFIG, self).Run(args) cl = FileToText(TEST_CONFIG["CHANGELOG_FILE"])