Esempio n. 1
0
def main() -> None:
    args = parse_args()
    init_env(verbose=args.verbose)
    if args.update:
        updater = MetadataUpdater(
            github_token_file_path=args.github_token_file,
            tag_filter_regex_str=args.tag_filter_regex)
        updater.update_archive_metadata_file()
        return

    metadata = load_metadata()
    manual_metadata = load_manual_metadata()
    if args.get_sha1:
        print(metadata[SHA_FOR_LOCAL_CHECKOUT_KEY])
        return

    metadata_items = [
        MetadataItem(item_json_data)
        for item_json_data in metadata['archives'] + (manual_metadata['archives'] or [])
    ]

    if args.list_compilers:
        compiler_list = get_compilers(
            metadata_items=metadata_items,
            os_type=args.os_type,
            architecture=args.architecture)
        for compiler in compiler_list:
            print(compiler)
        return

    if args.save_thirdparty_url_to_file or args.save_llvm_url_to_file:
        if not args.compiler_type:
            raise ValueError("Compiler type not specified")
        thirdparty_release: Optional[MetadataItem] = get_third_party_release(
            available_archives=metadata_items,
            compiler_type=args.compiler_type,
            os_type=args.os_type,
            architecture=args.architecture,
            is_linuxbrew=args.is_linuxbrew,
            lto=args.lto)
        if thirdparty_release is None:
            raise RuntimeError("Could not determine third-party archive download URL")
        thirdparty_url = thirdparty_release.url()
        logging.info(f"Download URL for the third-party dependencies: {thirdparty_url}")
        if args.save_thirdparty_url_to_file:
            make_parent_dir(args.save_thirdparty_url_to_file)
            write_file(thirdparty_url, args.save_thirdparty_url_to_file)
        if (args.save_llvm_url_to_file and
                thirdparty_release.compiler_type.startswith('clang') and
                thirdparty_release.is_linuxbrew):
            llvm_url = get_llvm_url(thirdparty_release.compiler_type)
            if llvm_url is not None:
                logging.info(f"Download URL for the LLVM toolchain: {llvm_url}")
                make_parent_dir(args.save_llvm_url_to_file)
                write_file(llvm_url, args.save_llvm_url_to_file)
            else:
                logging.info("Could not determine LLVM URL for compiler type %s" %
                             thirdparty_release.compiler_type)
        else:
            logging.info("Not a Linuxbrew URL, not saving LLVM URL to file")
Esempio n. 2
0
 def write_link_cmd_file(self, out_path: str) -> None:
     logging.info(
         "Writing the linker command line (one argument per line) to %s",
         os.path.abspath(out_path))
     write_file('\n'.join(self.new_args.args), out_path)