Esempio n. 1
0
def main(action, patch_name=None):
    if action == "help" or action == "-h" or action == "--help":
        print_help()
        return 0

    builder = buildlib.get_builder()

    def _run_quilt(*args):
        return builder._run_subprocess([builder.quilt_command, *args],
                                      append_environ=builder.quilt_env_vars,
                                      cwd=str(builder._sandbox_dir))

    if action == "recreate":
        if (builder.build_dir / buildlib.common.PATCHES).exists():
            #builder.logger.warning("Sandbox patches directory already exists. Trying to unapply...")
            #result = _run_quilt("pop", "-a")
            #print(result)
            #if not result.returncode == 0 and not result.returncode == 2:
            #    return 1
            shutil.rmtree(str(builder.build_dir / buildlib.common.PATCHES))
        builder.apply_patches()
        return 0

    if action == "top":
        result = _run_quilt("top")
    elif action == "pushall":
        result = _run_quilt("push", "-a")
    elif action == "popall":
        result = _run_quilt("pop" , "-a")
    elif action == "pushto":
        if patch_name is None:
            builder.logger.error("Patch name must be defined")
            return 1
        result = _run_quilt("push", patch_name)
    elif action == "popto":
        if patch_name is None:
            builder.logger.error("Patch name must be defined")
            return 1
        result = _run_quilt("pop", patch_name)
    else:
        builder.logger.error("Unknown command")
        print_help()
        return 1

    print(result)
    if not result.returncode == 0:
        return 1

    return 0
Esempio n. 2
0
def main():
    try:
        builder = buildlib.get_builder()
        # Modify builder's attributes as necessary. See the Builder class for options
        builder.check_build_environment()
        builder.setup_chromium_source()
        builder.setup_build_sandbox()
        builder.apply_patches()
        builder.setup_build_utilities()
        builder.generate_build_configuration()
        builder.build()
        builder.generate_package()
    except buildlib.BuilderException as exc:
        try:
            builder.logger.error(str(exc))
        except AttributeError:  # Failed before object instantiation
            import sys
            print("ERROR: {!s}".format(exc), file=sys.stderr)
        return 1
    finally:
        logging.shutdown()

    return 0
Esempio n. 3
0
def main():
    builder = buildlib.get_builder()
    builder.run_source_cleaner = False
    logger = builder.logger
    builder.check_build_environment()
    logger.info("Setting up Chromium source in build sandbox...")
    builder.setup_chromium_source()

    logger.info("Generating cleaning list...")
    cleaning_list = generate_cleaning_list(
        builder._sandbox_dir,
        (buildlib._COMMON_RESOURCES / buildlib._CLEANING_LIST))

    logger.info("Removing files in cleaning list...")
    for i in cleaning_list:
        if (builder._sandbox_dir / pathlib.Path(i)).exists():
            (builder._sandbox_dir / pathlib.Path(i)).unlink()
        else:
            logger.error("File does not exist: {}".format(str(i)))

    logger.info("Generating domain substitution list...")
    generate_domain_substitution_list(
        builder._sandbox_dir,
        (buildlib._COMMON_RESOURCES / buildlib._DOMAIN_SUBSTITUTION_LIST),
        (buildlib._COMMON_RESOURCES / buildlib._DOMAIN_REGEX_LIST)
    )  # TODO: Autogenerate platform domain substutition list when platforms have their own domain substitutions

    logger.info("Running domain substitution...")
    builder.setup_build_sandbox()

    logger.info("Applying patches...")
    builder.apply_patches()

    logger.info("Patches applied cleanly!")

    return 0
Esempio n. 4
0
def main():
    try:
        builder = buildlib.get_builder()
        # Modify builder's attributes as necessary. See the Builder class for options
        builder.setup_environment_overrides()
        builder.check_build_environment()
        builder.setup_chromium_source()
        builder.setup_build_sandbox()
        builder.apply_patches()
        builder.setup_build_utilities()
        builder.generate_build_configuration()
        builder.build()
        builder.generate_package()
    except buildlib.BuilderException as exc:
        try:
            builder.logger.error(str(exc))
        except AttributeError: # Failed before object instantiation
            import sys
            print("ERROR: {!s}".format(exc), file=sys.stderr)
        return 1
    finally:
        logging.shutdown()

    return 0