Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1316)

Unified Diff: cros_mark_as_stable.py

Issue 4442001: Add more error checking to preflight queue. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git
Patch Set: Address comments. Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cros_mark_as_stable.py
diff --git a/cros_mark_as_stable.py b/cros_mark_as_stable.py
index 56a589c68214d2485ea7ec123a02e382a4ecfce0..c142790680012d3ba32e4ddec32dd84b30a9129f 100755
--- a/cros_mark_as_stable.py
+++ b/cros_mark_as_stable.py
@@ -22,10 +22,10 @@ from cros_build_lib import Info, RunCommand, Warning, Die
gflags.DEFINE_string('board', '',
'Board for which the package belongs.', short_name='b')
gflags.DEFINE_string('overlays', '',
- 'Space separated list of overlays to modify.',
+ 'Colon-separated list of overlays to modify.',
short_name='o')
gflags.DEFINE_string('packages', '',
- 'Space separated list of packages to mark as stable.',
+ 'Colon-separated list of packages to mark as stable.',
short_name='p')
gflags.DEFINE_string('push_options', '',
'Options to use with git-cl push using push command.')
@@ -85,7 +85,7 @@ def _CleanStalePackages(board, package_array):
def _BestEBuild(ebuilds):
"""Returns the newest EBuild from a list of EBuild objects."""
- from portage.versions import vercmp
+ from cros_portage_versions import vercmp
winner = ebuilds[0]
for ebuild in ebuilds[1:]:
if vercmp(winner.version, ebuild.version) < 0:
@@ -245,7 +245,11 @@ def _SimpleRunCommand(command):
"""Runs a shell command and returns stdout back to caller."""
_Print(' + %s' % command)
proc_handle = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
- return proc_handle.communicate()[0]
+ stdout = proc_handle.communicate()[0]
+ retcode = proc_handle.wait()
+ if retcode != 0:
+ raise subprocess.CalledProcessError(retcode, command, output=stdout)
+ return stdout
# ======================= End Global Helper Functions ========================
@@ -297,7 +301,7 @@ class _EBuild(object):
Uses equery to find the ebuild path and sets data about an ebuild for
easy reference.
"""
- from portage.versions import pkgsplit
+ from cros_portage_versions import pkgsplit
self.ebuild_path = path
(self.ebuild_path_no_revision,
self.ebuild_path_no_version,
@@ -323,7 +327,7 @@ class _EBuild(object):
# Grab and evaluate CROS_WORKON variables from this ebuild.
unstable_ebuild = '%s-9999.ebuild' % self.ebuild_path_no_version
- cmd = ('CROS_WORKON_LOCALNAME="%s" CROS_WORKON_PROJECT="%s" '
+ cmd = ('export CROS_WORKON_LOCALNAME="%s" CROS_WORKON_PROJECT="%s"; '
'eval $(grep -E "^CROS_WORKON" %s) && '
'echo $CROS_WORKON_PROJECT '
'$CROS_WORKON_LOCALNAME/$CROS_WORKON_SUBDIR'
@@ -487,11 +491,16 @@ def main(argv):
except gflags.FlagsError, e :
_PrintUsageAndDie(str(e))
- package_list = gflags.FLAGS.packages.split()
+ package_list = gflags.FLAGS.packages.split(':')
_CheckSaneArguments(package_list, command)
if gflags.FLAGS.overlays:
- overlays = dict((path, []) for path in gflags.FLAGS.overlays.split())
+ overlays = {}
+ for path in gflags.FLAGS.overlays.split(':'):
+ if not os.path.exists(path):
sosa 2010/11/12 21:28:40 I guess this should also be isdir
davidjames 2010/11/12 21:37:50 Done.
+ Die('Cannot find overlay: %s' % path)
+ overlays[path] = []
else:
+ Warning('Missing --overlays argument')
overlays = {
'%s/private-overlays/chromeos-overlay' % gflags.FLAGS.srcroot: [],
'%s/third_party/chromiumos-overlay' % gflags.FLAGS.srcroot: []
@@ -504,6 +513,10 @@ def main(argv):
if not os.path.exists(overlay):
Warning("Skipping %s" % overlay)
continue
+
+ # TODO(davidjames): Currently, all code that interacts with git depends on
+ # the cwd being set to the overlay directory. We should instead pass in
+ # this parameter so that we don't need to modify the cwd globally.
os.chdir(overlay)
if command == 'clean':

Powered by Google App Engine
This is Rietveld 408576698