diff --git a/distro/distro.py b/distro/distro.py index 33d4910..da437d1 100644 --- a/distro/distro.py +++ b/distro/distro.py @@ -1,6 +1,6 @@ from typing import Optional, Mapping -from constants import ARCHES, BASE_DISTROS, REPOSITORIES, KUPFER_HTTPS, CHROOT_PATHS +from constants import Arch, ARCHES, BASE_DISTROS, REPOSITORIES, KUPFER_HTTPS, CHROOT_PATHS from generator import generate_pacman_conf_body from config import config @@ -12,7 +12,7 @@ class Distro: repos: Mapping[str, Repo] arch: str - def __init__(self, arch: str, repo_infos: dict[str, RepoInfo], scan=False): + def __init__(self, arch: Arch, repo_infos: dict[str, RepoInfo], scan=False): assert (arch in ARCHES) self.arch = arch self.repos = dict[str, Repo]() @@ -41,6 +41,17 @@ class Distro: body = generate_pacman_conf_body(self.arch, check_space=check_space) return body + self.repos_config_snippet(extra_repos) + def scan(self, lazy=True): + for repo in self.repos.values(): + if not (lazy and repo.scanned): + repo.scan() + + def is_scanned(self): + for repo in self.repos.values(): + if not repo.scanned: + return False + return True + def get_base_distro(arch: str) -> Distro: repos = {name: RepoInfo(url_template=url) for name, url in BASE_DISTROS[arch]['repos'].items()}