OLD | NEW |
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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 def _CheckSaneArguments(package_list, command): | 167 def _CheckSaneArguments(package_list, command): |
168 """Checks to make sure the flags are sane. Dies if arguments are not sane.""" | 168 """Checks to make sure the flags are sane. Dies if arguments are not sane.""" |
169 if not command in _COMMAND_DICTIONARY.keys(): | 169 if not command in _COMMAND_DICTIONARY.keys(): |
170 _PrintUsageAndDie('%s is not a valid command' % command) | 170 _PrintUsageAndDie('%s is not a valid command' % command) |
171 if not gflags.FLAGS.packages and command == 'commit' and not gflags.FLAGS.all: | 171 if not gflags.FLAGS.packages and command == 'commit' and not gflags.FLAGS.all: |
172 _PrintUsageAndDie('Please specify at least one package') | 172 _PrintUsageAndDie('Please specify at least one package') |
173 if not gflags.FLAGS.board and command == 'commit': | 173 if not gflags.FLAGS.board and command == 'commit': |
174 _PrintUsageAndDie('Please specify a board') | 174 _PrintUsageAndDie('Please specify a board') |
175 if not os.path.isdir(gflags.FLAGS.srcroot): | 175 if not os.path.isdir(gflags.FLAGS.srcroot): |
176 _PrintUsageAndDie('srcroot is not a valid path') | 176 _PrintUsageAndDie('srcroot is not a valid path') |
| 177 gflags.FLAGS.srcroot = os.path.abspath(gflags.FLAGS.srcroot) |
177 | 178 |
178 | 179 |
179 def _Clean(): | 180 def _Clean(): |
180 """Cleans up uncommitted changes on either stabilizing branch or master.""" | 181 """Cleans up uncommitted changes on either stabilizing branch or master.""" |
181 _SimpleRunCommand('git reset HEAD --hard') | 182 _SimpleRunCommand('git reset HEAD --hard') |
182 _SimpleRunCommand('git checkout %s' % gflags.FLAGS.tracking_branch) | 183 _SimpleRunCommand('git checkout %s' % gflags.FLAGS.tracking_branch) |
183 | 184 |
184 | 185 |
185 def _PrintUsageAndDie(error_message=''): | 186 def _PrintUsageAndDie(error_message=''): |
186 """Prints optional error_message the usage and returns an error exit code.""" | 187 """Prints optional error_message the usage and returns an error exit code.""" |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 raise | 521 raise |
521 | 522 |
522 if revved_packages: | 523 if revved_packages: |
523 _CleanStalePackages(gflags.FLAGS.board, revved_packages) | 524 _CleanStalePackages(gflags.FLAGS.board, revved_packages) |
524 else: | 525 else: |
525 work_branch.Delete() | 526 work_branch.Delete() |
526 | 527 |
527 | 528 |
528 if __name__ == '__main__': | 529 if __name__ == '__main__': |
529 main(sys.argv) | 530 main(sys.argv) |
OLD | NEW |