def main():
    # Setup environment
    source_tree.mkdir(parents=True, exist_ok=True)
    downloads_cache.mkdir(parents=True, exist_ok=True)
    _make_tmp_paths()

    series_files_list = [
        _ROOT_DIR / 'core' / 'patches', _ROOT_DIR / 'patches',
        _ROOT_DIR / 'core' / 'patches' / 'core' / 'breeze'
    ]
    patches.combine_patches(series_files_list, temp_patches)
    var_replace.main()
    if saved_patches.exists():
        patches.compare_new_patches(saved_patches,
                                    temp_patches,
                                    source_tree,
                                    patch_bin_path=(source_tree /
                                                    _PATCH_BIN_RELPATH))
    else:
        print('No previous patches found\n')
        print('Applying all!\n')
        patch_made_files_remover.main()
        _copy_files("build/unpatched")
        save_original_files.main()
        # apply patches
        patches.apply_patches(
            patches.generate_patches_from_series(temp_patches, resolve=True),
            source_tree,
            patch_bin_path=(source_tree / _PATCH_BIN_RELPATH))

    _copy_files(src=temp_patches, dst=saved_patches)
    shutil.rmtree(temp_patches)
    set_version.update_version(source_tree, core_dir / 'breeze_version.txt')
Example #2
0
def write_prep(file, ruby_pattern=False):
    file.write_strip("%prep")
    for archive in sources["archive"]:
        file.write_strip("tar -xf %{{SOURCE{}}}".format(source_index[archive]))
    if sources["archive"]:
        file.write_strip("cd ..")
    if ruby_pattern:
        file.write_strip("gem unpack %{SOURCE0}")
        file.write_strip("%setup -q -D -T -n " + tarball.tarball_prefix)
        file.write_strip("gem spec %{SOURCE0} -l --ruby > " + tarball.name + ".gemspec")
    else:
        if default_pattern == 'R':
            file.write_strip("%setup -q -c -n " + tarball.tarball_prefix)
        else:
            file.write_strip("%setup -q -n " + tarball.tarball_prefix)

    for archive in sources["archive"]:
        file.write_strip('mkdir -p %{{_topdir}}/BUILD/{0}/{1}'
                         .format(tarball.tarball_prefix,
                                 archive_details[archive + "destination"]))
        file.write_strip('mv %{{_topdir}}/BUILD/{0}/* %{{_topdir}}/BUILD/{1}/{2}'
                         .format(archive_details[archive + "prefix"],
                                 tarball.tarball_prefix,
                                 archive_details[archive + "destination"]))
    patches.apply_patches(file)
    if config.config_opts['32bit']:
        file.write_strip("pushd ..")
        file.write_strip("cp -a " +  tarball.tarball_prefix + " build32")
        file.write_strip("popd")
    file.write_strip("\n")
    write_prep_append(file)
Example #3
0
def write_prep(file, ruby_pattern=False):
    file.write_strip("%prep")
    for archive in sources["archive"]:
        file.write_strip("tar -xf %{{SOURCE{}}}".format(source_index[archive]))
        file.write_strip("cd ..")
    if ruby_pattern:
        file.write_strip("gem unpack %{SOURCE0}")
        file.write_strip("%setup -q -D -T -n " + tarball.tarball_prefix)
        file.write_strip("gem spec %{SOURCE0} -l --ruby > " + tarball.name + ".gemspec")
    else:
        if default_pattern == 'R':
            file.write_strip("%setup -q -c -n " + tarball.tarball_prefix)
        else:
            file.write_strip("%setup -q -n " + tarball.tarball_prefix)
    for archive in sources["archive"]:
        file.write_strip('mv %{{_topdir}}/BUILD/{0}/* ./{1}'
                         .format(archive_details[archive + "prefix"],
                                 archive_details[archive + "destination"]))
    patches.apply_patches(file)
    file.write_strip("\n")
def main():
    """CLI Entrypoint"""
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument(
        '--disable-ssl-verification',
        action='store_true',
        help='Disables SSL verification for downloading')
    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'))
    parser.add_argument(
        '--winrar-path',
        dest='winrar_path',
        default=USE_REGISTRY,
        help=('Command or path to WinRAR\'s "winrar.exe" binary. If "_use_registry" is '
              'specified, determine the path from the registry. Default: %(default)s'))
    args = parser.parse_args()

    # Set common variables
    source_tree = _ROOT_DIR / 'build' / 'src'
    downloads_cache = _ROOT_DIR / 'build' / 'downloads_cache'
    domsubcache = _ROOT_DIR / 'build' / 'domsubcache.tar.gz'

    # Setup environment
    source_tree.mkdir(parents=True, exist_ok=True)
    downloads_cache.mkdir(parents=True, exist_ok=True)
    _make_tmp_paths()

    # Get download metadata (DownloadInfo)
    download_info = downloads.DownloadInfo([
        _ROOT_DIR / 'downloads.ini',
        _ROOT_DIR / 'ungoogled-chromium' / 'downloads.ini',
    ])

    # Retrieve downloads
    get_logger().info('Downloading required files...')
    downloads.retrieve_downloads(download_info, downloads_cache, True,
                                          args.disable_ssl_verification)
    try:
        downloads.check_downloads(download_info, downloads_cache)
    except downloads.HashMismatchError as exc:
        get_logger().error('File checksum does not match: %s', exc)
        exit(1)

    # Unpack downloads
    extractors = {
        ExtractorEnum.SEVENZIP: args.sevenz_path,
        ExtractorEnum.WINRAR: args.winrar_path,
    }
    get_logger().info('Unpacking downloads...')
    downloads.unpack_downloads(download_info, downloads_cache, source_tree, extractors)

    # Prune binaries
    unremovable_files = prune_binaries.prune_dir(
        source_tree,
        (_ROOT_DIR / 'ungoogled-chromium' / 'pruning.list').read_text(encoding=ENCODING).splitlines()
    )
    if unremovable_files:
        get_logger().error('Files could not be pruned: %s', unremovable_files)
        parser.exit(1)

    # Apply patches
    # First, ungoogled-chromium-patches
    patches.apply_patches(
        patches.generate_patches_from_series(_ROOT_DIR / 'ungoogled-chromium' / 'patches', resolve=True),
        source_tree,
        patch_bin_path=(source_tree / _PATCH_BIN_RELPATH)
    )
    # Then Windows-specific patches
    patches.apply_patches(
        patches.generate_patches_from_series(_ROOT_DIR / 'patches', resolve=True),
        source_tree,
        patch_bin_path=(source_tree / _PATCH_BIN_RELPATH)
    )

    # Substitute domains
    domain_substitution.apply_substitution(
        _ROOT_DIR / 'ungoogled-chromium' / 'domain_regex.list',
        _ROOT_DIR / 'ungoogled-chromium' / 'domain_substitution.list',
        source_tree,
        domsubcache
    )

    # Output args.gn
    (source_tree / 'out/Default').mkdir(parents=True)
    gn_flags = (_ROOT_DIR / 'ungoogled-chromium' / 'flags.gn').read_text(encoding=ENCODING)
    gn_flags += '\n'
    gn_flags += (_ROOT_DIR / 'flags.windows.gn').read_text(encoding=ENCODING)
    (source_tree / 'out/Default/args.gn').write_text(gn_flags, encoding=ENCODING)

    # Enter source tree to run build commands
    os.chdir(source_tree)

    # Run GN bootstrap
    _run_build_process(
        sys.executable, 'tools\\gn\\bootstrap\\bootstrap.py', '-o', 'out\\Default\\gn.exe',
        '--skip-generate-buildfiles')

    # Run gn gen
    _run_build_process('out\\Default\\gn.exe', 'gen', 'out\\Default', '--fail-on-unused-args')

    # Run ninja
    _run_build_process('third_party\\ninja\\ninja.exe', '-C', 'out\\Default', 'chrome',
                       'chromedriver', 'mini_installer')
Example #5
0
import MembershipTool
from Products.CMFCore import utils
from ilo.customizations.config import PROJECTNAME
from Products.CMFCore.DirectoryView import registerDirectory
from AccessControl import AuthEncoding
import patches


GLOBALS = globals()
registerDirectory('skins', GLOBALS)

tools = (MembershipTool.MembershipTool,)

patches.apply_patches()


def initialize(context):
    """Initializer called when used as a Zope 2 product."""
    
    utils.ToolInit(PROJECTNAME + ' Tool',
             tools=tools,
             product_name=PROJECTNAME,
             icon="tool.gif",
             ).initialize(context)


Example #6
0
from p4a.z2utils import indexing

import patches
patches.apply_patches()