Refactoring: Remove global configs in release scripts.

TBR=tandrii@chromium.org
TEST=script_test.py

Review URL: https://codereview.chromium.org/594773003

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24154 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 7aaa0dda
......@@ -36,16 +36,8 @@ import urllib
from common_includes import *
import push_to_trunk
SETTINGS_LOCATION = "SETTINGS_LOCATION"
CONFIG = {
PERSISTFILE_BASENAME: "/tmp/v8-auto-push-tempfile",
SETTINGS_LOCATION: "~/.auto-roll",
}
PUSH_MESSAGE_RE = re.compile(r".* \(based on bleeding_edge revision r(\d+)\)$")
class Preparation(Step):
MESSAGE = "Preparation."
......@@ -58,7 +50,7 @@ class CheckAutoPushSettings(Step):
MESSAGE = "Checking settings file."
def RunStep(self):
settings_file = os.path.realpath(self.Config(SETTINGS_LOCATION))
settings_file = os.path.realpath(self.Config("SETTINGS_LOCATION"))
if os.path.exists(settings_file):
settings_dict = json.loads(FileToText(settings_file))
if settings_dict.get("enable_auto_roll") is False:
......@@ -118,9 +110,8 @@ class PushToTrunk(Step):
# TODO(machenbach): Update the script before calling it.
if self._options.push:
P = push_to_trunk.PushToTrunk
self._side_effect_handler.Call(
P(push_to_trunk.CONFIG, self._side_effect_handler).Run,
push_to_trunk.PushToTrunk().Run,
["--author", self._options.author,
"--reviewer", self._options.reviewer,
"--revision", self["lkgr"],
......@@ -140,6 +131,12 @@ class AutoPush(ScriptsBase):
options.requires_editor = False
return True
def _Config(self):
return {
"PERSISTFILE_BASENAME": "/tmp/v8-auto-push-tempfile",
"SETTINGS_LOCATION": "~/.auto-roll",
}
def _Steps(self):
return [
Preparation,
......@@ -152,4 +149,4 @@ class AutoPush(ScriptsBase):
if __name__ == "__main__": # pragma: no cover
sys.exit(AutoPush(CONFIG).Run())
sys.exit(AutoPush().Run())
......@@ -12,13 +12,6 @@ import urllib
from common_includes import *
import chromium_roll
CLUSTERFUZZ_API_KEY_FILE = "CLUSTERFUZZ_API_KEY_FILE"
CONFIG = {
PERSISTFILE_BASENAME: "/tmp/v8-auto-roll-tempfile",
CLUSTERFUZZ_API_KEY_FILE: ".cf_api_key",
}
class CheckActiveRoll(Step):
MESSAGE = "Check active roll."
......@@ -76,10 +69,10 @@ class CheckClusterFuzz(Step):
MESSAGE = "Check ClusterFuzz api for new problems."
def RunStep(self):
if not os.path.exists(self.Config(CLUSTERFUZZ_API_KEY_FILE)):
if not os.path.exists(self.Config("CLUSTERFUZZ_API_KEY_FILE")):
print "Skipping ClusterFuzz check. No api key file found."
return False
api_key = FileToText(self.Config(CLUSTERFUZZ_API_KEY_FILE))
api_key = FileToText(self.Config("CLUSTERFUZZ_API_KEY_FILE"))
# Check for open, reproducible issues that have no associated bug.
result = self._side_effect_handler.ReadClusterFuzzAPI(
api_key, job_type="linux_asan_d8_dbg", reproducible="True",
......@@ -106,10 +99,7 @@ class RollChromium(Step):
"--sheriff", "--googlers-mapping", self._options.googlers_mapping])
if self._options.dry_run:
args.extend(["--dry-run"])
R = chromium_roll.ChromiumRoll
self._side_effect_handler.Call(
R(chromium_roll.CONFIG, self._side_effect_handler).Run,
args)
self._side_effect_handler.Call(chromium_roll.ChromiumRoll().Run, args)
class AutoRoll(ScriptsBase):
......@@ -129,6 +119,12 @@ class AutoRoll(ScriptsBase):
return False
return True
def _Config(self):
return {
"PERSISTFILE_BASENAME": "/tmp/v8-auto-roll-tempfile",
"CLUSTERFUZZ_API_KEY_FILE": ".cf_api_key",
}
def _Steps(self):
return [
CheckActiveRoll,
......@@ -140,4 +136,4 @@ class AutoRoll(ScriptsBase):
if __name__ == "__main__": # pragma: no cover
sys.exit(AutoRoll(CONFIG).Run())
sys.exit(AutoRoll().Run())
......@@ -8,11 +8,6 @@ import sys
from common_includes import *
CONFIG = {
BRANCHNAME: "auto-tag-v8",
PERSISTFILE_BASENAME: "/tmp/v8-auto-tag-tempfile",
}
class Preparation(Step):
MESSAGE = "Preparation."
......@@ -28,7 +23,7 @@ class GetTags(Step):
MESSAGE = "Get all V8 tags."
def RunStep(self):
self.GitCreateBranch(self._config[BRANCHNAME])
self.GitCreateBranch(self._config["BRANCHNAME"])
# Get remote tags.
tags = filter(lambda s: re.match(r"^svn/tags/[\d+\.]+$", s),
......@@ -182,6 +177,12 @@ class AutoTag(ScriptsBase):
options.force_upload = True
return True
def _Config(self):
return {
"BRANCHNAME": "auto-tag-v8",
"PERSISTFILE_BASENAME": "/tmp/v8-auto-tag-tempfile",
}
def _Steps(self):
return [
Preparation,
......@@ -195,4 +196,4 @@ class AutoTag(ScriptsBase):
if __name__ == "__main__": # pragma: no cover
sys.exit(AutoTag(CONFIG).Run())
sys.exit(AutoTag().Run())
......@@ -25,11 +25,6 @@ import sys
from common_includes import *
CONFIG = {
PERSISTFILE_BASENAME: "/tmp/v8-bump-up-version-tempfile",
PATCH_FILE: "/tmp/v8-bump-up-version-tempfile-patch-file",
}
VERSION_BRANCH = "auto-bump-up-version"
......@@ -227,6 +222,11 @@ class BumpUpVersion(ScriptsBase):
options.force_upload = True
return True
def _Config(self):
return {
"PERSISTFILE_BASENAME": "/tmp/v8-bump-up-version-tempfile",
}
def _Steps(self):
return [
Preparation,
......@@ -242,4 +242,4 @@ class BumpUpVersion(ScriptsBase):
]
if __name__ == "__main__": # pragma: no cover
sys.exit(BumpUpVersion(CONFIG).Run())
sys.exit(BumpUpVersion().Run())
......@@ -9,12 +9,6 @@ import sys
from common_includes import *
CHROMIUM = "CHROMIUM"
CONFIG = {
PERSISTFILE_BASENAME: "/tmp/v8-chromium-roll-tempfile",
}
class Preparation(Step):
MESSAGE = "Preparation."
......@@ -116,7 +110,7 @@ class CleanUp(Step):
% self["trunk_revision"])
# Clean up all temporary files.
Command("rm", "-f %s*" % self._config[PERSISTFILE_BASENAME])
Command("rm", "-f %s*" % self._config["PERSISTFILE_BASENAME"])
class ChromiumRoll(ScriptsBase):
......@@ -140,6 +134,11 @@ class ChromiumRoll(ScriptsBase):
options.manual = False
return True
def _Config(self):
return {
"PERSISTFILE_BASENAME": "/tmp/v8-chromium-roll-tempfile",
}
def _Steps(self):
return [
Preparation,
......@@ -154,4 +153,4 @@ class ChromiumRoll(ScriptsBase):
if __name__ == "__main__": # pragma: no cover
sys.exit(ChromiumRoll(CONFIG).Run())
sys.exit(ChromiumRoll().Run())
......@@ -45,13 +45,6 @@ import urllib2
from git_recipes import GitRecipesMixin
from git_recipes import GitFailedException
PERSISTFILE_BASENAME = "PERSISTFILE_BASENAME"
BRANCHNAME = "BRANCHNAME"
CHANGELOG_FILE = "CHANGELOG_FILE"
CHANGELOG_ENTRY_FILE = "CHANGELOG_ENTRY_FILE"
COMMITMSG_FILE = "COMMITMSG_FILE"
PATCH_FILE = "PATCH_FILE"
VERSION_FILE = os.path.join("src", "version.cc")
# V8 base directory.
......@@ -294,7 +287,7 @@ class Step(GitRecipesMixin):
def Run(self):
# Restore state.
state_file = "%s-state.json" % self._config[PERSISTFILE_BASENAME]
state_file = "%s-state.json" % self._config["PERSISTFILE_BASENAME"]
if not self._state and os.path.exists(state_file):
self._state.update(json.loads(FileToText(state_file)))
......@@ -433,15 +426,15 @@ class Step(GitRecipesMixin):
def PrepareBranch(self):
# Delete the branch that will be created later if it exists already.
self.DeleteBranch(self._config[BRANCHNAME])
self.DeleteBranch(self._config["BRANCHNAME"])
def CommonCleanup(self):
self.GitCheckout(self["current_branch"])
if self._config[BRANCHNAME] != self["current_branch"]:
self.GitDeleteBranch(self._config[BRANCHNAME])
if self._config["BRANCHNAME"] != self["current_branch"]:
self.GitDeleteBranch(self._config["BRANCHNAME"])
# Clean up all temporary files.
for f in glob.iglob("%s*" % self._config[PERSISTFILE_BASENAME]):
for f in glob.iglob("%s*" % self._config["PERSISTFILE_BASENAME"]):
if os.path.isfile(f):
os.remove(f)
if os.path.isdir(f):
......@@ -526,12 +519,12 @@ class Step(GitRecipesMixin):
def SVNCommit(self, root, commit_message):
patch = self.GitDiff("HEAD^", "HEAD")
TextToFile(patch, self._config[PATCH_FILE])
TextToFile(patch, self._config["PATCH_FILE"])
self.Command("svn", "update", cwd=self._options.svn)
if self.Command("svn", "status", cwd=self._options.svn) != "":
self.Die("SVN checkout not clean.")
if not self.Command("patch", "-d %s -p1 -i %s" %
(root, self._config[PATCH_FILE]),
(root, self._config["PATCH_FILE"]),
cwd=self._options.svn):
self.Die("Could not apply patch.")
self.Command(
......@@ -608,9 +601,11 @@ def MakeStep(step_class=Step, number=0, state=None, config=None,
class ScriptsBase(object):
# TODO(machenbach): Move static config here.
def __init__(self, config, side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER,
def __init__(self,
config=None,
side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER,
state=None):
self._config = config
self._config = config or self._Config()
self._side_effect_handler = side_effect_handler
self._state = state if state is not None else {}
......@@ -626,6 +621,9 @@ class ScriptsBase(object):
def _Steps(self): # pragma: no cover
raise Exception("Not implemented.")
def _Config(self):
return {}
def MakeOptions(self, args=None):
parser = argparse.ArgumentParser(description=self._Description())
parser.add_argument("-a", "--author", default="",
......@@ -691,7 +689,7 @@ class ScriptsBase(object):
if not options:
return 1
state_file = "%s-state.json" % self._config[PERSISTFILE_BASENAME]
state_file = "%s-state.json" % self._config["PERSISTFILE_BASENAME"]
if options.step == 0 and os.path.exists(state_file):
os.remove(state_file)
......
......@@ -32,31 +32,16 @@ import sys
from common_includes import *
ALREADY_MERGING_SENTINEL_FILE = "ALREADY_MERGING_SENTINEL_FILE"
COMMIT_HASHES_FILE = "COMMIT_HASHES_FILE"
TEMPORARY_PATCH_FILE = "TEMPORARY_PATCH_FILE"
CONFIG = {
BRANCHNAME: "prepare-merge",
PERSISTFILE_BASENAME: "/tmp/v8-merge-to-branch-tempfile",
ALREADY_MERGING_SENTINEL_FILE:
"/tmp/v8-merge-to-branch-tempfile-already-merging",
TEMPORARY_PATCH_FILE: "/tmp/v8-prepare-merge-tempfile-temporary-patch",
COMMITMSG_FILE: "/tmp/v8-prepare-merge-tempfile-commitmsg",
COMMIT_HASHES_FILE: "/tmp/v8-merge-to-branch-tempfile-PATCH_COMMIT_HASHES",
}
class Preparation(Step):
MESSAGE = "Preparation."
def RunStep(self):
if os.path.exists(self.Config(ALREADY_MERGING_SENTINEL_FILE)):
if os.path.exists(self.Config("ALREADY_MERGING_SENTINEL_FILE")):
if self._options.force:
os.remove(self.Config(ALREADY_MERGING_SENTINEL_FILE))
os.remove(self.Config("ALREADY_MERGING_SENTINEL_FILE"))
elif self._options.step == 0: # pragma: no cover
self.Die("A merge is already in progress")
open(self.Config(ALREADY_MERGING_SENTINEL_FILE), "a").close()
open(self.Config("ALREADY_MERGING_SENTINEL_FILE"), "a").close()
self.InitialEnvironmentChecks(self.default_cwd)
if self._options.revert_bleeding_edge:
......@@ -74,7 +59,7 @@ class CreateBranch(Step):
MESSAGE = "Create a fresh branch for the patch."
def RunStep(self):
self.GitCreateBranch(self.Config(BRANCHNAME),
self.GitCreateBranch(self.Config("BRANCHNAME"),
"svn/%s" % self["merge_to_branch"])
......@@ -157,8 +142,8 @@ class ApplyPatches(Step):
print("Applying patch for %s to %s..."
% (commit_hash, self["merge_to_branch"]))
patch = self.GitGetPatch(commit_hash)
TextToFile(patch, self.Config(TEMPORARY_PATCH_FILE))
self.ApplyPatch(self.Config(TEMPORARY_PATCH_FILE), self._options.revert)
TextToFile(patch, self.Config("TEMPORARY_PATCH_FILE"))
self.ApplyPatch(self.Config("TEMPORARY_PATCH_FILE"), self._options.revert)
if self._options.patch:
self.ApplyPatch(self._options.patch, self._options.revert)
......@@ -213,15 +198,15 @@ class CommitLocal(Step):
title = ("Version %s (merged %s)"
% (self["version"], self["revision_list"]))
self["new_commit_msg"] = "%s\n\n%s" % (title, self["new_commit_msg"])
TextToFile(self["new_commit_msg"], self.Config(COMMITMSG_FILE))
self.GitCommit(file_name=self.Config(COMMITMSG_FILE))
TextToFile(self["new_commit_msg"], self.Config("COMMITMSG_FILE"))
self.GitCommit(file_name=self.Config("COMMITMSG_FILE"))
class CommitRepository(Step):
MESSAGE = "Commit to the repository."
def RunStep(self):
self.GitCheckout(self.Config(BRANCHNAME))
self.GitCheckout(self.Config("BRANCHNAME"))
self.WaitForLGTM()
self.GitPresubmit()
self.GitDCommit()
......@@ -310,6 +295,16 @@ class MergeToBranch(ScriptsBase):
options.bypass_upload_hooks = True
return True
def _Config(self):
return {
"BRANCHNAME": "prepare-merge",
"PERSISTFILE_BASENAME": "/tmp/v8-merge-to-branch-tempfile",
"ALREADY_MERGING_SENTINEL_FILE":
"/tmp/v8-merge-to-branch-tempfile-already-merging",
"TEMPORARY_PATCH_FILE": "/tmp/v8-prepare-merge-tempfile-temporary-patch",
"COMMITMSG_FILE": "/tmp/v8-prepare-merge-tempfile-commitmsg",
}
def _Steps(self):
return [
Preparation,
......@@ -329,4 +324,4 @@ class MergeToBranch(ScriptsBase):
if __name__ == "__main__": # pragma: no cover
sys.exit(MergeToBranch(CONFIG).Run())
sys.exit(MergeToBranch().Run())
......@@ -34,18 +34,6 @@ import urllib2
from common_includes import *
TRUNKBRANCH = "TRUNKBRANCH"
CONFIG = {
BRANCHNAME: "prepare-push",
TRUNKBRANCH: "trunk-push",
PERSISTFILE_BASENAME: "/tmp/v8-push-to-trunk-tempfile",
CHANGELOG_FILE: "ChangeLog",
CHANGELOG_ENTRY_FILE: "/tmp/v8-push-to-trunk-tempfile-changelog-entry",
PATCH_FILE: "/tmp/v8-push-to-trunk-tempfile-patch-file",
COMMITMSG_FILE: "/tmp/v8-push-to-trunk-tempfile-commitmsg",
}
PUSH_MESSAGE_SUFFIX = " (based on bleeding_edge revision r%d)"
PUSH_MESSAGE_RE = re.compile(r".* \(based on bleeding_edge revision r(\d+)\)$")
......@@ -56,19 +44,19 @@ class Preparation(Step):
self.InitialEnvironmentChecks(self.default_cwd)
self.CommonPrepare()
if(self["current_branch"] == self.Config(TRUNKBRANCH)
or self["current_branch"] == self.Config(BRANCHNAME)):
if(self["current_branch"] == self.Config("TRUNKBRANCH")
or self["current_branch"] == self.Config("BRANCHNAME")):
print "Warning: Script started on branch %s" % self["current_branch"]
self.PrepareBranch()
self.DeleteBranch(self.Config(TRUNKBRANCH))
self.DeleteBranch(self.Config("TRUNKBRANCH"))
class FreshBranch(Step):
MESSAGE = "Create a fresh branch."
def RunStep(self):
self.GitCreateBranch(self.Config(BRANCHNAME), "svn/bleeding_edge")
self.GitCreateBranch(self.Config("BRANCHNAME"), "svn/bleeding_edge")
class PreparePushRevision(Step):
......@@ -204,7 +192,7 @@ class PrepareChangeLog(Step):
def RunStep(self):
self["date"] = self.GetDate()
output = "%s: Version %s\n\n" % (self["date"], self["version"])
TextToFile(output, self.Config(CHANGELOG_ENTRY_FILE))
TextToFile(output, self.Config("CHANGELOG_ENTRY_FILE"))
commits = self.GitLog(format="%H",
git_hash="%s..%s" % (self["last_push_bleeding_edge"],
self["push_hash"]))
......@@ -220,17 +208,17 @@ class PrepareChangeLog(Step):
# Auto-format commit messages.
body = MakeChangeLogBody(commit_messages, auto_format=True)
AppendToFile(body, self.Config(CHANGELOG_ENTRY_FILE))
AppendToFile(body, self.Config("CHANGELOG_ENTRY_FILE"))
msg = (" Performance and stability improvements on all platforms."
"\n#\n# The change log above is auto-generated. Please review if "
"all relevant\n# commit messages from the list below are included."
"\n# All lines starting with # will be stripped.\n#\n")
AppendToFile(msg, self.Config(CHANGELOG_ENTRY_FILE))
AppendToFile(msg, self.Config("CHANGELOG_ENTRY_FILE"))
# Include unformatted commit messages as a reference in a comment.
comment_body = MakeComment(MakeChangeLogBody(commit_messages))
AppendToFile(comment_body, self.Config(CHANGELOG_ENTRY_FILE))
AppendToFile(comment_body, self.Config("CHANGELOG_ENTRY_FILE"))
class EditChangeLog(Step):
......@@ -241,10 +229,10 @@ class EditChangeLog(Step):
"entry, then edit its contents to your liking. When you're done, "
"save the file and exit your EDITOR. ")
self.ReadLine(default="")
self.Editor(self.Config(CHANGELOG_ENTRY_FILE))
self.Editor(self.Config("CHANGELOG_ENTRY_FILE"))
# Strip comments and reformat with correct indentation.
changelog_entry = FileToText(self.Config(CHANGELOG_ENTRY_FILE)).rstrip()
changelog_entry = FileToText(self.Config("CHANGELOG_ENTRY_FILE")).rstrip()
changelog_entry = StripComments(changelog_entry)
changelog_entry = "\n".join(map(Fill80, changelog_entry.splitlines()))
changelog_entry = changelog_entry.lstrip()
......@@ -253,7 +241,7 @@ class EditChangeLog(Step):
self.Die("Empty ChangeLog entry.")
# Safe new change log for adding it later to the trunk patch.
TextToFile(changelog_entry, self.Config(CHANGELOG_ENTRY_FILE))
TextToFile(changelog_entry, self.Config("CHANGELOG_ENTRY_FILE"))
class StragglerCommits(Step):
......@@ -272,10 +260,10 @@ class SquashCommits(Step):
# Instead of relying on "git rebase -i", we'll just create a diff, because
# that's easier to automate.
TextToFile(self.GitDiff("svn/trunk", self["push_hash"]),
self.Config(PATCH_FILE))
self.Config("PATCH_FILE"))
# Convert the ChangeLog entry to commit message format.
text = FileToText(self.Config(CHANGELOG_ENTRY_FILE))
text = FileToText(self.Config("CHANGELOG_ENTRY_FILE"))
# Remove date and trailing white space.
text = re.sub(r"^%s: " % self["date"], "", text.rstrip())
......@@ -295,22 +283,22 @@ class SquashCommits(Step):
if not text: # pragma: no cover
self.Die("Commit message editing failed.")
TextToFile(text, self.Config(COMMITMSG_FILE))
TextToFile(text, self.Config("COMMITMSG_FILE"))
class NewBranch(Step):
MESSAGE = "Create a new branch from trunk."
def RunStep(self):
self.GitCreateBranch(self.Config(TRUNKBRANCH), "svn/trunk")
self.GitCreateBranch(self.Config("TRUNKBRANCH"), "svn/trunk")
class ApplyChanges(Step):
MESSAGE = "Apply squashed changes."
def RunStep(self):
self.ApplyPatch(self.Config(PATCH_FILE))
os.remove(self.Config(PATCH_FILE))
self.ApplyPatch(self.Config("PATCH_FILE"))
os.remove(self.Config("PATCH_FILE"))
class AddChangeLog(Step):
......@@ -320,12 +308,12 @@ class AddChangeLog(Step):
# The change log has been modified by the patch. Reset it to the version
# on trunk and apply the exact changes determined by this PrepareChangeLog
# step above.
self.GitCheckoutFile(self.Config(CHANGELOG_FILE), "svn/trunk")
changelog_entry = FileToText(self.Config(CHANGELOG_ENTRY_FILE))
old_change_log = FileToText(self.Config(CHANGELOG_FILE))
self.GitCheckoutFile(self.Config("CHANGELOG_FILE"), "svn/trunk")
changelog_entry = FileToText(self.Config("CHANGELOG_ENTRY_FILE"))
old_change_log = FileToText(self.Config("CHANGELOG_FILE"))
new_change_log = "%s\n\n\n%s" % (changelog_entry, old_change_log)
TextToFile(new_change_log, self.Config(CHANGELOG_FILE))
os.remove(self.Config(CHANGELOG_ENTRY_FILE))
TextToFile(new_change_log, self.Config("CHANGELOG_FILE"))
os.remove(self.Config("CHANGELOG_ENTRY_FILE"))
class SetVersion(Step):
......@@ -342,8 +330,8 @@ class CommitTrunk(Step):
MESSAGE = "Commit to local trunk branch."
def RunStep(self):
self.GitCommit(file_name = self.Config(COMMITMSG_FILE))
os.remove(self.Config(COMMITMSG_FILE))
self.GitCommit(file_name = self.Config("COMMITMSG_FILE"))
os.remove(self.Config("COMMITMSG_FILE"))
class SanityCheck(Step):
......@@ -400,8 +388,8 @@ class CleanUp(Step):
print "%s\ttrunk\t%s" % (self["version"], self["trunk_revision"])
self.CommonCleanup()
if self.Config(TRUNKBRANCH) != self["current_branch"]:
self.GitDeleteBranch(self.Config(TRUNKBRANCH))
if self.Config("TRUNKBRANCH") != self["current_branch"]:
self.GitDeleteBranch(self.Config("TRUNKBRANCH"))
class PushToTrunk(ScriptsBase):
......@@ -437,6 +425,17 @@ class PushToTrunk(ScriptsBase):
options.tbr_commit = not options.manual
return True
def _Config(self):
return {
"BRANCHNAME": "prepare-push",
"TRUNKBRANCH": "trunk-push",
"PERSISTFILE_BASENAME": "/tmp/v8-push-to-trunk-tempfile",
"CHANGELOG_FILE": "ChangeLog",
"CHANGELOG_ENTRY_FILE": "/tmp/v8-push-to-trunk-tempfile-changelog-entry",
"PATCH_FILE": "/tmp/v8-push-to-trunk-tempfile-patch-file",
"COMMITMSG_FILE": "/tmp/v8-push-to-trunk-tempfile-commitmsg",
}
def _Steps(self):
return [
Preparation,
......@@ -462,4 +461,4 @@ class PushToTrunk(ScriptsBase):
if __name__ == "__main__": # pragma: no cover
sys.exit(PushToTrunk(CONFIG).Run())
sys.exit(PushToTrunk().Run())
......@@ -20,11 +20,9 @@ import sys
from common_includes import *
CHROMIUM = "CHROMIUM"
CONFIG = {
BRANCHNAME: "retrieve-v8-releases",
PERSISTFILE_BASENAME: "/tmp/v8-releases-tempfile",
"BRANCHNAME": "retrieve-v8-releases",
"PERSISTFILE_BASENAME": "/tmp/v8-releases-tempfile",
}
# Expression for retrieving the bleeding edge revision from a commit message.
......@@ -231,7 +229,7 @@ class RetrieveV8Releases(Step):
return releases
def RunStep(self):
self.GitCreateBranch(self._config[BRANCHNAME])
self.GitCreateBranch(self._config["BRANCHNAME"])
# Get relevant remote branches, e.g. "svn/3.25".
branches = filter(lambda s: re.match(r"^svn/\d+\.\d+$", s),
self.GitRemotes())
......@@ -284,7 +282,7 @@ class UpdateChromiumCheckout(Step):
cwd = self._options.chromium
self.GitCheckout("master", cwd=cwd)
self.GitPull(cwd=cwd)
self.GitCreateBranch(self.Config(BRANCHNAME), cwd=cwd)
self.GitCreateBranch(self.Config("BRANCHNAME"), cwd=cwd)
def ConvertToCommitNumber(step, revision):
......@@ -408,7 +406,7 @@ class CleanUp(Step):
def RunStep(self):
self.GitCheckout("master", cwd=self._options.chromium)
self.GitDeleteBranch(self.Config(BRANCHNAME), cwd=self._options.chromium)
self.GitDeleteBranch(self.Config("BRANCHNAME"), cwd=self._options.chromium)
self.CommonCleanup()
......@@ -449,6 +447,12 @@ class Releases(ScriptsBase):
def _ProcessOptions(self, options): # pragma: no cover
return True
def _Config(self):
return {
"BRANCHNAME": "retrieve-v8-releases",
"PERSISTFILE_BASENAME": "/tmp/v8-releases-tempfile",
}
def _Steps(self):
return [
Preparation,
......@@ -463,4 +467,4 @@ class Releases(ScriptsBase):
if __name__ == "__main__": # pragma: no cover
sys.exit(Releases(CONFIG).Run())
sys.exit(Releases().Run())
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment