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

Side by Side Diff: cros_mark_as_stable.py

Issue 4697007: Revert "Add more error checking to preflight queue." (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « bin/cbuildbot_unittest.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """This module uprevs a given package's ebuild to the next revision.""" 7 """This module uprevs a given package's ebuild to the next revision."""
8 8
9 9
10 import fileinput 10 import fileinput
11 import gflags 11 import gflags
12 import os 12 import os
13 import re 13 import re
14 import shutil 14 import shutil
15 import subprocess 15 import subprocess
16 import sys 16 import sys
17 17
18 sys.path.append(os.path.join(os.path.dirname(__file__), 'lib')) 18 sys.path.append(os.path.join(os.path.dirname(__file__), 'lib'))
19 from cros_build_lib import Info, RunCommand, Warning, Die 19 from cros_build_lib import Info, RunCommand, Warning, Die
20 20
21 21
22 gflags.DEFINE_string('board', '', 22 gflags.DEFINE_string('board', '',
23 'Board for which the package belongs.', short_name='b') 23 'Board for which the package belongs.', short_name='b')
24 gflags.DEFINE_string('overlays', '', 24 gflags.DEFINE_string('overlays', '',
25 'Colon-separated list of overlays to modify.', 25 'Space separated list of overlays to modify.',
26 short_name='o') 26 short_name='o')
27 gflags.DEFINE_string('packages', '', 27 gflags.DEFINE_string('packages', '',
28 'Colon-separated list of packages to mark as stable.', 28 'Space separated list of packages to mark as stable.',
29 short_name='p') 29 short_name='p')
30 gflags.DEFINE_string('push_options', '', 30 gflags.DEFINE_string('push_options', '',
31 'Options to use with git-cl push using push command.') 31 'Options to use with git-cl push using push command.')
32 gflags.DEFINE_string('srcroot', '%s/trunk/src' % os.environ['HOME'], 32 gflags.DEFINE_string('srcroot', '%s/trunk/src' % os.environ['HOME'],
33 'Path to root src directory.', 33 'Path to root src directory.',
34 short_name='r') 34 short_name='r')
35 gflags.DEFINE_string('tracking_branch', 'cros/master', 35 gflags.DEFINE_string('tracking_branch', 'cros/master',
36 'Used with commit to specify branch to track against.', 36 'Used with commit to specify branch to track against.',
37 short_name='t') 37 short_name='t')
38 gflags.DEFINE_boolean('all', False, 38 gflags.DEFINE_boolean('all', False,
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 _SimpleRunCommand('git commit -m "%s"' % description) 238 _SimpleRunCommand('git commit -m "%s"' % description)
239 # Ugh. There has got to be an easier way to push to a tracking branch 239 # Ugh. There has got to be an easier way to push to a tracking branch
240 _SimpleRunCommand('git config push.default tracking') 240 _SimpleRunCommand('git config push.default tracking')
241 _SimpleRunCommand('git push') 241 _SimpleRunCommand('git push')
242 242
243 243
244 def _SimpleRunCommand(command): 244 def _SimpleRunCommand(command):
245 """Runs a shell command and returns stdout back to caller.""" 245 """Runs a shell command and returns stdout back to caller."""
246 _Print(' + %s' % command) 246 _Print(' + %s' % command)
247 proc_handle = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True) 247 proc_handle = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
248 stdout = proc_handle.communicate()[0] 248 return proc_handle.communicate()[0]
249 retcode = proc_handle.wait()
250 assert retcode == 0, "Return code %s for command: %s" % (retcode, command)
251 return stdout
252 249
253 250
254 # ======================= End Global Helper Functions ======================== 251 # ======================= End Global Helper Functions ========================
255 252
256 253
257 class _GitBranch(object): 254 class _GitBranch(object):
258 """Wrapper class for a git branch.""" 255 """Wrapper class for a git branch."""
259 256
260 def __init__(self, branch_name): 257 def __init__(self, branch_name):
261 """Sets up variables but does not create the branch.""" 258 """Sets up variables but does not create the branch."""
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 def main(argv): 480 def main(argv):
484 try: 481 try:
485 argv = gflags.FLAGS(argv) 482 argv = gflags.FLAGS(argv)
486 if len(argv) != 2: 483 if len(argv) != 2:
487 _PrintUsageAndDie('Must specify a valid command') 484 _PrintUsageAndDie('Must specify a valid command')
488 else: 485 else:
489 command = argv[1] 486 command = argv[1]
490 except gflags.FlagsError, e : 487 except gflags.FlagsError, e :
491 _PrintUsageAndDie(str(e)) 488 _PrintUsageAndDie(str(e))
492 489
493 package_list = gflags.FLAGS.packages.split(':') 490 package_list = gflags.FLAGS.packages.split()
494 _CheckSaneArguments(package_list, command) 491 _CheckSaneArguments(package_list, command)
495 if gflags.FLAGS.overlays: 492 if gflags.FLAGS.overlays:
496 overlays = {} 493 overlays = dict((path, []) for path in gflags.FLAGS.overlays.split())
497 for path in gflags.FLAGS.overlays.split(':'):
498 if not os.path.exists(path):
499 Die('Cannot find overlay: %s' % path)
500 overlays[path] = []
501 else: 494 else:
502 Warning('Missing --overlays argument')
503 overlays = { 495 overlays = {
504 '%s/private-overlays/chromeos-overlay' % gflags.FLAGS.srcroot: [], 496 '%s/private-overlays/chromeos-overlay' % gflags.FLAGS.srcroot: [],
505 '%s/third_party/chromiumos-overlay' % gflags.FLAGS.srcroot: [] 497 '%s/third_party/chromiumos-overlay' % gflags.FLAGS.srcroot: []
506 } 498 }
507 499
508 if command == 'commit': 500 if command == 'commit':
509 _BuildEBuildDictionary(overlays, gflags.FLAGS.all, package_list) 501 _BuildEBuildDictionary(overlays, gflags.FLAGS.all, package_list)
510 502
511 for overlay, ebuilds in overlays.items(): 503 for overlay, ebuilds in overlays.items():
512 if not os.path.exists(overlay): 504 if not os.path.exists(overlay):
(...skipping 30 matching lines...) Expand all
543 raise 535 raise
544 536
545 if revved_packages: 537 if revved_packages:
546 _CleanStalePackages(gflags.FLAGS.board, revved_packages) 538 _CleanStalePackages(gflags.FLAGS.board, revved_packages)
547 else: 539 else:
548 work_branch.Delete() 540 work_branch.Delete()
549 541
550 542
551 if __name__ == '__main__': 543 if __name__ == '__main__':
552 main(sys.argv) 544 main(sys.argv)
OLDNEW
« no previous file with comments | « bin/cbuildbot_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698