From 6b6f35ec65c19f3288d621a8ed95f0e9b083c52b Mon Sep 17 00:00:00 2001 From: Chris Sosa Date: Fri, 22 Oct 2010 16:14:36 -0700 Subject: [PATCH] Always pass board to cros_mark_as_stable. Change-Id: I9a724e4e20b8945fdaa1dc53afdddf2477a5bbab BUG= TEST=Ran unit tests. Review URL: http://codereview.chromium.org/3956007 --- bin/cbuildbot.py | 24 ++++++++++++++---------- cros_mark_as_stable.py | 2 +- cros_mark_as_stable_unittest.py | 9 ++++++--- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/bin/cbuildbot.py b/bin/cbuildbot.py index dabb723cfd..26659ea497 100755 --- a/bin/cbuildbot.py +++ b/bin/cbuildbot.py @@ -177,7 +177,7 @@ def _ParseRevisionString(revision_string, repo_dictionary): return revisions.items() -def _UprevFromRevisionList(buildroot, tracking_branch, revision_list): +def _UprevFromRevisionList(buildroot, tracking_branch, revision_list, board): """Uprevs based on revision list.""" if not revision_list: Info('No packages found to uprev') @@ -191,16 +191,18 @@ def _UprevFromRevisionList(buildroot, tracking_branch, revision_list): cwd = os.path.join(buildroot, 'src', 'scripts') RunCommand(['./cros_mark_as_stable', + '--board=%s' % board, '--tracking_branch="%s"' % tracking_branch, '--packages="%s"' % package_str, 'commit'], cwd=cwd, enter_chroot=True) -def _UprevAllPackages(buildroot, tracking_branch): +def _UprevAllPackages(buildroot, tracking_branch, board): """Uprevs all packages that have been updated since last uprev.""" cwd = os.path.join(buildroot, 'src', 'scripts') RunCommand(['./cros_mark_as_stable', '--all', + '--board=%s' % board, '--tracking_branch="%s"' % tracking_branch, 'commit'], cwd=cwd, enter_chroot=True) @@ -218,11 +220,12 @@ def _GetVMConstants(buildroot): return (vdisk_size.strip(), statefulfs_size.strip()) -def _GitCleanup(buildroot): +def _GitCleanup(buildroot, board): """Clean up git branch after previous uprev attempt.""" cwd = os.path.join(buildroot, 'src', 'scripts') if os.path.exists(cwd): RunCommand(['./cros_mark_as_stable', '--srcroot=..', + '--board=%s' % board, '--tracking_branch="cros/master"', 'clean'], cwd=cwd, error_ok=True) @@ -246,9 +249,9 @@ def _WipeOldOutput(buildroot): # =========================== Main Commands =================================== -def _PreFlightRinse(buildroot): +def _PreFlightRinse(buildroot, board): """Cleans up any leftover state from previous runs.""" - _GitCleanup(buildroot) + _GitCleanup(buildroot, board) _CleanUpMountPoints(buildroot) RunCommand(['sudo', 'killall', 'kvm'], error_ok=True) @@ -359,16 +362,17 @@ def _UprevPackages(buildroot, tracking_branch, revisionfile, board): # print >> sys.stderr, 'CBUILDBOT Revision list found %s' % revisions # revision_list = _ParseRevisionString(revisions, # _CreateRepoDictionary(buildroot, board)) - # _UprevFromRevisionList(buildroot, tracking_branch, revision_list) + # _UprevFromRevisionList(buildroot, tracking_branch, revision_list, board) #else: Info('CBUILDBOT Revving all') - _UprevAllPackages(buildroot, tracking_branch) + _UprevAllPackages(buildroot, tracking_branch, board) -def _UprevPush(buildroot, tracking_branch): +def _UprevPush(buildroot, tracking_branch, board): """Pushes uprev changes to the main line.""" cwd = os.path.join(buildroot, 'src', 'scripts') RunCommand(['./cros_mark_as_stable', '--srcroot=..', + '--board=%s' % board, '--tracking_branch="%s"' % tracking_branch, '--push_options="--bypass-hooks -f"', 'push'], cwd=cwd) @@ -432,7 +436,7 @@ def main(): sys.exit(1) try: - _PreFlightRinse(buildroot) + _PreFlightRinse(buildroot, buildconfig['board']) if options.clobber or not os.path.isdir(buildroot): _FullCheckout(buildroot, tracking_branch, url=options.url) else: @@ -467,7 +471,7 @@ def main(): if buildconfig['master']: # Master bot needs to check if the other slaves completed. if cbuildbot_comm.HaveSlavesCompleted(config): - _UprevPush(buildroot, tracking_branch) + _UprevPush(buildroot, tracking_branch, buildconfig['board']) else: Die('CBUILDBOT - One of the slaves has failed!!!') diff --git a/cros_mark_as_stable.py b/cros_mark_as_stable.py index 84fa16ec33..3df9181744 100755 --- a/cros_mark_as_stable.py +++ b/cros_mark_as_stable.py @@ -19,7 +19,7 @@ sys.path.append(os.path.join(os.path.dirname(__file__), 'lib')) from cros_build_lib import Info, RunCommand, Warning, Die -gflags.DEFINE_string('board', 'x86-generic', +gflags.DEFINE_string('board', '', 'Board for which the package belongs.', short_name='b') gflags.DEFINE_string('packages', '', 'Space separated list of packages to mark as stable.', diff --git a/cros_mark_as_stable_unittest.py b/cros_mark_as_stable_unittest.py index 99b41f3a23..73985ae4d2 100755 --- a/cros_mark_as_stable_unittest.py +++ b/cros_mark_as_stable_unittest.py @@ -169,7 +169,8 @@ class EBuildStableMarkerTest(mox.MoxTestBase): diff_cmd = ['diff', '-Bu', self.m_ebuild.ebuild_path, self.revved_ebuild_path] cros_mark_as_stable.RunCommand(diff_cmd, exit_code=True, - print_cmd=False).AndReturn(1) + print_cmd=False, redirect_stderr=True, + redirect_stdout=True).AndReturn(1) cros_mark_as_stable._SimpleRunCommand('git add ' + self.revved_ebuild_path) cros_mark_as_stable._SimpleRunCommand('git rm ' + self.m_ebuild.ebuild_path) @@ -201,7 +202,8 @@ class EBuildStableMarkerTest(mox.MoxTestBase): diff_cmd = ['diff', '-Bu', self.m_ebuild.ebuild_path, self.revved_ebuild_path] cros_mark_as_stable.RunCommand(diff_cmd, exit_code=True, - print_cmd=False).AndReturn(0) + print_cmd=False, redirect_stderr=True, + redirect_stdout=True).AndReturn(0) cros_mark_as_stable.os.unlink(self.revved_ebuild_path) self.mox.ReplayAll() @@ -234,7 +236,8 @@ class EBuildStableMarkerTest(mox.MoxTestBase): diff_cmd = ['diff', '-Bu', self.m_ebuild.ebuild_path, self.revved_ebuild_path] cros_mark_as_stable.RunCommand(diff_cmd, exit_code=True, - print_cmd=False).AndReturn(1) + print_cmd=False, redirect_stderr=True, + redirect_stdout=True).AndReturn(1) cros_mark_as_stable._SimpleRunCommand('git add ' + self.revved_ebuild_path) cros_mark_as_stable._SimpleRunCommand('git rm ' + self.m_ebuild.ebuild_path)