packages: finish pkg downloads: add --no-download flag, wire it up

This commit is contained in:
InsanePrawn 2022-08-08 16:49:03 +02:00
parent 07c8e178fb
commit 657ada4c73

View file

@ -623,12 +623,20 @@ def build_packages(
arch: Arch, arch: Arch,
force: bool = False, force: bool = False,
rebuild_dependants: bool = False, rebuild_dependants: bool = False,
try_download: bool = False,
enable_crosscompile: bool = True, enable_crosscompile: bool = True,
enable_crossdirect: bool = True, enable_crossdirect: bool = True,
enable_ccache: bool = True, enable_ccache: bool = True,
clean_chroot: bool = False, clean_chroot: bool = False,
): ):
build_levels = get_unbuilt_package_levels(repo, packages, arch, force=force, rebuild_dependants=rebuild_dependants) build_levels = get_unbuilt_package_levels(
repo,
packages,
arch,
force=force,
rebuild_dependants=rebuild_dependants,
try_download=try_download,
)
if not build_levels: if not build_levels:
logging.info('Everything built already') logging.info('Everything built already')
@ -656,6 +664,7 @@ def build_packages_by_paths(
repo: dict[str, Pkgbuild], repo: dict[str, Pkgbuild],
force=False, force=False,
rebuild_dependants: bool = False, rebuild_dependants: bool = False,
try_download: bool = False,
enable_crosscompile: bool = True, enable_crosscompile: bool = True,
enable_crossdirect: bool = True, enable_crossdirect: bool = True,
enable_ccache: bool = True, enable_ccache: bool = True,
@ -673,6 +682,7 @@ def build_packages_by_paths(
arch, arch,
force=force, force=force,
rebuild_dependants=rebuild_dependants, rebuild_dependants=rebuild_dependants,
try_download=try_download,
enable_crosscompile=enable_crosscompile, enable_crosscompile=enable_crosscompile,
enable_crossdirect=enable_crossdirect, enable_crossdirect=enable_crossdirect,
enable_ccache=enable_ccache, enable_ccache=enable_ccache,
@ -720,8 +730,9 @@ def cmd_update(non_interactive: bool = False):
@click.option('--force', is_flag=True, default=False, help='Rebuild even if package is already built') @click.option('--force', is_flag=True, default=False, help='Rebuild even if package is already built')
@click.option('--arch', default=None, help="The CPU architecture to build for") @click.option('--arch', default=None, help="The CPU architecture to build for")
@click.option('--rebuild-dependants', is_flag=True, default=False, help='Rebuild packages that depend on packages that will be [re]built') @click.option('--rebuild-dependants', is_flag=True, default=False, help='Rebuild packages that depend on packages that will be [re]built')
@click.option('--no-download', is_flag=True, default=False, help="Don't try downloading packages from online repos before building")
@click.argument('paths', nargs=-1) @click.argument('paths', nargs=-1)
def cmd_build(paths: list[str], force=False, arch=None, rebuild_dependants: bool = False): def cmd_build(paths: list[str], force=False, arch=None, rebuild_dependants: bool = False, no_download: bool = False):
""" """
Build packages by paths. Build packages by paths.
@ -729,10 +740,16 @@ def cmd_build(paths: list[str], force=False, arch=None, rebuild_dependants: bool
Multiple paths may be specified as separate arguments. Multiple paths may be specified as separate arguments.
""" """
build(paths, force, arch, rebuild_dependants) build(paths, force, arch, rebuild_dependants, not no_download)
def build(paths: Iterable[str], force: bool, arch: Optional[Arch], rebuild_dependants: bool = False): def build(
paths: Iterable[str],
force: bool,
arch: Optional[Arch],
rebuild_dependants: bool = False,
try_download: bool = False,
):
# TODO: arch = config.get_profile()... # TODO: arch = config.get_profile()...
arch = arch or 'aarch64' arch = arch or 'aarch64'
@ -750,6 +767,7 @@ def build(paths: Iterable[str], force: bool, arch: Optional[Arch], rebuild_depen
repo, repo,
force=force, force=force,
rebuild_dependants=rebuild_dependants, rebuild_dependants=rebuild_dependants,
try_download=try_download,
enable_crosscompile=config.file['build']['crosscompile'], enable_crosscompile=config.file['build']['crosscompile'],
enable_crossdirect=config.file['build']['crossdirect'], enable_crossdirect=config.file['build']['crossdirect'],
enable_ccache=config.file['build']['ccache'], enable_ccache=config.file['build']['ccache'],