cmdline.py 5.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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, or range of commits 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('--fetch-arch', type='string',
  37. help="Fetch a toolchain for architecture FETCH_ARCH ('list' to list)."
  38. ' You can also fetch several toolchains separate by comma, or'
  39. " 'all' to download all")
  40. parser.add_option('-g', '--git', type='string',
  41. help='Git repo containing branch to build', default='.')
  42. parser.add_option('-G', '--config-file', type='string',
  43. help='Path to buildman config file', default='')
  44. parser.add_option('-H', '--full-help', action='store_true', dest='full_help',
  45. default=False, help='Display the README file')
  46. parser.add_option('-i', '--in-tree', dest='in_tree',
  47. action='store_true', default=False,
  48. help='Build in the source tree instead of a separate directory')
  49. parser.add_option('-j', '--jobs', dest='jobs', type='int',
  50. default=None, help='Number of jobs to run at once (passed to make)')
  51. parser.add_option('-k', '--keep-outputs', action='store_true',
  52. default=False, help='Keep all build output files (e.g. binaries)')
  53. parser.add_option('-K', '--show-config', action='store_true',
  54. default=False, help='Show configuration changes in summary (both board config files and Kconfig)')
  55. parser.add_option('-l', '--list-error-boards', action='store_true',
  56. default=False, help='Show a list of boards next to each error/warning')
  57. parser.add_option('--list-tool-chains', action='store_true', default=False,
  58. help='List available tool chains')
  59. parser.add_option('-n', '--dry-run', action='store_true', dest='dry_run',
  60. default=False, help="Do a dry run (describe actions, but do nothing)")
  61. parser.add_option('-N', '--no-subdirs', action='store_true', dest='no_subdirs',
  62. default=False, help="Don't create subdirectories when building current source for a single board")
  63. parser.add_option('-o', '--output-dir', type='string',
  64. dest='output_dir', default='..',
  65. help='Directory where all builds happen and buildman has its workspace (default is ../)')
  66. parser.add_option('-Q', '--quick', action='store_true',
  67. default=False, help='Do a rough build, with limited warning resolution')
  68. parser.add_option('-p', '--full-path', action='store_true',
  69. default=False, help="Use full toolchain path in CROSS_COMPILE")
  70. parser.add_option('-s', '--summary', action='store_true',
  71. default=False, help='Show a build summary')
  72. parser.add_option('-S', '--show-sizes', action='store_true',
  73. default=False, help='Show image size variation in summary')
  74. parser.add_option('--step', type='int',
  75. default=1, help='Only build every n commits (0=just first and last)')
  76. parser.add_option('-t', '--test', action='store_true', dest='test',
  77. default=False, help='run tests')
  78. parser.add_option('-T', '--threads', type='int',
  79. default=None, help='Number of builder threads to use')
  80. parser.add_option('-u', '--show_unknown', action='store_true',
  81. default=False, help='Show boards with unknown build result')
  82. parser.add_option('-v', '--verbose', action='store_true',
  83. default=False, help='Show build results while the build progresses')
  84. parser.add_option('-V', '--verbose-build', action='store_true',
  85. default=False, help='Run make with V=1, showing all output')
  86. parser.add_option('-x', '--exclude', dest='exclude',
  87. type='string', action='append',
  88. help='Specify a list of boards to exclude, separated by comma')
  89. parser.usage += """
  90. Build U-Boot for all commits in a branch. Use -n to do a dry run"""
  91. return parser.parse_args()