mirror of
https://github.com/flatcar/scripts.git
synced 2026-05-05 12:16:41 +02:00
Revert "Have the ability for the PFQ to both rev Chrome and ..."
This reverts the commit a8ac0ec8c3fd481c48e3846a8dfcae8105bab14a. TBR the x86 PFQ buildbot fails BUG=chromium-os:11447 TEST= TBR=sosa Change-Id: I019de669db13b753365e1208acc9923c4bb5c993 Review URL: http://codereview.chromium.org/6339018
This commit is contained in:
parent
a8ac0ec8c3
commit
3eb3543e9a
@ -326,12 +326,12 @@ def _IncrementalCheckout(buildroot, retries=_DEFAULT_RETRIES):
|
||||
def _MakeChroot(buildroot, replace=False):
|
||||
"""Wrapper around make_chroot."""
|
||||
cwd = os.path.join(buildroot, 'src', 'scripts')
|
||||
|
||||
|
||||
cmd = ['./make_chroot', '--fast']
|
||||
|
||||
|
||||
if replace:
|
||||
cmd.append('--replace')
|
||||
|
||||
|
||||
RunCommand(cmd, cwd=cwd)
|
||||
|
||||
|
||||
@ -374,7 +374,7 @@ def _Build(buildroot, emptytree, build_autotest=True, usepkg=True):
|
||||
|
||||
if not build_autotest:
|
||||
cmd.append('--nowithautotest')
|
||||
|
||||
|
||||
if not usepkg:
|
||||
cmd.append('--nousepkg')
|
||||
|
||||
@ -738,17 +738,17 @@ def main():
|
||||
if not os.path.isdir(boardpath):
|
||||
_SetupBoard(buildroot, board=buildconfig['board'])
|
||||
|
||||
# Perform chrome uprev.
|
||||
# Perform uprev. If chrome_uprev is set, rev Chrome ebuilds.
|
||||
if options.chrome_rev:
|
||||
chrome_atom_to_build = _MarkChromeAsStable(buildroot, tracking_branch,
|
||||
options.chrome_rev, board)
|
||||
# Perform other uprevs.
|
||||
if buildconfig['uprev']:
|
||||
# If we found nothing to rev, we're done here.
|
||||
if not chrome_atom_to_build:
|
||||
return
|
||||
|
||||
elif buildconfig['uprev']:
|
||||
_UprevPackages(buildroot, tracking_branch, revisionfile,
|
||||
buildconfig['board'], rev_overlays)
|
||||
elif not chrome_atom_to_build:
|
||||
# We found nothing to rev, we're done here.
|
||||
return
|
||||
|
||||
_EnableLocalAccount(buildroot)
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ push_overlays -- Select what overlays to push at. This should be a subset of
|
||||
rev_overlays for the particular builder. Must be None if
|
||||
not a master. There should only be one master bot pushing
|
||||
changes to each overlay per branch.
|
||||
|
||||
|
||||
unittests -- Runs unittests for packages.
|
||||
vm_tests -- Runs the smoke suite and au test harness in a qemu-based VM
|
||||
using KVM.
|
||||
@ -58,7 +58,7 @@ default = {
|
||||
|
||||
'usepkg' : True,
|
||||
'chroot_replace' : False,
|
||||
|
||||
|
||||
'archive_build' : False,
|
||||
'test_mod' : True,
|
||||
'factory_install_mod' : True,
|
||||
@ -76,14 +76,10 @@ config['x86-generic-pre-flight-queue'].update({
|
||||
'rev_overlays': 'public',
|
||||
'push_overlays': 'public',
|
||||
})
|
||||
config['x86-generic-chrome-pre-flight-queue'] = default.copy()
|
||||
config['x86-generic-chrome-pre-flight-queue'].update({
|
||||
'board' : 'x86-generic',
|
||||
'uprev' : False,
|
||||
'master' : True,
|
||||
'rev_overlays': 'public',
|
||||
'push_overlays': 'public',
|
||||
})
|
||||
|
||||
config['x86-generic-chrome-pre-flight-queue'] = \
|
||||
config['x86-generic-pre-flight-queue']
|
||||
|
||||
config['x86-mario-pre-flight-queue'] = default.copy()
|
||||
config['x86-mario-pre-flight-queue'].update({
|
||||
'board' : 'x86-mario',
|
||||
@ -92,6 +88,7 @@ config['x86-mario-pre-flight-queue'].update({
|
||||
'rev_overlays': 'both',
|
||||
'push_overlays': 'private',
|
||||
})
|
||||
|
||||
config['x86-mario-pre-flight-branch'] = default.copy()
|
||||
config['x86-mario-pre-flight-branch'].update({
|
||||
'board' : 'x86-mario',
|
||||
@ -149,6 +146,6 @@ config['arm-generic-bin'].update({
|
||||
# TODO(dgarrett) delete when buildbot updated to use new names
|
||||
config['x86_agz_bin'] = config['x86-agz-bin']
|
||||
config['x86_dogfood_bin'] = config['x86-dogfood-bin']
|
||||
config['x86_pineview_bin'] = config['x86-pineview-bin']
|
||||
config['arm_tegra2_bin'] = config['arm-tegra2-bin']
|
||||
config['arm_generic_bin'] = config['arm-generic-bin']
|
||||
config['x86_pineview_bin'] = config['x86-pineview-bin']
|
||||
config['arm_tegra2_bin'] = config['arm-tegra2-bin']
|
||||
config['arm_generic_bin'] = config['arm-generic-bin']
|
||||
|
||||
@ -345,12 +345,18 @@ def main():
|
||||
work_branch = cros_mark_as_stable.GitBranch(
|
||||
cros_mark_as_stable.STABLE_BRANCH_NAME, options.tracking_branch)
|
||||
work_branch.CreateBranch()
|
||||
chrome_version_atom = MarkChromeEBuildAsStable(
|
||||
stable_candidate, unstable_ebuild, chrome_rev, version_to_uprev,
|
||||
commit_to_use, overlay_dir, sticky_ebuild)
|
||||
# Explicit print to communicate to caller.
|
||||
if chrome_version_atom:
|
||||
print 'CHROME_VERSION_ATOM=%s' % chrome_version_atom
|
||||
try:
|
||||
chrome_version_atom = MarkChromeEBuildAsStable(
|
||||
stable_candidate, unstable_ebuild, chrome_rev, version_to_uprev,
|
||||
commit_to_use, overlay_dir, sticky_ebuild)
|
||||
# Explicit print to communicate to caller.
|
||||
if chrome_version_atom:
|
||||
print 'CHROME_VERSION_ATOM=%s' % chrome_version_atom
|
||||
else:
|
||||
work_branch.Delete()
|
||||
except:
|
||||
work_branch.Delete()
|
||||
raise
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@ -166,15 +166,10 @@ def _BuildEBuildDictionary(overlays, all, packages):
|
||||
overlays[overlay].append(ebuild)
|
||||
|
||||
|
||||
def _DoWeHaveLocalCommits(stable_branch, tracking_branch):
|
||||
"""Returns true if there are local commits."""
|
||||
def _CheckOnStabilizingBranch(stable_branch):
|
||||
"""Returns true if the git branch is on the stabilizing branch."""
|
||||
current_branch = _SimpleRunCommand('git branch | grep \*').split()[1]
|
||||
if current_branch == stable_branch:
|
||||
current_commit_id = _SimpleRunCommand('git rev-parse HEAD')
|
||||
tracking_commit_id = _SimpleRunCommand('git rev-parse %s' % tracking_branch)
|
||||
return current_commit_id != tracking_commit_id
|
||||
else:
|
||||
return False
|
||||
return current_branch == stable_branch
|
||||
|
||||
|
||||
def _CheckSaneArguments(package_list, command):
|
||||
@ -228,10 +223,7 @@ def Clean(tracking_branch):
|
||||
tracking_branch: The tracking branch we want to return to after the call.
|
||||
"""
|
||||
_SimpleRunCommand('git reset HEAD --hard')
|
||||
branch = GitBranch(STABLE_BRANCH_NAME, tracking_branch)
|
||||
if branch.Exists():
|
||||
GitBranch.Checkout(branch)
|
||||
branch.Delete()
|
||||
_SimpleRunCommand('git checkout %s' % tracking_branch)
|
||||
|
||||
|
||||
def PushChange(stable_branch, tracking_branch):
|
||||
@ -249,8 +241,8 @@ def PushChange(stable_branch, tracking_branch):
|
||||
num_retries = 5
|
||||
|
||||
# Sanity check to make sure we're on a stabilizing branch before pushing.
|
||||
if not _DoWeHaveLocalCommits(stable_branch, tracking_branch):
|
||||
Info('Not work found to push. Exiting')
|
||||
if not _CheckOnStabilizingBranch(stable_branch):
|
||||
Info('Not on branch %s so no work found to push. Exiting' % stable_branch)
|
||||
return
|
||||
|
||||
description = _SimpleRunCommand('git log --format=format:%s%n%n%b ' +
|
||||
@ -282,7 +274,6 @@ def PushChange(stable_branch, tracking_branch):
|
||||
raise
|
||||
|
||||
|
||||
|
||||
class GitBranch(object):
|
||||
"""Wrapper class for a git branch."""
|
||||
|
||||
@ -292,16 +283,17 @@ class GitBranch(object):
|
||||
self.tracking_branch = tracking_branch
|
||||
|
||||
def CreateBranch(self):
|
||||
GitBranch.Checkout(self)
|
||||
"""Creates a new git branch or replaces an existing one."""
|
||||
if self.Exists():
|
||||
self.Delete()
|
||||
self._Checkout(self.branch_name)
|
||||
|
||||
@classmethod
|
||||
def Checkout(cls, target):
|
||||
"""Function used to check out to another GitBranch."""
|
||||
if target.branch_name == target.tracking_branch or target.Exists():
|
||||
git_cmd = 'git checkout %s' % target.branch_name
|
||||
def _Checkout(self, target, create=True):
|
||||
"""Function used internally to create and move between branches."""
|
||||
if create:
|
||||
git_cmd = 'git checkout -b %s %s' % (target, self.tracking_branch)
|
||||
else:
|
||||
git_cmd = 'git checkout -b %s %s' % (target.branch_name,
|
||||
target.tracking_branch)
|
||||
git_cmd = 'git checkout %s' % target
|
||||
_SimpleRunCommand(git_cmd)
|
||||
|
||||
def Exists(self):
|
||||
@ -315,8 +307,7 @@ class GitBranch(object):
|
||||
|
||||
Returns True on success.
|
||||
"""
|
||||
tracking_branch = GitBranch(self.tracking_branch, self.tracking_branch)
|
||||
GitBranch.Checkout(tracking_branch)
|
||||
self._Checkout(self.tracking_branch, create=False)
|
||||
delete_cmd = 'git branch -D %s' % self.branch_name
|
||||
_SimpleRunCommand(delete_cmd)
|
||||
|
||||
@ -579,11 +570,14 @@ def main(argv):
|
||||
'and reset the git repo yourself.' % overlay)
|
||||
raise
|
||||
|
||||
_CleanStalePackages(gflags.FLAGS.board, new_package_atoms)
|
||||
if gflags.FLAGS.drop_file:
|
||||
fh = open(gflags.FLAGS.drop_file, 'w')
|
||||
fh.write(' '.join(revved_packages))
|
||||
fh.close()
|
||||
if revved_packages:
|
||||
_CleanStalePackages(gflags.FLAGS.board, new_package_atoms)
|
||||
if gflags.FLAGS.drop_file:
|
||||
fh = open(gflags.FLAGS.drop_file, 'w')
|
||||
fh.write(' '.join(revved_packages))
|
||||
fh.close()
|
||||
else:
|
||||
work_branch.Delete()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@ -24,12 +24,11 @@ class NonClassTests(mox.MoxTestBase):
|
||||
def testPushChange(self):
|
||||
git_log = 'Marking test_one as stable\nMarking test_two as stable\n'
|
||||
fake_description = 'Marking set of ebuilds as stable\n\n%s' % git_log
|
||||
self.mox.StubOutWithMock(cros_mark_as_stable, '_DoWeHaveLocalCommits')
|
||||
self.mox.StubOutWithMock(cros_mark_as_stable, '_CheckOnStabilizingBranch')
|
||||
self.mox.StubOutWithMock(cros_mark_as_stable.GitBranch, 'CreateBranch')
|
||||
self.mox.StubOutWithMock(cros_mark_as_stable.GitBranch, 'Exists')
|
||||
|
||||
cros_mark_as_stable._DoWeHaveLocalCommits(
|
||||
self._branch, self._tracking_branch).AndReturn(True)
|
||||
cros_mark_as_stable._CheckOnStabilizingBranch(self._branch).AndReturn(True)
|
||||
cros_mark_as_stable.GitBranch.CreateBranch()
|
||||
cros_mark_as_stable.GitBranch.Exists().AndReturn(True)
|
||||
cros_mark_as_stable._SimpleRunCommand('git log --format=format:%s%n%n%b ' +
|
||||
@ -52,46 +51,66 @@ class GitBranchTest(mox.MoxTestBase):
|
||||
mox.MoxTestBase.setUp(self)
|
||||
# Always stub RunCommmand out as we use it in every method.
|
||||
self.mox.StubOutWithMock(cros_mark_as_stable, '_SimpleRunCommand')
|
||||
self._branch = self.mox.CreateMock(cros_mark_as_stable.GitBranch)
|
||||
self._branch_name = 'test_branch'
|
||||
self._branch.branch_name = self._branch_name
|
||||
self._branch = 'test_branch'
|
||||
self._tracking_branch = 'cros/test'
|
||||
self._branch.tracking_branch = self._tracking_branch
|
||||
|
||||
def testCreateBranchNoPrevious(self):
|
||||
# Test init with no previous branch existing.
|
||||
branch = cros_mark_as_stable.GitBranch(self._branch, self._tracking_branch)
|
||||
self.mox.StubOutWithMock(branch, 'Exists')
|
||||
self.mox.StubOutWithMock(branch, '_Checkout')
|
||||
branch.Exists().AndReturn(False)
|
||||
branch._Checkout(self._branch)
|
||||
self.mox.ReplayAll()
|
||||
branch.CreateBranch()
|
||||
self.mox.VerifyAll()
|
||||
|
||||
def testCreateBranchWithPrevious(self):
|
||||
# Test init with previous branch existing.
|
||||
branch = cros_mark_as_stable.GitBranch(self._branch, self._tracking_branch)
|
||||
self.mox.StubOutWithMock(branch, 'Exists')
|
||||
self.mox.StubOutWithMock(branch, 'Delete')
|
||||
self.mox.StubOutWithMock(branch, '_Checkout')
|
||||
branch.Exists().AndReturn(True)
|
||||
branch.Delete()
|
||||
branch._Checkout(self._branch)
|
||||
self.mox.ReplayAll()
|
||||
branch.CreateBranch()
|
||||
self.mox.VerifyAll()
|
||||
|
||||
def testCheckoutCreate(self):
|
||||
# Test init with no previous branch existing.
|
||||
self._branch.Exists().AndReturn(False)
|
||||
cros_mark_as_stable._SimpleRunCommand(
|
||||
'git checkout -b %s %s' % (self._branch_name, self._tracking_branch))
|
||||
'git checkout -b %s %s' % (self._branch, self._tracking_branch))
|
||||
self.mox.ReplayAll()
|
||||
cros_mark_as_stable.GitBranch.Checkout(self._branch)
|
||||
branch = cros_mark_as_stable.GitBranch(self._branch, self._tracking_branch)
|
||||
branch._Checkout(self._branch)
|
||||
self.mox.VerifyAll()
|
||||
|
||||
def testCheckoutNoCreate(self):
|
||||
# Test init with previous branch existing.
|
||||
self._branch.Exists().AndReturn(True)
|
||||
cros_mark_as_stable._SimpleRunCommand('git checkout %s' % (
|
||||
self._branch_name))
|
||||
self._tracking_branch))
|
||||
self.mox.ReplayAll()
|
||||
cros_mark_as_stable.GitBranch.Checkout(self._branch)
|
||||
branch = cros_mark_as_stable.GitBranch(self._branch, self._tracking_branch)
|
||||
branch._Checkout(self._tracking_branch, False)
|
||||
self.mox.VerifyAll()
|
||||
|
||||
def testDelete(self):
|
||||
self.mox.StubOutWithMock(cros_mark_as_stable.GitBranch, 'Checkout')
|
||||
branch = cros_mark_as_stable.GitBranch(self._branch_name,
|
||||
self._tracking_branch)
|
||||
cros_mark_as_stable.GitBranch.Checkout(mox.IgnoreArg())
|
||||
cros_mark_as_stable._SimpleRunCommand('git branch -D ' + self._branch_name)
|
||||
branch = cros_mark_as_stable.GitBranch(self._branch, self._tracking_branch)
|
||||
self.mox.StubOutWithMock(branch, '_Checkout')
|
||||
branch._Checkout(self._tracking_branch, create=False)
|
||||
cros_mark_as_stable._SimpleRunCommand('git branch -D ' + self._branch)
|
||||
self.mox.ReplayAll()
|
||||
branch.Delete()
|
||||
self.mox.VerifyAll()
|
||||
|
||||
def testExists(self):
|
||||
branch = cros_mark_as_stable.GitBranch(self._branch_name,
|
||||
self._tracking_branch)
|
||||
branch = cros_mark_as_stable.GitBranch(self._branch, self._tracking_branch)
|
||||
|
||||
# Test if branch exists that is created
|
||||
cros_mark_as_stable._SimpleRunCommand('git branch').AndReturn(
|
||||
'%s' % self._branch_name)
|
||||
'%s %s' % (self._branch, self._tracking_branch))
|
||||
self.mox.ReplayAll()
|
||||
self.assertTrue(branch.Exists())
|
||||
self.mox.VerifyAll()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user