mirror of
https://gitlab.com/kupfer/kupferbootstrap.git
synced 2025-06-25 01:48:22 -04:00
distro/repo_config: add support for repos.local.yml
This commit is contained in:
parent
a28550825f
commit
a17ae67600
2 changed files with 9 additions and 3 deletions
|
@ -30,6 +30,7 @@ POST_INSTALL_CMDS = [
|
||||||
]
|
]
|
||||||
|
|
||||||
REPOS_CONFIG_FILE = "repos.yml"
|
REPOS_CONFIG_FILE = "repos.yml"
|
||||||
|
REPOS_CONFIG_FILE_USER = "repos.local.yml"
|
||||||
|
|
||||||
REPOSITORIES = [
|
REPOSITORIES = [
|
||||||
'boot',
|
'boot',
|
||||||
|
|
|
@ -9,7 +9,7 @@ from copy import deepcopy
|
||||||
from typing import ClassVar, Optional, Mapping, Union
|
from typing import ClassVar, Optional, Mapping, Union
|
||||||
|
|
||||||
from config.state import config
|
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 dictscheme import DictScheme, toml_inline_dicts, TomlPreserveInlineDictEncoder
|
||||||
from utils import sha256sum
|
from utils import sha256sum
|
||||||
|
|
||||||
|
@ -134,9 +134,11 @@ def get_repo_config(
|
||||||
repo_config_file: Optional[str] = None,
|
repo_config_file: Optional[str] = None,
|
||||||
) -> tuple[ReposConfigFile, bool]:
|
) -> tuple[ReposConfigFile, bool]:
|
||||||
global _current_config
|
global _current_config
|
||||||
repo_config_file_default = 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 repo_config_file is None:
|
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)
|
||||||
|
if os.path.exists(user_repo_config):
|
||||||
|
repo_config_file_path = user_repo_config
|
||||||
else:
|
else:
|
||||||
repo_config_file_path = repo_config_file
|
repo_config_file_path = repo_config_file
|
||||||
config_exists = os.path.exists(repo_config_file_path)
|
config_exists = os.path.exists(repo_config_file_path)
|
||||||
|
@ -150,6 +152,9 @@ def get_repo_config(
|
||||||
logging.warning(f"{repo_config_file_path} doesn't exist, using built-in repo config defaults")
|
logging.warning(f"{repo_config_file_path} doesn't exist, using built-in repo config defaults")
|
||||||
_current_config = deepcopy(REPOS_CONFIG_DEFAULT)
|
_current_config = deepcopy(REPOS_CONFIG_DEFAULT)
|
||||||
return _current_config, False
|
return _current_config, False
|
||||||
|
if os.path.exists(user_repo_config):
|
||||||
|
repo_config_file_path = user_repo_config
|
||||||
|
config_exists = True
|
||||||
changed = False
|
changed = False
|
||||||
if (not _current_config) or (config_exists and _current_config._checksum != sha256sum(repo_config_file_path)):
|
if (not _current_config) or (config_exists and _current_config._checksum != sha256sum(repo_config_file_path)):
|
||||||
if config_exists:
|
if config_exists:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue