Commit 7c43fcb2 authored by machenbach's avatar machenbach Committed by Commit bot

[release] Make release scripts work without gnumbd

This splits branch ref creation and landing. The ref now directly uses
heads (without pending) and for landing we use depot_tools.

For simplicity, the check for existing tags is removed, as it now
is very unlikely to happen again without gnumbd.

BUG=chromium:674448
NOTRY=true
TBR=tandrii@chromium.org

Review-Url: https://codereview.chromium.org/2584523002
Cr-Commit-Position: refs/heads/master@{#41716}
parent b5925c0a
...@@ -15,12 +15,7 @@ class Preparation(Step): ...@@ -15,12 +15,7 @@ class Preparation(Step):
MESSAGE = "Preparation." MESSAGE = "Preparation."
def RunStep(self): def RunStep(self):
fetchspecs = [ self.Git("fetch origin +refs/heads/*:refs/heads/*")
"+refs/heads/*:refs/heads/*",
"+refs/pending/*:refs/pending/*",
"+refs/pending-tags/*:refs/pending-tags/*",
]
self.Git("fetch origin %s" % " ".join(fetchspecs))
self.GitCheckout("origin/master") self.GitCheckout("origin/master")
self.DeleteBranch("work-branch") self.DeleteBranch("work-branch")
...@@ -155,12 +150,23 @@ class EditChangeLog(Step): ...@@ -155,12 +150,23 @@ class EditChangeLog(Step):
TextToFile(changelog_entry, self.Config("CHANGELOG_ENTRY_FILE")) TextToFile(changelog_entry, self.Config("CHANGELOG_ENTRY_FILE"))
class PushBranchRef(Step):
MESSAGE = "Create branch ref."
def RunStep(self):
cmd = "push origin %s:refs/heads/%s" % (self["push_hash"], self["version"])
if self._options.dry_run:
print "Dry run. Command:\ngit %s" % cmd
else:
self.Git(cmd)
class MakeBranch(Step): class MakeBranch(Step):
MESSAGE = "Create the branch." MESSAGE = "Create the branch."
def RunStep(self): def RunStep(self):
self.Git("reset --hard origin/master") self.Git("reset --hard origin/master")
self.Git("checkout -b work-branch %s" % self["push_hash"]) self.Git("new-branch work-branch --upstream origin/%s" % self["version"])
self.GitCheckoutFile(CHANGELOG_FILE, self["latest_version"]) self.GitCheckoutFile(CHANGELOG_FILE, self["latest_version"])
self.GitCheckoutFile(VERSION_FILE, self["latest_version"]) self.GitCheckoutFile(VERSION_FILE, self["latest_version"])
self.GitCheckoutFile(WATCHLISTS_FILE, self["latest_version"]) self.GitCheckoutFile(WATCHLISTS_FILE, self["latest_version"])
...@@ -223,37 +229,11 @@ class CommitBranch(Step): ...@@ -223,37 +229,11 @@ class CommitBranch(Step):
os.remove(self.Config("CHANGELOG_ENTRY_FILE")) os.remove(self.Config("CHANGELOG_ENTRY_FILE"))
class FixBrokenTag(Step):
MESSAGE = "Check for a missing tag and fix that instead."
def RunStep(self):
commit = None
try:
commit = self.GitLog(
n=1, format="%H",
grep=self["commit_title"],
branch="origin/%s" % self["version"],
)
except GitFailedException:
# In the normal case, the remote doesn't exist yet and git will fail.
pass
if commit:
print "Found %s. Trying to repair tag and bail out." % self["version"]
self.Git("tag %s %s" % (self["version"], commit))
self.Git("push origin refs/tags/%s" % self["version"])
return True
class PushBranch(Step): class PushBranch(Step):
MESSAGE = "Push changes." MESSAGE = "Push changes."
def RunStep(self): def RunStep(self):
pushspecs = [ cmd = "cl land --bypass-hooks -f"
"refs/heads/work-branch:refs/pending/heads/%s" % self["version"],
"%s:refs/pending-tags/heads/%s" % (self["push_hash"], self["version"]),
"%s:refs/heads/%s" % (self["push_hash"], self["version"]),
]
cmd = "push origin %s" % " ".join(pushspecs)
if self._options.dry_run: if self._options.dry_run:
print "Dry run. Command:\ngit %s" % cmd print "Dry run. Command:\ngit %s" % cmd
else: else:
...@@ -319,12 +299,12 @@ class CreateRelease(ScriptsBase): ...@@ -319,12 +299,12 @@ class CreateRelease(ScriptsBase):
DetectLastRelease, DetectLastRelease,
PrepareChangeLog, PrepareChangeLog,
EditChangeLog, EditChangeLog,
PushBranchRef,
MakeBranch, MakeBranch,
AddChangeLog, AddChangeLog,
SetVersion, SetVersion,
EnableMergeWatchlist, EnableMergeWatchlist,
CommitBranch, CommitBranch,
FixBrokenTag,
PushBranch, PushBranch,
TagRevision, TagRevision,
CleanUp, CleanUp,
......
...@@ -945,10 +945,7 @@ Performance and stability improvements on all platforms.""" ...@@ -945,10 +945,7 @@ Performance and stability improvements on all platforms."""
change_log) change_log)
expectations = [ expectations = [
Cmd("git fetch origin " Cmd("git fetch origin +refs/heads/*:refs/heads/*", ""),
"+refs/heads/*:refs/heads/* "
"+refs/pending/*:refs/pending/* "
"+refs/pending-tags/*:refs/pending-tags/*", ""),
Cmd("git checkout -f origin/master", ""), Cmd("git checkout -f origin/master", ""),
Cmd("git branch", ""), Cmd("git branch", ""),
Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
...@@ -962,8 +959,9 @@ Performance and stability improvements on all platforms.""" ...@@ -962,8 +959,9 @@ Performance and stability improvements on all platforms."""
Cmd("git log -1 --format=%s rev1", "Log text 1.\n"), Cmd("git log -1 --format=%s rev1", "Log text 1.\n"),
Cmd("git log -1 --format=%B rev1", "Text\nLOG=YES\nBUG=v8:321\nText\n"), Cmd("git log -1 --format=%B rev1", "Text\nLOG=YES\nBUG=v8:321\nText\n"),
Cmd("git log -1 --format=%an rev1", "author1@chromium.org\n"), Cmd("git log -1 --format=%an rev1", "author1@chromium.org\n"),
Cmd("git push origin push_hash:refs/heads/3.22.5", ""),
Cmd("git reset --hard origin/master", ""), Cmd("git reset --hard origin/master", ""),
Cmd("git checkout -b work-branch push_hash", ""), Cmd("git new-branch work-branch --upstream origin/3.22.5", ""),
Cmd("git checkout -f 3.22.4 -- ChangeLog", "", cb=ResetChangeLog), Cmd("git checkout -f 3.22.4 -- ChangeLog", "", cb=ResetChangeLog),
Cmd("git checkout -f 3.22.4 -- include/v8-version.h", "", Cmd("git checkout -f 3.22.4 -- include/v8-version.h", "",
cb=self.WriteFakeVersionFile), cb=self.WriteFakeVersionFile),
...@@ -971,12 +969,7 @@ Performance and stability improvements on all platforms.""" ...@@ -971,12 +969,7 @@ Performance and stability improvements on all platforms."""
cb=self.WriteFakeWatchlistsFile), cb=self.WriteFakeWatchlistsFile),
Cmd("git commit -aF \"%s\"" % TEST_CONFIG["COMMITMSG_FILE"], "", Cmd("git commit -aF \"%s\"" % TEST_CONFIG["COMMITMSG_FILE"], "",
cb=CheckVersionCommit), cb=CheckVersionCommit),
Cmd("git log -1 --format=%H --grep=\"Version 3.22.5\" origin/3.22.5", Cmd("git cl land --bypass-hooks -f", ""),
""),
Cmd("git push origin "
"refs/heads/work-branch:refs/pending/heads/3.22.5 "
"push_hash:refs/pending-tags/heads/3.22.5 "
"push_hash:refs/heads/3.22.5", ""),
Cmd("git fetch", ""), Cmd("git fetch", ""),
Cmd("git log -1 --format=%H --grep=" Cmd("git log -1 --format=%H --grep="
"\"Version 3.22.5\" origin/3.22.5", "hsh_to_tag"), "\"Version 3.22.5\" origin/3.22.5", "hsh_to_tag"),
......
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