distro: refactor BinaryPackage, Repo and Distro into generics for Local and Remote

This commit is contained in:
InsanePrawn 2022-09-01 03:57:54 +02:00
parent dbe3dc91a3
commit bf420a73be
5 changed files with 109 additions and 41 deletions

View file

@ -9,6 +9,7 @@ from config import config
from constants import Arch, ARCHES, REPOSITORIES
from exec.file import remove_file
from distro.distro import get_kupfer_local
from distro.package import LocalPackage
from ssh import run_ssh_command, scp_put_files
from utils import git
from wrapper import check_programs_wrap, enforce_wrap
@ -85,11 +86,8 @@ def cmd_sideload(paths: Iterable[str], arch: Optional[Arch] = None, no_build: bo
arch = arch or get_profile_device(hint_or_set_arch=True).arch
if not no_build:
build(paths, False, arch=arch, try_download=True)
files = [
pkg.resolved_url.split('file://')[1]
for pkg in get_kupfer_local(arch=arch, scan=True, in_chroot=False).get_packages().values()
if pkg.resolved_url and pkg.name in paths
]
repo: dict[str, LocalPackage] = get_kupfer_local(arch=arch, scan=True, in_chroot=False).get_packages()
files = [pkg.resolved_url.split('file://')[1] for pkg in repo.values() if pkg.resolved_url and pkg.name in paths]
logging.debug(f"Sideload: Found package files: {files}")
if not files:
logging.fatal("No packages matched")