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

Side by Side Diff: cros_mark_as_stable.py

Issue 5154008: Add ability to rev and build a chrome from cbuildbot (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Stuffs 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
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 12 matching lines...) Expand all
23 gflags.DEFINE_string('board', '', 23 gflags.DEFINE_string('board', '',
24 'Board for which the package belongs.', short_name='b') 24 'Board for which the package belongs.', short_name='b')
25 gflags.DEFINE_boolean('dryrun', False, 25 gflags.DEFINE_boolean('dryrun', False,
26 'Passes dry-run to git push if pushing a change.') 26 'Passes dry-run to git push if pushing a change.')
27 gflags.DEFINE_string('overlays', '', 27 gflags.DEFINE_string('overlays', '',
28 'Colon-separated list of overlays to modify.', 28 'Colon-separated list of overlays to modify.',
29 short_name='o') 29 short_name='o')
30 gflags.DEFINE_string('packages', '', 30 gflags.DEFINE_string('packages', '',
31 'Colon-separated list of packages to mark as stable.', 31 'Colon-separated list of packages to mark as stable.',
32 short_name='p') 32 short_name='p')
33 gflags.DEFINE_string('push_options', '',
34 'Options to use with git-cl push using push command.')
35 gflags.DEFINE_string('srcroot', '%s/trunk/src' % os.environ['HOME'], 33 gflags.DEFINE_string('srcroot', '%s/trunk/src' % os.environ['HOME'],
36 'Path to root src directory.', 34 'Path to root src directory.',
37 short_name='r') 35 short_name='r')
38 gflags.DEFINE_string('tracking_branch', 'cros/master', 36 gflags.DEFINE_string('tracking_branch', 'cros/master',
39 'Used with commit to specify branch to track against.', 37 'Used with commit to specify branch to track against.',
40 short_name='t') 38 short_name='t')
41 gflags.DEFINE_boolean('verbose', False, 39 gflags.DEFINE_boolean('verbose', False,
42 'Prints out verbose information about what is going on.', 40 'Prints out verbose information about what is going on.',
43 short_name='v') 41 short_name='v')
44 42
45 43
46 # Takes two strings, package_name and commit_id. 44 # Takes two strings, package_name and commit_id.
47 _GIT_COMMIT_MESSAGE = 'Marking 9999 ebuild for %s with commit %s as stable.' 45 _GIT_COMMIT_MESSAGE = 'Marking 9999 ebuild for %s with commit %s as stable.'
48 46
49 # Dictionary of valid commands with usage information. 47 # Dictionary of valid commands with usage information.
50 COMMAND_DICTIONARY = { 48 COMMAND_DICTIONARY = {
51 'clean': 49 'clean':
52 'Cleans up previous calls to either commit or push', 50 'Cleans up previous calls to either commit or push',
53 'commit': 51 'commit':
54 'Marks given ebuilds as stable locally', 52 'Marks given ebuilds as stable locally',
55 'push': 53 'push':
56 'Pushes previous marking of ebuilds to remote repo', 54 'Pushes previous marking of ebuilds to remote repo',
57 } 55 }
58 56
59 # Name used for stabilizing branch. 57 # Name used for stabilizing branch.
60 _STABLE_BRANCH_NAME = 'stabilizing_branch' 58 STABLE_BRANCH_NAME = 'stabilizing_branch'
61 59
62 60
63 def BestEBuild(ebuilds): 61 def BestEBuild(ebuilds):
64 """Returns the newest EBuild from a list of EBuild objects.""" 62 """Returns the newest EBuild from a list of EBuild objects."""
65 from portage.versions import vercmp 63 from portage.versions import vercmp
66 winner = ebuilds[0] 64 winner = ebuilds[0]
67 for ebuild in ebuilds[1:]: 65 for ebuild in ebuilds[1:]:
68 if vercmp(winner.version, ebuild.version) < 0: 66 if vercmp(winner.version, ebuild.version) < 0:
69 winner = ebuild 67 winner = ebuild
70 return winner 68 return winner
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 continue 533 continue
536 534
537 # TODO(davidjames): Currently, all code that interacts with git depends on 535 # TODO(davidjames): Currently, all code that interacts with git depends on
538 # the cwd being set to the overlay directory. We should instead pass in 536 # the cwd being set to the overlay directory. We should instead pass in
539 # this parameter so that we don't need to modify the cwd globally. 537 # this parameter so that we don't need to modify the cwd globally.
540 os.chdir(overlay) 538 os.chdir(overlay)
541 539
542 if command == 'clean': 540 if command == 'clean':
543 Clean(gflags.FLAGS.tracking_branch) 541 Clean(gflags.FLAGS.tracking_branch)
544 elif command == 'push': 542 elif command == 'push':
545 PushChange(_STABLE_BRANCH_NAME, gflags.FLAGS.tracking_branch) 543 PushChange(STABLE_BRANCH_NAME, gflags.FLAGS.tracking_branch)
546 elif command == 'commit' and ebuilds: 544 elif command == 'commit' and ebuilds:
547 work_branch = GitBranch(_STABLE_BRANCH_NAME, gflags.FLAGS.tracking_branch) 545 work_branch = GitBranch(STABLE_BRANCH_NAME, gflags.FLAGS.tracking_branch)
548 work_branch.CreateBranch() 546 work_branch.CreateBranch()
549 if not work_branch.Exists(): 547 if not work_branch.Exists():
550 Die('Unable to create stabilizing branch in %s' % overlay) 548 Die('Unable to create stabilizing branch in %s' % overlay)
551 549
552 # Contains the array of packages we actually revved. 550 # Contains the array of packages we actually revved.
553 revved_packages = [] 551 revved_packages = []
554 for ebuild in ebuilds: 552 for ebuild in ebuilds:
555 try: 553 try:
556 _Print('Working on %s' % ebuild.package) 554 _Print('Working on %s' % ebuild.package)
557 worker = EBuildStableMarker(ebuild) 555 worker = EBuildStableMarker(ebuild)
(...skipping 10 matching lines...) Expand all
568 raise 566 raise
569 567
570 if revved_packages: 568 if revved_packages:
571 _CleanStalePackages(gflags.FLAGS.board, revved_packages) 569 _CleanStalePackages(gflags.FLAGS.board, revved_packages)
572 else: 570 else:
573 work_branch.Delete() 571 work_branch.Delete()
574 572
575 573
576 if __name__ == '__main__': 574 if __name__ == '__main__':
577 main(sys.argv) 575 main(sys.argv)
OLDNEW
« bin/cros_mark_chrome_as_stable.py ('K') | « bin/cros_mark_chrome_as_stable.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698