def main(): """CLI Entrypoint""" parser = argparse.ArgumentParser() add_common_params(parser) parser.set_defaults(callback=_callback) subparsers = parser.add_subparsers(title='', dest='packaging') # apply apply_parser = subparsers.add_parser( 'apply', help='Apply domain substitution', description= 'Applies domain substitution and creates the domain substitution cache.' ) apply_parser.add_argument('-r', '--regex', type=Path, required=True, help='Path to domain_regex.list') apply_parser.add_argument('-f', '--files', type=Path, required=True, help='Path to domain_substitution.list') apply_parser.add_argument( '-c', '--cache', type=Path, required=True, help= 'The path to the domain substitution cache. The path must not already exist.' ) apply_parser.add_argument( 'directory', type=Path, help='The directory to apply domain substitution') apply_parser.set_defaults(reverting=False) # revert revert_parser = subparsers.add_parser( 'revert', help='Revert domain substitution', description= 'Reverts domain substitution based only on the domain substitution cache.' ) revert_parser.add_argument( 'directory', type=Path, help='The directory to reverse domain substitution') revert_parser.add_argument( '-c', '--cache', type=Path, required=True, help=('The path to the domain substitution cache. ' 'The path must exist and will be removed if successful.')) revert_parser.set_defaults(reverting=True) args = parser.parse_args() args.callback(args)
def main(): """CLI Entrypoint""" parser = argparse.ArgumentParser() parser.add_argument( '-c', '--cfg', metavar='PATH', type=Path, required=True, help=('The FILES.cfg to use. They are usually located under a ' 'directory in chrome/tools/build/ of the source tree.')) parser.add_argument( '--build-outputs', metavar='PATH', type=Path, default='out/Default', help=('The path to the build outputs directory relative to the ' 'source tree. Default: %(default)s')) parser.add_argument( '--cpu-arch', metavar='ARCH', default=platform.architecture()[0], choices=('64bit', '32bit'), help=('Filter build outputs by a target CPU. ' 'This is the same as the "arch" key in FILES.cfg. ' 'Default (from platform.architecture()): %(default)s')) add_common_params(parser) subparsers = parser.add_subparsers(title='filescfg actions') # list list_parser = subparsers.add_parser('list', help=_list_callback.__doc__) list_parser.set_defaults(callback=_list_callback) # archive archive_parser = subparsers.add_parser('archive', help=_archive_callback.__doc__) archive_parser.add_argument( '-o', '--output', type=Path, metavar='PATH', required=True, help=('The output path for the archive. The type of archive is selected' ' by the file extension. Currently supported types: .zip and' ' .tar.{gz,bz2,xz}')) archive_parser.add_argument( '-i', '--include', type=Path, metavar='PATH', action='append', default=list(), help=('File or directory to include in the root of the archive. Specify ' 'multiple times to include multiple different items. ' 'For zip files, these contents must only be regular files.')) archive_parser.set_defaults(callback=_archive_callback) args = parser.parse_args() args.callback(args)
def main(): """CLI Entrypoint""" parser = argparse.ArgumentParser() add_common_params(parser) subparsers = parser.add_subparsers(title='Download actions', dest='action') # retrieve retrieve_parser = subparsers.add_parser( 'retrieve', help='Retrieve and check download files', description='Retrieves and checks downloads without unpacking.') _add_common_args(retrieve_parser) retrieve_parser.add_argument('--hide-progress-bar', action='store_false', dest='show_progress', help='Hide the download progress.') retrieve_parser.add_argument( '--disable-ssl-verification', action='store_true', help='Disables certification verification for downloads using HTTPS.') retrieve_parser.set_defaults(callback=_retrieve_callback) # unpack unpack_parser = subparsers.add_parser( 'unpack', help='Unpack download files', description= 'Verifies hashes of and unpacks download files into the specified directory.' ) _add_common_args(unpack_parser) unpack_parser.add_argument( '--tar-path', default='tar', help=('(Linux and macOS only) Command or path to the BSD or GNU tar ' 'binary for extraction. Default: %(default)s')) unpack_parser.add_argument( '--7z-path', dest='sevenz_path', default=USE_REGISTRY, help= ('Command or path to 7-Zip\'s "7z" binary. If "_use_registry" is ' 'specified, determine the path from the registry. Default: %(default)s' )) unpack_parser.add_argument( '--winrar-path', dest='winrar_path', default=USE_REGISTRY, help= ('Command or path to WinRAR\'s "winrar" binary. If "_use_registry" is ' 'specified, determine the path from the registry. Default: %(default)s' )) unpack_parser.add_argument('output', type=Path, help='The directory to unpack to.') unpack_parser.set_defaults(callback=_unpack_callback) args = parser.parse_args() args.callback(args)
def main(): """CLI Entrypoint""" parser = argparse.ArgumentParser() parser.add_argument('directory', type=Path, help='The directory to apply binary pruning.') parser.add_argument('pruning_list', type=Path, help='Path to pruning.list') add_common_params(parser) parser.set_defaults(callback=_callback) args = parser.parse_args() args.callback(args)
def main(): """CLI Entrypoint""" parser = argparse.ArgumentParser() parser.add_argument('src', type=Path, help='Chromium source directory.') parser.add_argument('version_file', type=Path, help='File containing Breeze version') add_common_params(parser) parser.set_defaults(callback=_callback) args = parser.parse_args() args.callback(args)
def main(): """CLI Entrypoint""" parser = argparse.ArgumentParser() add_common_params(parser) subparsers = parser.add_subparsers() apply_parser = subparsers.add_parser( 'apply', help= 'Applies patches (in GNU Quilt format) to the specified source tree') apply_parser.add_argument( '--patch-bin', help='The GNU patch command to use. Omit to find it automatically.') apply_parser.add_argument('target', type=Path, help='The directory tree to apply patches onto.') apply_parser.add_argument( 'patches', type=Path, nargs='+', help= 'The directories containing patches to apply. They must be in GNU quilt format' ) apply_parser.set_defaults(callback=_apply_callback) merge_parser = subparsers.add_parser( 'merge', help='Merges patches directories in GNU quilt format') merge_parser.add_argument( '--prepend', '-p', action='store_true', help=( 'If "destination" exists, prepend patches from sources into it.' ' By default, merging will fail if the destination already exists.' )) merge_parser.add_argument( 'destination', type=Path, help=('The directory to write the merged patches to. ' 'The destination must not exist unless --prepend is specified.')) merge_parser.add_argument('source', type=Path, nargs='+', help='The GNU quilt patches to merge.') merge_parser.set_defaults(callback=_merge_callback) args = parser.parse_args() if 'callback' not in args: parser.error('Must specify subcommand apply or merge') args.callback(args, parser.error)
def main(): """CLI Entrypoint""" parser = argparse.ArgumentParser(description=__doc__) parser.add_argument( '-s', '--series', type=Path, metavar='FILE', default=str(Path('patches', 'series')), help='The series file listing patches to apply. Default: %(default)s') parser.add_argument( '-p', '--patches', type=Path, metavar='DIRECTORY', default='patches', help='The patches directory to read from. Default: %(default)s') add_common_params(parser) file_source_group = parser.add_mutually_exclusive_group(required=True) file_source_group.add_argument( '-l', '--local', type=Path, metavar='DIRECTORY', help= 'Use a local source tree. It must be UNMODIFIED, otherwise the results will not be valid.' ) file_source_group.add_argument( '-r', '--remote', action='store_true', help= ('Download the required source tree files from Google. ' 'This feature requires the Python module "requests". If you do not want to ' 'install this, consider using --local instead.')) file_source_group.add_argument( '-c', '--cache-remote', type=Path, metavar='DIRECTORY', help= '(For debugging) Store the required remote files in an empty local directory' ) args = parser.parse_args() if args.cache_remote and not args.cache_remote.exists(): if args.cache_remote.parent.exists(): args.cache_remote.mkdir() else: parser.error('Parent of cache path {} does not exist'.format( args.cache_remote)) if not args.series.is_file(): parser.error('--series path is not a file or not found: {}'.format( args.series)) if not args.patches.is_dir(): parser.error( '--patches path is not a directory or not found: {}'.format( args.patches)) series_iterable = tuple(parse_series(args.series)) had_failure, patch_cache = _load_all_patches(series_iterable, args.patches) required_files = _get_required_files(patch_cache) files_under_test = _get_files_under_test(args, required_files, parser) had_failure |= _test_patches(series_iterable, patch_cache, files_under_test) if had_failure: get_logger().error('***FAILED VALIDATION; SEE ABOVE***') if not args.verbose: get_logger().info( '(For more error details, re-run with the "-v" flag)') parser.exit(status=1) else: get_logger().info('Passed validation (%d patches total)', len(series_iterable))