invoke_dnf(state, "remove", packages)
@staticmethod
- def _gpg_locations(release: int) -> tuple[Path, str]:
- return (
- Path("/etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial"),
- "https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official"
- )
+ def _gpgurl(release: int) -> str:
+ return "https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official"
@staticmethod
- def _epel_gpg_locations() -> tuple[Path, str]:
- return (
- Path("/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever"),
- "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-$releasever",
- )
+ def _epel_gpgurl() -> str:
+ return "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-$releasever"
@staticmethod
- def _extras_gpg_locations(release: int) -> tuple[Path, str]:
- return (
- Path("/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512"),
- "https://www.centos.org/keys/RPM-GPG-KEY-CentOS-SIG-Extras"
- )
+ def _extras_gpgurl(release: int) -> str:
+ return "https://www.centos.org/keys/RPM-GPG-KEY-CentOS-SIG-Extras"
@classmethod
def _mirror_directory(cls) -> str:
@classmethod
def _epel_repos(cls, config: MkosiConfig) -> list[Repo]:
- epel_gpgpath, epel_gpgurl = cls._epel_gpg_locations()
+ epel_gpgurl = cls._epel_gpgurl()
if config.local_mirror:
return []
epel_testing_url = "metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-epel$releasever&arch=$basearch"
return [
- Repo("epel", epel_url, epel_gpgpath, epel_gpgurl, enabled=False),
- Repo("epel-testing", epel_testing_url, epel_gpgpath, epel_gpgurl, enabled=False),
+ Repo("epel", epel_url, epel_gpgurl, enabled=False),
+ Repo("epel-testing", epel_testing_url, epel_gpgurl, enabled=False),
]
@classmethod
# Repos for CentOS Linux 8, CentOS Stream 8 and CentOS variants
directory = cls._mirror_directory()
- gpgpath, gpgurl = cls._gpg_locations(release)
+ gpgurl = cls._gpgurl(release)
if config.local_mirror:
appstream_url = f"baseurl={config.local_mirror}"
crb_url = None
powertools_url = f"mirrorlist={cls._mirror_repo_url('PowerTools')}"
- repos = [Repo("appstream", appstream_url, gpgpath, gpgurl)]
+ repos = [Repo("appstream", appstream_url, gpgurl)]
if baseos_url is not None:
- repos += [Repo("baseos", baseos_url, gpgpath, gpgurl)]
+ repos += [Repo("baseos", baseos_url, gpgurl)]
if extras_url is not None:
- repos += [Repo("extras", extras_url, gpgpath, gpgurl)]
+ repos += [Repo("extras", extras_url, gpgurl)]
if crb_url is not None:
- repos += [Repo("crb", crb_url, gpgpath, gpgurl)]
+ repos += [Repo("crb", crb_url, gpgurl)]
if powertools_url is not None:
- repos += [Repo("powertools", powertools_url, gpgpath, gpgurl)]
+ repos += [Repo("powertools", powertools_url, gpgurl)]
repos += cls._epel_repos(config)
return repos
def _stream_repos(cls, config: MkosiConfig, release: int) -> list[Repo]:
# Repos for CentOS Stream 9 and later
- gpgpath, gpgurl = cls._gpg_locations(release)
- extras_gpgpath, extras_gpgurl = cls._extras_gpg_locations(release)
+ gpgurl = cls._gpgurl(release)
+ extras_gpgurl = cls._extras_gpgurl(release)
if config.local_mirror:
appstream_url = f"baseurl={config.local_mirror}"
extras_url = "metalink=https://mirrors.centos.org/metalink?repo=centos-extras-sig-extras-common-$stream&arch=$basearch&protocol=https,http"
crb_url = "metalink=https://mirrors.centos.org/metalink?repo=centos-crb-$stream&arch=$basearch&protocol=https,http"
- repos = [Repo("appstream", appstream_url, gpgpath, gpgurl)]
+ repos = [Repo("appstream", appstream_url, gpgurl)]
if baseos_url is not None:
- repos += [Repo("baseos", baseos_url, gpgpath, gpgurl)]
+ repos += [Repo("baseos", baseos_url, gpgurl)]
if extras_url is not None:
- repos += [Repo("extras", extras_url, extras_gpgpath, extras_gpgurl)]
+ repos += [Repo("extras", extras_url, extras_gpgurl)]
if crb_url is not None:
- repos += [Repo("crb", crb_url, gpgpath, gpgurl)]
+ repos += [Repo("crb", crb_url, gpgurl)]
repos += cls._epel_repos(config)
return repos
# In other versions, the "fedora" repo is frozen at release, and "updates" provides any new packages.
updates_url = None
- gpgpath = Path(f"/etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-{releasever}-{state.config.architecture}")
# See: https://fedoraproject.org/security/
gpgurl = "https://fedoraproject.org/fedora.gpg"
- repos = [Repo("fedora", release_url, gpgpath, gpgurl)]
+ repos = [Repo("fedora", release_url, gpgurl)]
if updates_url is not None:
- repos += [Repo("updates", updates_url, gpgpath, gpgurl)]
+ repos += [Repo("updates", updates_url, gpgurl)]
setup_dnf(state, repos)
invoke_dnf(state, "install", packages, apivfs=apivfs)
class Repo(NamedTuple):
id: str
url: str
- gpgpath: Path
gpgurl: str
enabled: bool = True
def setup_dnf(state: MkosiState, repos: Sequence[Repo] = ()) -> None:
with state.workspace.joinpath("dnf.conf").open("w") as f:
for repo in repos:
-
- if repo.gpgpath.exists():
- gpgkey = f"file://{repo.gpgpath}"
- else:
- gpgkey = repo.gpgurl
-
f.write(
dedent(
f"""\
[{repo.id}]
name={repo.id}
{repo.url}
- gpgkey={gpgkey}
+ gpgkey={repo.gpgurl}
gpgcheck=1
enabled={int(repo.enabled)}
"""
# SPDX-License-Identifier: LGPL-2.1+
from collections.abc import Sequence
-from pathlib import Path
from mkosi.distributions import DistributionInstaller
from mkosi.distributions.fedora import Repo, invoke_dnf, setup_dnf
else:
updates_url = f"mirrorlist={baseurl}&repo=updates"
- gpgpath = Path("/etc/pki/rpm-gpg/RPM-GPG-KEY-Mageia")
gpgurl = f"https://mirrors.kernel.org/mageia/distrib/{release}/{state.config.architecture}/media/core/release/media_info/pubkey"
- repos = [Repo(f"mageia-{release}", release_url, gpgpath, gpgurl)]
+ repos = [Repo(f"mageia-{release}", release_url, gpgurl)]
if updates_url is not None:
- repos += [Repo(f"mageia-{release}-updates", updates_url, gpgpath, gpgurl)]
+ repos += [Repo(f"mageia-{release}-updates", updates_url, gpgurl)]
setup_dnf(state, repos)
invoke_dnf(state, "install", packages, apivfs=apivfs)
# SPDX-License-Identifier: LGPL-2.1+
from collections.abc import Sequence
-from pathlib import Path
from mkosi.distributions import DistributionInstaller
from mkosi.distributions.fedora import Repo, invoke_dnf, setup_dnf
release_url = f"mirrorlist={baseurl}&release=release"
updates_url = f"mirrorlist={baseurl}&release=updates"
- gpgpath = Path("/etc/pki/rpm-gpg/RPM-GPG-KEY-OpenMandriva")
gpgurl = "https://raw.githubusercontent.com/OpenMandrivaAssociation/openmandriva-repos/master/RPM-GPG-KEY-OpenMandriva"
- repos = [Repo("openmandriva", release_url, gpgpath, gpgurl)]
+ repos = [Repo("openmandriva", release_url, gpgurl)]
if updates_url is not None:
- repos += [Repo("updates", updates_url, gpgpath, gpgurl)]
+ repos += [Repo("updates", updates_url, gpgurl)]
setup_dnf(state, repos)
invoke_dnf(state, "install", packages, apivfs=apivfs)