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

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