cmdline.py 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #
  2. # Copyright (c) 2014 Google, Inc
  3. #
  4. # SPDX-License-Identifier: GPL-2.0+
  5. #
  6. from optparse import OptionParser
  7. def ParseArgs():
  8. """Parse command line arguments from sys.argv[]
  9. Returns:
  10. tuple containing:
  11. options: command line options
  12. args: command lin arguments
  13. """
  14. parser = OptionParser()
  15. parser.add_option('-b', '--branch', type='string',
  16. help='Branch name to build')
  17. parser.add_option('-B', '--bloat', dest='show_bloat',
  18. action='store_true', default=False,
  19. help='Show changes in function code size for each board')
  20. parser.add_option('-c', '--count', dest='count', type='int',
  21. default=-1, help='Run build on the top n commits')
  22. parser.add_option('-C', '--force-reconfig', dest='force_reconfig',
  23. action='store_true', default=False,
  24. help='Reconfigure for every commit (disable incremental build)')
  25. parser.add_option('-d', '--detail', dest='show_detail',
  26. action='store_true', default=False,
  27. help='Show detailed information for each board in summary')
  28. parser.add_option('-e', '--show_errors', action='store_true',
  29. default=False, help='Show errors and warnings')
  30. parser.add_option('-f', '--force-build', dest='force_build',
  31. action='store_true', default=False,
  32. help='Force build of boards even if already built')
  33. parser.add_option('-F', '--force-build-failures', dest='force_build_failures',
  34. action='store_true', default=False,
  35. help='Force build of previously-failed build')
  36. parser.add_option('-g', '--git', type='string',
  37. help='Git repo containing branch to build', default='.')
  38. parser.add_option('-G', '--config-file', type='string',
  39. help='Path to buildman config file', default='')
  40. parser.add_option('-H', '--full-help', action='store_true', dest='full_help',
  41. default=False, help='Display the README file')
  42. parser.add_option('-i', '--in-tree', dest='in_tree',
  43. action='store_true', default=False,
  44. help='Build in the source tree instead of a separate directory')
  45. parser.add_option('-j', '--jobs', dest='jobs', type='int',
  46. default=None, help='Number of jobs to run at once (passed to make)')
  47. parser.add_option('-k', '--keep-outputs', action='store_true',
  48. default=False, help='Keep all build output files (e.g. binaries)')
  49. parser.add_option('-l', '--list-error-boards', action='store_true',
  50. default=False, help='Show a list of boards next to each error/warning')
  51. parser.add_option('--list-tool-chains', action='store_true', default=False,
  52. help='List available tool chains')
  53. parser.add_option('-n', '--dry-run', action='store_true', dest='dry_run',
  54. default=False, help="Do a try run (describe actions, but no nothing)")
  55. parser.add_option('-o', '--output-dir', type='string',
  56. dest='output_dir', default='..',
  57. help='Directory where all builds happen and buildman has its workspace (default is ../)')
  58. parser.add_option('-Q', '--quick', action='store_true',
  59. default=False, help='Do a rough build, with limited warning resolution')
  60. parser.add_option('-s', '--summary', action='store_true',
  61. default=False, help='Show a build summary')
  62. parser.add_option('-S', '--show-sizes', action='store_true',
  63. default=False, help='Show image size variation in summary')
  64. parser.add_option('--step', type='int',
  65. default=1, help='Only build every n commits (0=just first and last)')
  66. parser.add_option('-t', '--test', action='store_true', dest='test',
  67. default=False, help='run tests')
  68. parser.add_option('-T', '--threads', type='int',
  69. default=None, help='Number of builder threads to use')
  70. parser.add_option('-u', '--show_unknown', action='store_true',
  71. default=False, help='Show boards with unknown build result')
  72. parser.add_option('-v', '--verbose', action='store_true',
  73. default=False, help='Show build results while the build progresses')
  74. parser.add_option('-x', '--exclude', dest='exclude',
  75. type='string', action='append',
  76. help='Specify a list of boards to exclude, separated by comma')
  77. parser.usage += """
  78. Build U-Boot for all commits in a branch. Use -n to do a dry run"""
  79. return parser.parse_args()