constants: rename %branch% URL marker to %kupfer_branch% and give it its own constant

This commit is contained in:
InsanePrawn 2023-03-27 18:46:50 +02:00
parent 4517201118
commit f3c53e449b
2 changed files with 4 additions and 3 deletions

View file

@ -39,7 +39,8 @@ REPOSITORIES = [
]
DEFAULT_PACKAGE_BRANCH = 'dev'
KUPFER_HTTPS_BASE = 'https://gitlab.com/kupfer/packages/prebuilts/-/raw/%branch%'
KUPFER_BRANCH_MARKER = '%kupfer_branch%'
KUPFER_HTTPS_BASE = f'https://gitlab.com/kupfer/packages/prebuilts/-/raw/{KUPFER_BRANCH_MARKER}'
KUPFER_HTTPS = KUPFER_HTTPS_BASE + '/$arch/$repo'
Arch: TypeAlias = str

View file

@ -1,7 +1,7 @@
from enum import IntFlag
from typing import Generic, Mapping, Optional, TypeVar
from constants import Arch, ARCHES, BASE_DISTROS, REPOSITORIES, KUPFER_HTTPS, CHROOT_PATHS
from constants import Arch, ARCHES, BASE_DISTROS, REPOSITORIES, KUPFER_BRANCH_MARKER, KUPFER_HTTPS, CHROOT_PATHS
from generator import generate_pacman_conf_body
from config.state import config
@ -109,7 +109,7 @@ def reset_distro_caches():
def get_kupfer_url(url: str = KUPFER_HTTPS, branch: Optional[str] = None) -> str:
"""gets the repo URL for `branch`, getting branch from config if `None` is passed."""
branch = config.file.pacman.repo_branch if branch is None else branch
return url.replace('%branch%', branch)
return url.replace(KUPFER_BRANCH_MARKER, branch)
def get_repo_config(*args, **kwargs) -> ReposConfigFile: