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

Side by Side Diff: annotated_gclient.py

Issue 78843007: Send build revision as json object. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 7 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
« 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/env python 1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Wraps gclient calls with annotated output. 6 """Wraps gclient calls with annotated output.
7 7
8 Note that you will have to use -- to stop option parsing for gclient flags. 8 Note that you will have to use -- to stop option parsing for gclient flags.
9 9
10 To run `gclient sync --gclientfile=.gclient` and annotate got_v8_revision: 10 To run `gclient sync --gclientfile=.gclient` and annotate got_v8_revision:
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 path = path.rstrip('/') 44 path = path.rstrip('/')
45 if path in revision_mapping: 45 if path in revision_mapping:
46 propname = revision_mapping[path] 46 propname = revision_mapping[path]
47 result[propname] = info['revision'] 47 result[propname] = info['revision']
48 48
49 return result 49 return result
50 50
51 51
52 def emit_buildprops(got_revisions): 52 def emit_buildprops(got_revisions):
53 for prop, revision in got_revisions.iteritems(): 53 for prop, revision in got_revisions.iteritems():
54 print '@@@SET_BUILD_PROPERTY@%s@%s@@@' % (prop, revision) 54 print '@@@SET_BUILD_PROPERTY@%s@%s@@@' % (prop, json.dumps(revision))
55 55
56 56
57 def main(): 57 def main():
58 parser = optparse.OptionParser( 58 parser = optparse.OptionParser(
59 description=('Runs gclient and annotates the output with any ' 59 description=('Runs gclient and annotates the output with any '
60 'got_revisions.')) 60 'got_revisions.'))
61 parser.add_option('--revision-mapping', default='{}', 61 parser.add_option('--revision-mapping', default='{}',
62 help='json dict of directory-to-property mappings.') 62 help='json dict of directory-to-property mappings.')
63 parser.add_option('--suffix', default='gclient', 63 parser.add_option('--suffix', default='gclient',
64 help='tempfile suffix') 64 help='tempfile suffix')
(...skipping 15 matching lines...) Expand all
80 p.wait() 80 p.wait()
81 81
82 if p.returncode == 0: 82 if p.returncode == 0:
83 revisions = parse_got_revision(f, revision_mapping) 83 revisions = parse_got_revision(f, revision_mapping)
84 emit_buildprops(revisions) 84 emit_buildprops(revisions)
85 return p.returncode 85 return p.returncode
86 86
87 87
88 if __name__ == '__main__': 88 if __name__ == '__main__':
89 sys.exit(main()) 89 sys.exit(main())
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