Remove the requirement that we have a sticky ebuild when not revving the sticky chrome branch
BUG=chromium-os:20334
TEST=unittests + cros_mark_chrome w/ latest_release and stable_release
Change-Id: I73756b5e003b251e1e7138673ae6a01ec60f8e34
Reviewed-on: https://gerrit.chromium.org/gerrit/16862
Commit-Ready: Chris Sosa <sosa@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
(cherry picked from commit 9ba477583747125475732a980d4a11a9fbd702fd)
Reviewed-on: https://gerrit.chromium.org/gerrit/37842
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
diff --git a/buildbot/constants.py b/buildbot/constants.py
index d502471..4c662ae 100644
--- a/buildbot/constants.py
+++ b/buildbot/constants.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -47,8 +47,8 @@
# revsion of the Chromium src tree and build with that checkout.
CHROME_REV_TOT = 'tot'
-# Builds and validates _alpha ebuilds. These builds sync to a particular
-# revsion of the Chromium src tree and build with that checkout.
+# Builds and validates chrome at a given revision through cbuildbot
+# --chrome_version
CHROME_REV_SPEC = 'spec'
# Builds and validates the latest Chromium release as defined by
diff --git a/buildbot/cros_mark_chrome_as_stable.py b/buildbot/cros_mark_chrome_as_stable.py
index 596c94c..2a10130 100755
--- a/buildbot/cros_mark_chrome_as_stable.py
+++ b/buildbot/cros_mark_chrome_as_stable.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
-# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -243,7 +243,8 @@
stable_ebuilds: A list of stable ebuilds.
chrome_rev: The chrome_rev designating which candidate to find.
sticky_branch: The the branch that is currently sticky with Major/Minor
- components. For example: 9.0.553
+ components. For example: 9.0.553. Can be None but not if chrome_rev
+ is CHROME_REV_STICKY.
Returns:
Returns the EBuild, otherwise None if none found.
"""
@@ -258,6 +259,7 @@
candidates.append(ebuild)
elif chrome_rev == constants.CHROME_REV_STICKY:
+ assert sticky_branch is not None
chrome_branch_re = re.compile('%s\..*' % sticky_branch)
for ebuild in stable_ebuilds:
if chrome_branch_re.search(ebuild.version):
@@ -266,8 +268,7 @@
else:
chrome_branch_re = re.compile('%s.*_rc.*' % _CHROME_VERSION_REGEX)
for ebuild in stable_ebuilds:
- if chrome_branch_re.search(ebuild.version) and (
- not ebuild.chrome_version.startswith(sticky_branch)):
+ if chrome_branch_re.search(ebuild.version):
candidates.append(ebuild)
if candidates:
@@ -362,8 +363,7 @@
new_chrome.chrome_version)
def MarkChromeEBuildAsStable(stable_candidate, unstable_ebuild, chrome_rev,
- chrome_version, commit, overlay_dir,
- sticky_ebuild):
+ chrome_version, commit, overlay_dir):
"""Uprevs the chrome ebuild specified by chrome_rev.
This is the main function that uprevs the chrome_rev from a stable candidate
@@ -387,7 +387,6 @@
chrome_version: The \d.\d.\d.\d version of Chrome.
commit: Used with constants.CHROME_REV_TOT. The svn revision of chrome.
overlay_dir: Path to the chromeos-chrome package dir.
- sticky_ebuild: EBuild class for the sticky ebuild.
Returns:
Full portage version atom (including rc's, etc) that was revved.
"""
@@ -446,7 +445,7 @@
chrome_rev))
RunCommand(['git', 'add', new_ebuild_path])
- if stable_candidate and stable_candidate != sticky_ebuild:
+ if stable_candidate and not stable_candidate.IsSticky():
RunCommand(['git', 'rm', stable_candidate.ebuild_path])
portage_utilities.EBuild.CommitChange(
@@ -490,11 +489,9 @@
chrome_rev = args[0]
version_to_uprev = None
commit_to_use = None
+ sticky_branch = None
(unstable_ebuild, stable_ebuilds) = FindChromeCandidates(overlay_dir)
- sticky_ebuild = _GetStickyEBuild(stable_ebuilds)
- sticky_version = sticky_ebuild.chrome_version
- sticky_branch = sticky_version.rpartition('.')[0]
if chrome_rev == constants.CHROME_REV_LOCAL:
if 'CHROME_ROOT' in os.environ:
@@ -506,7 +503,6 @@
commit_to_use = 'Unknown'
Info('Using local source, versioning is untrustworthy.')
elif chrome_rev == constants.CHROME_REV_SPEC:
- # TODO(sosa): Buildbot may pass url@revision, check and fix commit.
commit_to_use = options.force_revision
if '@' in commit_to_use: commit_to_use = ParseMaxRevision(commit_to_use)
version_to_uprev = _GetSpecificVersionUrl(options.chrome_url,
@@ -517,11 +513,10 @@
commit_to_use)
elif chrome_rev == constants.CHROME_REV_LATEST:
version_to_uprev = _GetLatestRelease(options.chrome_url)
- # Don't rev on stable branch for latest_release.
- if re.match('%s\.\d+' % sticky_branch, version_to_uprev):
- Info('Latest release is sticky branch. Nothing to do.')
- return
else:
+ sticky_ebuild = _GetStickyEBuild(stable_ebuilds)
+ sticky_version = sticky_ebuild.chrome_version
+ sticky_branch = sticky_version.rpartition('.')[0]
version_to_uprev = _GetLatestRelease(options.chrome_url, sticky_branch)
stable_candidate = FindChromeUprevCandidate(stable_ebuilds, chrome_rev,
@@ -539,7 +534,7 @@
work_branch.CreateBranch()
chrome_version_atom = MarkChromeEBuildAsStable(
stable_candidate, unstable_ebuild, chrome_rev, version_to_uprev,
- commit_to_use, overlay_dir, sticky_ebuild)
+ commit_to_use, overlay_dir)
# Explicit print to communicate to caller.
if chrome_version_atom:
cros_mark_as_stable.CleanStalePackages(options.board, [chrome_version_atom])
diff --git a/buildbot/cros_mark_chrome_as_stable_unittest.py b/buildbot/cros_mark_chrome_as_stable_unittest.py
index 8cc314b..bcea1d2 100755
--- a/buildbot/cros_mark_chrome_as_stable_unittest.py
+++ b/buildbot/cros_mark_chrome_as_stable_unittest.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
-# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -308,7 +308,6 @@
self.mox.StubOutWithMock(portage_utilities.EBuild, 'CommitChange')
stable_candidate = cros_mark_chrome_as_stable.ChromeEBuild(old_ebuild_path)
unstable_ebuild = cros_mark_chrome_as_stable.ChromeEBuild(self.unstable)
- sticky_ebuild = cros_mark_chrome_as_stable.ChromeEBuild(self.sticky)
chrome_version = new_version
commit = None
overlay_dir = self.mock_chrome_dir
@@ -321,7 +320,7 @@
self.mox.ReplayAll()
cros_mark_chrome_as_stable.MarkChromeEBuildAsStable(
stable_candidate, unstable_ebuild, chrome_rev, chrome_version, commit,
- overlay_dir, sticky_ebuild)
+ overlay_dir)
self.mox.VerifyAll()
def testStickyMarkAsStable(self):
diff --git a/buildbot/portage_utilities.py b/buildbot/portage_utilities.py
index 7fdc9dc..c78e815 100644
--- a/buildbot/portage_utilities.py
+++ b/buildbot/portage_utilities.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -117,6 +117,10 @@
command, redirect_stdout=True, print_cmd=cls.verbose, shell=True)
return command_result.output
+ def IsSticky(self):
+ """Returns True if the ebuild is sticky."""
+ return self.is_stable and self.current_revision == 0
+
@classmethod
def MarkAsStable(cls, unstable_ebuild_path, new_stable_ebuild_path,
commit_keyword, commit_value, redirect_file=None,