TEMP: WIP: add repo_config
TEMP cause it spams a bunch of prints in dataclass handling
This commit is contained in:
parent
72f4d4948e
commit
ff1c31e157
10 changed files with 493 additions and 130 deletions
|
@ -10,12 +10,12 @@ from urllib.error import HTTPError
|
|||
from typing import Iterable, Iterator, Optional
|
||||
|
||||
from binfmt import register as binfmt_register, binfmt_is_registered
|
||||
from constants import REPOSITORIES, CROSSDIRECT_PKGS, QEMU_BINFMT_PKGS, GCC_HOSTSPECS, ARCHES, Arch, CHROOT_PATHS, MAKEPKG_CMD
|
||||
from constants import CROSSDIRECT_PKGS, QEMU_BINFMT_PKGS, GCC_HOSTSPECS, ARCHES, Arch, CHROOT_PATHS, MAKEPKG_CMD
|
||||
from config.state import config
|
||||
from exec.cmd import run_cmd, run_root_cmd
|
||||
from exec.file import makedir, remove_file, symlink
|
||||
from chroot.build import get_build_chroot, BuildChroot
|
||||
from distro.distro import get_kupfer_https, get_kupfer_local
|
||||
from distro.distro import get_kupfer_https, get_kupfer_local, get_kupfer_repo_names
|
||||
from distro.package import RemotePackage, LocalPackage
|
||||
from distro.repo import LocalRepo
|
||||
from progressbar import BAR_PADDING, get_levels_bar
|
||||
|
@ -84,7 +84,7 @@ def init_prebuilts(arch: Arch):
|
|||
"""Ensure that all `constants.REPOSITORIES` inside `dir` exist"""
|
||||
prebuilts_dir = config.get_path('packages')
|
||||
makedir(prebuilts_dir)
|
||||
for repo in REPOSITORIES:
|
||||
for repo in get_kupfer_repo_names(local=True):
|
||||
init_local_repo(repo, arch)
|
||||
|
||||
|
||||
|
|
|
@ -7,11 +7,11 @@ from glob import glob
|
|||
from typing import Iterable, Optional
|
||||
|
||||
from config.state import config
|
||||
from constants import Arch, ARCHES, REPOSITORIES, SRCINFO_FILE, SRCINFO_INITIALISED_FILE, SRCINFO_METADATA_FILE, SRCINFO_TARBALL_FILE, SRCINFO_TARBALL_URL
|
||||
from constants import Arch, ARCHES, SRCINFO_FILE, SRCINFO_INITIALISED_FILE, SRCINFO_METADATA_FILE, SRCINFO_TARBALL_FILE, SRCINFO_TARBALL_URL
|
||||
from exec.cmd import run_cmd, shell_quote, CompletedProcess
|
||||
from exec.file import get_temp_dir, makedir, remove_file
|
||||
from devices.device import get_profile_device
|
||||
from distro.distro import get_kupfer_local, get_kupfer_url
|
||||
from distro.distro import get_kupfer_local, get_kupfer_url, get_kupfer_repo_names
|
||||
from distro.package import LocalPackage
|
||||
from net.ssh import run_ssh_command, scp_put_files
|
||||
from utils import download_file, git, sha256sum
|
||||
|
@ -269,7 +269,7 @@ def cmd_clean(what: Iterable[str] = ['all'], force: bool = False, noop: bool = F
|
|||
[
|
||||
'clean',
|
||||
'-dffX' + ('n' if noop else ''),
|
||||
] + REPOSITORIES,
|
||||
] + get_kupfer_repo_names(local=True),
|
||||
dir=pkgbuilds,
|
||||
)
|
||||
if result.returncode != 0:
|
||||
|
@ -301,7 +301,7 @@ def cmd_clean(what: Iterable[str] = ['all'], force: bool = False, noop: bool = F
|
|||
@cmd_packages.command(name='list')
|
||||
def cmd_list():
|
||||
"List information about available source packages (PKGBUILDs)"
|
||||
pkgdir = os.path.join(config.get_path('pkgbuilds'), REPOSITORIES[0])
|
||||
pkgdir = os.path.join(config.get_path('pkgbuilds'), get_kupfer_repo_names(local=False)[0])
|
||||
if not os.path.exists(pkgdir):
|
||||
raise Exception(f"PKGBUILDs seem not to be initialised yet: {pkgdir} doesn't exist!\n"
|
||||
f"Try running `kupferbootstrap packages init` first!")
|
||||
|
|
|
@ -9,8 +9,8 @@ from joblib import Parallel, delayed
|
|||
from typing import Iterable, Optional, TypeAlias
|
||||
|
||||
from config.state import config, ConfigStateHolder
|
||||
from constants import REPOSITORIES
|
||||
from constants import Arch
|
||||
from distro.distro import get_kupfer_repo_names
|
||||
from distro.package import PackageInfo
|
||||
from exec.file import remove_file
|
||||
from logger import setup_logging
|
||||
|
@ -439,8 +439,13 @@ def get_pkgbuild_dirs(quiet: bool = True, repositories: Optional[list[str]] = No
|
|||
"""Gets the relative paths to directories containing PKGBUILDs, optionally warns about dirs without a PKGBUILD"""
|
||||
pkgbuilds_dir = config.get_path('pkgbuilds')
|
||||
paths = []
|
||||
for repo in repositories or REPOSITORIES:
|
||||
for dir in os.listdir(os.path.join(pkgbuilds_dir, repo)):
|
||||
for repo in repositories or get_kupfer_repo_names(local=True):
|
||||
path = os.path.join(pkgbuilds_dir, repo)
|
||||
if not os.path.exists(path):
|
||||
if not quiet:
|
||||
logging.warning(f'repo "{repo}" can\'t be listed: "{path}" doesn\'t exist; skipping')
|
||||
continue
|
||||
for dir in os.listdir(path):
|
||||
p = os.path.join(repo, dir)
|
||||
if not os.path.exists(os.path.join(pkgbuilds_dir, p, 'PKGBUILD')):
|
||||
if not quiet:
|
||||
|
|
|
@ -20,10 +20,12 @@ class JsonFile(DataClass):
|
|||
|
||||
_filename: ClassVar[str]
|
||||
_relative_path: str
|
||||
_strip_hidden: ClassVar[bool] = True
|
||||
_sparse: ClassVar[bool] = False
|
||||
|
||||
def toJSON(self) -> str:
|
||||
'Returns a json representation, with private keys that start with "_" filtered out'
|
||||
return json.dumps({key: val for key, val in self.toDict().items() if not key.startswith('_')}, indent=2)
|
||||
return json.dumps(self.toDict(), indent=2)
|
||||
|
||||
def write(self):
|
||||
'Write the filtered json representation to disk'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue