mirror of
https://gitlab.com/kupfer/kupferbootstrap.git
synced 2025-02-23 05:35:44 -05:00
Add distros.get_base_distros()
This commit is contained in:
parent
fef0f07297
commit
d08e25fe1b
5 changed files with 33 additions and 8 deletions
|
@ -28,6 +28,6 @@ RUN pip install -r requirements.txt
|
|||
|
||||
COPY . .
|
||||
|
||||
RUN python -c "import constants; repos='\n'.join(['\n'.join([f'[{repo}]', f'Server = file:///prebuilts/\$repo', '']) for repo in constants.REPOSITORIES]); print(repos)" | tee /etc/pacman.d/kupfer-local
|
||||
RUN python -c "import constants; repos='\n'.join(['\n'.join(['', f'[{repo}]', f'Server = file:///prebuilts/\$repo']) for repo in constants.REPOSITORIES]); print(repos)" | tee -a /etc/pacman.conf
|
||||
|
||||
WORKDIR /src
|
||||
|
|
|
@ -7,7 +7,6 @@ import click
|
|||
|
||||
CONFIG_DEFAULT_PATH = os.path.join(appdirs.user_config_dir('kupfer'), 'kupferbootstrap.toml')
|
||||
|
||||
|
||||
PROFILE_DEFAULTS = {
|
||||
'device': '',
|
||||
'flavour': '',
|
||||
|
@ -41,6 +40,7 @@ CONFIG_RUNTIME_DEFAULTS = {
|
|||
'arch': None,
|
||||
}
|
||||
|
||||
|
||||
def sanitize_config(conf: dict, warn_missing_defaultprofile=True) -> dict:
|
||||
"""checks the input config dict for unknown keys and returns only the known parts"""
|
||||
return merge_configs(conf_new=conf, conf_base={}, warn_missing_defaultprofile=warn_missing_defaultprofile)
|
||||
|
|
17
constants.py
17
constants.py
|
@ -47,8 +47,21 @@ ARCHES = [
|
|||
'aarch64',
|
||||
]
|
||||
|
||||
BASE_DISTROS: {
|
||||
BASE_DISTROS = {
|
||||
'x86_64': {
|
||||
'': '',
|
||||
'repos': {
|
||||
'core': 'http://ftp.halifax.rwth-aachen.de/archlinux/$repo/os/$arch',
|
||||
'extra': 'http://ftp.halifax.rwth-aachen.de/archlinux/$repo/os/$arch',
|
||||
'community': 'http://ftp.halifax.rwth-aachen.de/archlinux/$repo/os/$arch',
|
||||
},
|
||||
},
|
||||
'aarch64': {
|
||||
'repos': {
|
||||
'core': 'http://mirror.archlinuxarm.org/$arch/$repo',
|
||||
'extra': 'http://mirror.archlinuxarm.org/$arch/$repo',
|
||||
'community': 'http://mirror.archlinuxarm.org/$arch/$repo',
|
||||
'alarm': 'http://mirror.archlinuxarm.org/$arch/$repo',
|
||||
'aur': 'http://mirror.archlinuxarm.org/$arch/$repo',
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
18
distro.py
18
distro.py
|
@ -32,7 +32,6 @@ class Repo:
|
|||
name: str
|
||||
url_template: str
|
||||
resolved_url: str
|
||||
repo_name: str
|
||||
arch: str
|
||||
packages: dict[str, PackageInfo]
|
||||
options: dict[str, str]
|
||||
|
@ -43,11 +42,10 @@ class Repo:
|
|||
self.remote = not self.resolved_url.startswith('file://')
|
||||
# TODO
|
||||
|
||||
def __init__(self, name: str, url_template: str, arch: str, repo_name: str, options={}, scan=True):
|
||||
def __init__(self, name: str, url_template: str, arch: str, options={}, scan=True):
|
||||
self.name = name
|
||||
self.url_template = url_template
|
||||
self.arch = arch
|
||||
self.repo_name = repo_name
|
||||
self.options = deepcopy(options)
|
||||
if scan:
|
||||
self.scan()
|
||||
|
@ -86,3 +84,17 @@ class Distro:
|
|||
assert (repo.packages is not None)
|
||||
for package in repo.packages:
|
||||
results[package.name] = package
|
||||
|
||||
|
||||
_base_distros: dict[str, Distro] = None
|
||||
|
||||
|
||||
def get_base_distros() -> dict[str, Distro]:
|
||||
global _base_distros
|
||||
if not _base_distros:
|
||||
_distros: dict[str, Distro] = {}
|
||||
for arch, distro_conf in BASE_DISTROS.items():
|
||||
repos = {name: RepoInfo(url_template=url) for name, url in distro_conf['repos'].items()}
|
||||
_distros[arch] = Distro(arch=arch, repo_infos=repos, scan=False)
|
||||
_base_distros = _distros
|
||||
return _base_distros
|
||||
|
|
|
@ -354,7 +354,7 @@ def setup_dependencies_and_sources(package: Package, chroot: str, repo_dir: str
|
|||
makepkg_setup_args = [
|
||||
'--nobuild',
|
||||
'--holdver',
|
||||
'--nodeps'
|
||||
'--nodeps',
|
||||
]
|
||||
if (package.mode == 'cross' and enable_crosscompile):
|
||||
logging.info('Setting up dependencies for cross-compilation')
|
||||
|
|
Loading…
Add table
Reference in a new issue