()
| 451 | |
| 452 | |
| 453 | def main(): |
| 454 | os.chdir(BESS_DIR) |
| 455 | parser = argparse.ArgumentParser(description='Build BESS') |
| 456 | cmds = { |
| 457 | 'all': build_all, |
| 458 | 'download_dpdk': download_dpdk, |
| 459 | 'dpdk': build_dpdk, |
| 460 | 'bess': build_bess, |
| 461 | 'kmod': build_kmod, |
| 462 | 'clean': do_clean, |
| 463 | 'dist_clean': do_dist_clean, |
| 464 | 'help': lambda: print_usage(parser), |
| 465 | 'protobuf': generate_protobuf_files, |
| 466 | 'show_plugins': show_plugins, |
| 467 | } |
| 468 | # if foo_bar is a command allow foo-bar too |
| 469 | for name in list(cmds.keys()): |
| 470 | if '_' in name: |
| 471 | cmds[name.replace('_', '-')] = cmds[name] |
| 472 | cmdlist = sorted(cmds.keys()) |
| 473 | parser.add_argument( |
| 474 | 'action', |
| 475 | metavar='action', |
| 476 | nargs='?', |
| 477 | default='all', |
| 478 | choices=cmdlist, |
| 479 | help='Action is one of ' + ', '.join(cmdlist)) |
| 480 | parser.add_argument( |
| 481 | '--plugin', |
| 482 | action='append', |
| 483 | help='add a plugin source directory') |
| 484 | parser.add_argument( |
| 485 | '--reset-plugins', |
| 486 | action='store_true', |
| 487 | help='clear out existing plugin settings') |
| 488 | # Note: unlike plugins, --with-benchmark must be specified each time |
| 489 | # you build bess. |
| 490 | parser.add_argument( |
| 491 | '--with-benchmark', |
| 492 | dest='benchmark_path', |
| 493 | nargs=1, |
| 494 | help='Location of benchmark library') |
| 495 | parser.add_argument('-v', '--verbose', action='store_true', |
| 496 | help='enable verbose builds (same as env V=1)') |
| 497 | args = parser.parse_args() |
| 498 | |
| 499 | newplugins = [] if args.reset_plugins else find_current_plugins() |
| 500 | if args.plugin: |
| 501 | newplugins.extend(args.plugin) |
| 502 | # Convert to absolute path, de-duplicate, and set plugins. |
| 503 | plugins.extend(dedup(os.path.abspath(i) for i in newplugins)) |
| 504 | |
| 505 | if args.verbose: |
| 506 | os.environ['V'] = '1' |
| 507 | |
| 508 | if args.benchmark_path: |
| 509 | update_benchmark_path(args.benchmark_path[0]) |
| 510 |
no test coverage detected