diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b1c0fa1..b71fa3c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,6 +31,7 @@ pytest: - 'echo "kupfer ALL = (ALL) NOPASSWD: ALL" > /etc/sudoers.d/kupfer_all' - useradd -m kupfer - chmod 777 . + - usermod --unlock --expiredate="" nobody script: - script -e -c 'su kupfer -s /bin/bash -c "INTEGRATION_TESTS_USE_GLOBAL_CONFIG=TRUE KUPFERBOOTSTRAP_WRAPPED=DOCKER ./pytest.sh --junit-xml=pytest-report.xml --cov-report=xml:coverage.xml integration_tests.py"' coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/' diff --git a/chroot/device.py b/chroot/device.py index bd04467..099a7eb 100644 --- a/chroot/device.py +++ b/chroot/device.py @@ -1,7 +1,7 @@ import atexit import os -from typing import ClassVar, Optional +from typing import ClassVar, Optional, cast from config.state import config from constants import Arch, BASE_PACKAGES @@ -20,15 +20,14 @@ class DeviceChroot(BuildChroot): _copy_base: ClassVar[bool] = False def create_rootfs(self, reset, pacman_conf_target, active_previously): - clss = BuildChroot if self.copy_base else BaseChroot - makedir(config.get_path('chroots')) root_makedir(self.get_path()) if not self.copy_base: pacman_conf_target = os.path.join(get_temp_dir(register_cleanup=True), f'pacman-{self.name}.conf') self.write_pacman_conf(in_chroot=False, absolute_path=pacman_conf_target) - - clss.create_rootfs(self, reset, pacman_conf_target, active_previously) + BaseChroot.create_rootfs(cast(BaseChroot, self), reset, pacman_conf_target, active_previously) + else: + BuildChroot.create_rootfs(self, reset, pacman_conf_target, active_previously) def mount_rootfs(self, source_path: str, fs_type: Optional[str] = None, options: list[str] = [], allow_overlay: bool = False): if self.active: diff --git a/constants.py b/constants.py index 2ddd686..f66f2ce 100644 --- a/constants.py +++ b/constants.py @@ -30,6 +30,7 @@ POST_INSTALL_CMDS = [ ] REPOS_CONFIG_FILE = "repos.yml" +REPOS_CONFIG_FILE_USER = "repos.local.yml" REPOSITORIES = [ 'boot', @@ -59,7 +60,6 @@ TargetArch: TypeAlias = Arch ALARM_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', } @@ -69,7 +69,6 @@ BASE_DISTROS: dict[DistroArch, dict[str, dict[str, str]]] = { 'repos': { 'core': 'https://geo.mirror.pkgbuild.com/$repo/os/$arch', 'extra': 'https://geo.mirror.pkgbuild.com/$repo/os/$arch', - 'community': 'https://geo.mirror.pkgbuild.com/$repo/os/$arch', }, }, 'aarch64': { diff --git a/distro/repo_config.py b/distro/repo_config.py index 5f32d2b..0562537 100644 --- a/distro/repo_config.py +++ b/distro/repo_config.py @@ -9,7 +9,7 @@ from copy import deepcopy from typing import ClassVar, Optional, Mapping, Union from config.state import config -from constants import Arch, BASE_DISTROS, KUPFER_HTTPS, REPOS_CONFIG_FILE, REPOSITORIES +from constants import Arch, BASE_DISTROS, KUPFER_HTTPS, REPOS_CONFIG_FILE, REPOS_CONFIG_FILE_USER, REPOSITORIES from dictscheme import DictScheme, toml_inline_dicts, TomlPreserveInlineDictEncoder from utils import sha256sum @@ -134,9 +134,11 @@ def get_repo_config( repo_config_file: Optional[str] = None, ) -> tuple[ReposConfigFile, bool]: global _current_config - repo_config_file_default = os.path.join(config.get_path('pkgbuilds'), REPOS_CONFIG_FILE) if repo_config_file is None: - repo_config_file_path = repo_config_file_default + repo_config_file_path = os.path.join(config.get_path('pkgbuilds'), REPOS_CONFIG_FILE) + user_repo_config = os.path.join(config.get_path('pkgbuilds'), REPOS_CONFIG_FILE_USER) + if os.path.exists(user_repo_config): + repo_config_file_path = user_repo_config else: repo_config_file_path = repo_config_file config_exists = os.path.exists(repo_config_file_path) @@ -150,6 +152,8 @@ def get_repo_config( logging.warning(f"{repo_config_file_path} doesn't exist, using built-in repo config defaults") _current_config = deepcopy(REPOS_CONFIG_DEFAULT) return _current_config, False + if os.path.exists(user_repo_config): + repo_config_file_path = user_repo_config changed = False if (not _current_config) or (config_exists and _current_config._checksum != sha256sum(repo_config_file_path)): if config_exists: