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

Side by Side Diff: cros_mark_as_stable.py

Issue 2819052: Return error when error occurs by raising exception (Closed) Base URL: ssh://git@chromiumos-git//crosutils.git
Patch Set: Created 10 years, 5 months 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
« no previous file with comments | « no previous file | 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
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 def main(argv): 308 def main(argv):
309 try: 309 try:
310 argv = gflags.FLAGS(argv) 310 argv = gflags.FLAGS(argv)
311 if len(argv) != 2: 311 if len(argv) != 2:
312 _PrintUsageAndDie('Must specify a valid command') 312 _PrintUsageAndDie('Must specify a valid command')
313 else: 313 else:
314 command = argv[1] 314 command = argv[1]
315 except gflags.FlagsError, e : 315 except gflags.FlagsError, e :
316 _PrintUsageAndDie(str(e)) 316 _PrintUsageAndDie(str(e))
317 317
318 package_list = gflags.FLAGS.packages.split(' ') 318 package_list = gflags.FLAGS.packages.split()
319 if gflags.FLAGS.commit_ids: 319 if gflags.FLAGS.commit_ids:
320 commit_id_list = gflags.FLAGS.commit_ids.split(' ') 320 commit_id_list = gflags.FLAGS.commit_ids.split()
321 else: 321 else:
322 commit_id_list = None 322 commit_id_list = None
323 _CheckSaneArguments(package_list, commit_id_list, command) 323 _CheckSaneArguments(package_list, commit_id_list, command)
324 324
325 os.chdir(_CHROMIUMOS_OVERLAYS_DIRECTORY) 325 os.chdir(_CHROMIUMOS_OVERLAYS_DIRECTORY)
326 326
327 if command == 'clean': 327 if command == 'clean':
328 _Clean() 328 _Clean()
329 elif command == 'commit': 329 elif command == 'commit':
330 work_branch = _GitBranch(_STABLE_BRANCH_NAME) 330 work_branch = _GitBranch(_STABLE_BRANCH_NAME)
331 work_branch.CreateBranch() 331 work_branch.CreateBranch()
332 if not work_branch.Exists(): 332 if not work_branch.Exists():
333 generate_test_report.Die('Unable to create stabilizing branch in %s' % 333 generate_test_report.Die('Unable to create stabilizing branch in %s' %
334 _CHROMIUMOS_OVERLAYS_DIRECTORY) 334 _CHROMIUMOS_OVERLAYS_DIRECTORY)
335 index = 0 335 index = 0
336 try: 336 try:
337 for index in range(len(package_list)): 337 for index in range(len(package_list)):
338 # Gather the package and optional commit id to work on. 338 # Gather the package and optional commit id to work on.
339 package = package_list[index] 339 package = package_list[index]
340 commit_id = "" 340 commit_id = ""
341 if commit_id_list: 341 if commit_id_list:
342 commit_id = commit_id_list[index] 342 commit_id = commit_id_list[index]
343 343
344 _Print('Working on %s' % package) 344 _Print('Working on %s' % package)
345 worker = EBuildStableMarker(_EBuild(package, commit_id)) 345 worker = EBuildStableMarker(_EBuild(package, commit_id))
346 worker.RevEBuild(commit_id) 346 worker.RevEBuild(commit_id)
347 worker.CommitChange(_GIT_COMMIT_MESSAGE % (package, commit_id)) 347 worker.CommitChange(_GIT_COMMIT_MESSAGE % (package, commit_id))
348 348
349 except (OSError, IOError), e: 349 except (OSError, IOError), e:
350 print ('An exception occurred %s\n' 350 print ('An exception occurred\n'
351 'Only the following packages were revved: %s\n' 351 'Only the following packages were revved: %s\n'
352 'Note you will have to go into %s' 352 'Note you will have to go into %s'
353 'and reset the git repo yourself.' % 353 'and reset the git repo yourself.' %
354 (e, package_list[:index], _CHROMIUMOS_OVERLAYS_DIRECTORY)) 354 (package_list[:index], _CHROMIUMOS_OVERLAYS_DIRECTORY))
355 raise e
355 elif command == 'push': 356 elif command == 'push':
356 _PushChange() 357 _PushChange()
357 358
358 359
359 if __name__ == '__main__': 360 if __name__ == '__main__':
360 main(sys.argv) 361 main(sys.argv)
361 362
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698