WIP: keyring init

This commit is contained in:
InsanePrawn 2023-04-17 16:27:36 +02:00
parent 0c56038ed6
commit e068b3587e
4 changed files with 57 additions and 14 deletions

View file

@ -72,6 +72,7 @@ class LocalPackage(BinaryPackage):
assert self.resolved_url and self.filename and self.filename in self.resolved_url
path = f'{self.resolved_url.split("file://")[1]}'
if dest_dir:
makedir(dest_dir)
target = os.path.join(dest_dir, filename or self.filename)
if os.path.getsize(path) != os.path.getsize(target) or sha256sum(path) != sha256sum(target):
copy_file(path, target, follow_symlinks=True)

View file

@ -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, KEYRINGS_KEY, REPOS_CONFIG_FILE, REPOSITORIES
from dictscheme import DictScheme, toml_inline_dicts, TomlPreserveInlineDictEncoder
from utils import sha256sum
@ -39,11 +39,13 @@ class RepoConfig(AbstrRepoConfig):
class BaseDistro(DictScheme):
remote_url: Optional[str]
keyrings: Optional[list[str]]
repos: dict[str, BaseDistroRepo]
class ReposConfigFile(DictScheme):
remote_url: Optional[str]
keyrings: Optional[list[str]]
repos: dict[str, RepoConfig]
base_distros: dict[Arch, BaseDistro]
_path: Optional[str]
@ -106,6 +108,7 @@ REPOS_CONFIG_DEFAULT = ReposConfigFile({
'_path': '__DEFAULTS__',
'_checksum': None,
REMOTEURL_KEY: KUPFER_HTTPS,
KEYRINGS_KEY: [],
REPOS_KEY: {
'kupfer_local': REPO_DEFAULTS | {
LOCALONLY_KEY: True
@ -117,11 +120,10 @@ REPOS_CONFIG_DEFAULT = ReposConfigFile({
BASEDISTROS_KEY: {
arch: {
REMOTEURL_KEY: None,
'repos': {
k: {
'remote_url': v
} for k, v in arch_def['repos'].items()
},
KEYRINGS_KEY: arch_def.get(KEYRINGS_KEY, None),
'repos': {k: {
'remote_url': v
} for k, v in arch_def['repos'].items()}, # type: ignore[union-attr]
} for arch, arch_def in BASE_DISTROS.items()
},
})