]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
centos: Move epel selection to --repositories option
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 13 Jan 2023 12:15:08 +0000 (13:15 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 13 Jan 2023 15:20:29 +0000 (16:20 +0100)
Instead of having different distros for epel, let's just enable it
via the --repositories option.

.github/workflows/ci.yml
NEWS.md
mkosi.md
mkosi/__init__.py
mkosi/backend.py
mkosi/distributions/alma_epel.py [deleted file]
mkosi/distributions/centos.py
mkosi/distributions/centos_epel.py [deleted file]
mkosi/distributions/fedora.py
mkosi/distributions/rocky_epel.py [deleted file]

index 3fd1703cebcda22ecf6e292475da7e325362b432..eb04528be28a0693791e84023db9bdc4ac5e28c2 100644 (file)
@@ -107,12 +107,12 @@ jobs:
       matrix:
         distro:
           - arch
-          - centos_epel
+          - centos
           - debian
           - ubuntu
           - fedora
-          - rocky_epel
-          - alma_epel
+          - rocky
+          - alma
           - gentoo
         format:
           - directory
@@ -192,6 +192,14 @@ jobs:
         sync-uri = https://raw.githubusercontent.com/257/binpkgs/master
         EOF
 
+    - name: Configure EPEL
+      if: matrix.distro == 'centos' || matrix.distro == 'rocky' || matrix.distro == 'alma'
+      run: |
+        tee mkosi.conf.d/mkosi.conf <<- EOF
+        [Distribution]
+        Repositories=epel
+        EOF
+
     - name: Build ${{ matrix.distro }}/${{ matrix.format }}
       run: sudo python3 -m mkosi build
 
diff --git a/NEWS.md b/NEWS.md
index abe21c7a921740a5b0fbb56a00f8f8ec91eda75b..26662efc721f5321a81cd3b8b47557c8606d547d 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -34,6 +34,8 @@
   list of directories to look for extra repository files.
 - `--repositories` is now only usable on Debian/RPM based distros and can only be used to enable additional
   repositories. Specifically, it cannot be used on Arch Linux anymore to add new repositories.
+- The `_epel` distributions were removed. Use `--repositories=epel` instead to enable
+  the EPEL repository.
 
 ## v14
 
index 620d07de23420c8935bf90f05c7216f66f15ca70..b96f2fb06d5e8ef1bacf028741cbeda03182b40c 100644 (file)
--- a/mkosi.md
+++ b/mkosi.md
@@ -277,8 +277,8 @@ a boolean argument: either "1", "yes", or "true" to enable, or "0",
 
 : The distribution to install in the image. Takes one of the following
   arguments: `fedora`, `debian`, `ubuntu`, `arch`, `opensuse`, `mageia`,
-  `centos`, `centos_epel`, `openmandriva`, `rocky`, `rocky_epel`, `alma`,
-  `alma_epel`. If not specified, defaults to the distribution of the host.
+  `centos`, `openmandriva`, `rocky`, and `alma`. If not specified,
+  defaults to the distribution of the host.
 
 `Release=`, `--release=`, `-r`
 
index 814453cdb98d6c4732abc56129e2a0fcde0a7f0e..9080415c4da94c68b395651731155b0825465fab 100644 (file)
@@ -61,7 +61,6 @@ from mkosi.backend import (
     detect_distribution,
     die,
     is_centos_variant,
-    is_epel_variant,
     is_rpm_distribution,
     mkdirp_chown_current_user,
     nspawn_knows_arg,
@@ -2788,11 +2787,11 @@ def load_args(args: argparse.Namespace) -> MkosiConfig:
     if args.release is None:
         if args.distribution == Distribution.fedora:
             args.release = "36"
-        elif args.distribution in (Distribution.centos, Distribution.centos_epel):
+        elif args.distribution == Distribution.centos:
             args.release = "9-stream"
-        elif args.distribution in (Distribution.rocky, Distribution.rocky_epel):
+        elif args.distribution == Distribution.rocky:
             args.release = "9"
-        elif args.distribution in (Distribution.alma, Distribution.alma_epel):
+        elif args.distribution == Distribution.alma:
             args.release = "9"
         elif args.distribution == Distribution.mageia:
             args.release = "7"
@@ -2842,9 +2841,9 @@ def load_args(args: argparse.Namespace) -> MkosiConfig:
                 args.mirror = "https://geo.mirror.pkgbuild.com"
         elif args.distribution == Distribution.opensuse:
             args.mirror = "http://download.opensuse.org"
-        elif args.distribution in (Distribution.rocky, Distribution.rocky_epel):
+        elif args.distribution == Distribution.rocky:
             args.mirror = None
-        elif args.distribution in (Distribution.alma, Distribution.alma_epel):
+        elif args.distribution == Distribution.alma:
             args.mirror = None
 
     if args.sign:
@@ -3002,7 +3001,7 @@ def load_args(args: argparse.Namespace) -> MkosiConfig:
     if args.repo_dirs:
         args.repo_dirs = [p.absolute() for p in args.repo_dirs]
 
-    if args.netdev and is_centos_variant(args.distribution) and not is_epel_variant(args.distribution)::
+    if args.netdev and is_centos_variant(args.distribution) and "epel" not in args.repositories:
         die("--netdev is only supported on EPEL centOS variants")
 
     if args.machine_id is not None:
@@ -3230,12 +3229,9 @@ def print_summary(config: MkosiConfig) -> None:
     if config.distribution in (
         Distribution.fedora,
         Distribution.centos,
-        Distribution.centos_epel,
         Distribution.mageia,
         Distribution.rocky,
-        Distribution.rocky_epel,
         Distribution.alma,
-        Distribution.alma_epel,
     ):
         print("        With Documentation:", yes_no(config.with_docs))
 
index 0d4c9fce8789a8cfdbe61b108f623322ac630bd2..74e73a8c15e2bbfaa2b3ecdd9b7812aeb39f4ef5 100644 (file)
@@ -145,12 +145,9 @@ class Distribution(enum.Enum):
     opensuse     = "opensuse", PackageType.rpm
     mageia       = "mageia", PackageType.rpm
     centos       = "centos", PackageType.rpm
-    centos_epel  = "centos_epel", PackageType.rpm
     openmandriva = "openmandriva", PackageType.rpm
     rocky        = "rocky", PackageType.rpm
-    rocky_epel   = "rocky_epel", PackageType.rpm
     alma         = "alma", PackageType.rpm
-    alma_epel    = "alma_epel", PackageType.rpm
     gentoo       = "gentoo", PackageType.ebuild
 
     def __new__(cls, name: str, package_type: PackageType) -> "Distribution":
@@ -233,31 +230,17 @@ def is_rpm_distribution(d: Distribution) -> bool:
         Distribution.fedora,
         Distribution.mageia,
         Distribution.centos,
-        Distribution.centos_epel,
         Distribution.openmandriva,
         Distribution.rocky,
-        Distribution.rocky_epel,
         Distribution.alma,
-        Distribution.alma_epel
     )
 
 
 def is_centos_variant(d: Distribution) -> bool:
     return d in (
         Distribution.centos,
-        Distribution.centos_epel,
         Distribution.alma,
-        Distribution.alma_epel,
         Distribution.rocky,
-        Distribution.rocky_epel,
-    )
-
-
-def is_epel_variant(d: Distribution) -> bool:
-    return d in (
-        Distribution.centos_epel,
-        Distribution.alma_epel,
-        Distribution.rocky_epel,
     )
 
 
diff --git a/mkosi/distributions/alma_epel.py b/mkosi/distributions/alma_epel.py
deleted file mode 100644 (file)
index 4e7de89..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: LGPL-2.1+
-
-from mkosi.distributions.alma import AlmaInstaller
-
-
-class AlmaEpelInstaller(AlmaInstaller):
-    pass
index 7c45a8a4970adaae52ac28dcc97bfea740ee5cee..d120339ac680292ad5d6890e79f12086b8c4efa9 100644 (file)
@@ -10,7 +10,6 @@ from mkosi.backend import (
     add_packages,
     complete_step,
     die,
-    is_epel_variant,
     run_workspace_command,
 )
 from mkosi.distributions import DistributionInstaller
@@ -66,10 +65,10 @@ class CentosInstaller(DistributionInstaller):
         if state.do_run_build_script:
             packages.update(state.config.build_packages)
 
-        if not state.do_run_build_script and is_epel_variant(state.config.distribution):
+        if not state.do_run_build_script and "epel" in state.config.repositories:
             if state.config.netdev:
                 add_packages(state.config, packages, "systemd-networkd", conditional="systemd")
-            if state.config.distribution not in (Distribution.centos, Distribution.centos_epel) and epel_release >= 9:
+            if state.config.distribution != Distribution.centos and epel_release >= 9:
                 add_packages(state.config, packages, "systemd-boot", conditional="systemd")
 
         install_packages_dnf(state, packages)
@@ -91,12 +90,6 @@ class CentosInstaller(DistributionInstaller):
     def remove_packages(cls, state: MkosiState, remove: list[str]) -> None:
         invoke_dnf(state, 'remove', remove)
 
-    @classmethod
-    def _is_epel(cls) -> bool:
-        name = cls.__name__
-        name = name.removesuffix("Installer")
-        return name.endswith("Epel")
-
     @staticmethod
     def _parse_epel_release(release: str) -> int:
         fields = release.split(".")
@@ -167,8 +160,8 @@ class CentosInstaller(DistributionInstaller):
             repos += [Repo("CRB", crb_url, gpgpath, gpgurl)]
         if powertools_url is not None:
             repos += [Repo("PowerTools", powertools_url, gpgpath, gpgurl)]
-        if epel_url is not None and cls._is_epel():
-            repos += [Repo("epel", epel_url, epel_gpgpath, epel_gpgurl)]
+        if epel_url is not None:
+            repos += [Repo("epel", epel_url, epel_gpgpath, epel_gpgurl, enabled=False)]
 
         return repos
 
@@ -200,7 +193,7 @@ class CentosInstaller(DistributionInstaller):
             repos += [Repo("BaseOS", baseos_url, gpgpath, gpgurl)]
         if crb_url is not None:
             repos += [Repo("CRB", crb_url, gpgpath, gpgurl)]
-        if epel_url is not None and cls._is_epel():
-            repos += [Repo("epel", epel_url, epel_gpgpath, epel_gpgurl)]
+        if epel_url is not None:
+            repos += [Repo("epel", epel_url, epel_gpgpath, epel_gpgurl, enabled=False)]
 
         return repos
diff --git a/mkosi/distributions/centos_epel.py b/mkosi/distributions/centos_epel.py
deleted file mode 100644 (file)
index a6ba48d..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: LGPL-2.1+
-
-from mkosi.distributions.centos import CentosInstaller
-
-
-class CentosEpelInstaller(CentosInstaller):
-    pass
index c6ce5bd2a74b41dfde5a602935b26eb7f07ac630..f6ac14b099245bbc2e6786316c9188b49a9e6af0 100644 (file)
@@ -140,6 +140,7 @@ class Repo(NamedTuple):
     url: str
     gpgpath: Path
     gpgurl: Optional[str] = None
+    enabled: bool = True
 
 
 def setup_dnf(state: MkosiState, repos: Sequence[Repo] = ()) -> None:
@@ -165,7 +166,7 @@ def setup_dnf(state: MkosiState, repos: Sequence[Repo] = ()) -> None:
                     name={repo.id}
                     {repo.url}
                     gpgkey={gpgkey or ''}
-                    enabled=1
+                    enabled={int(repo.enabled)}
                     """
                 )
             )
diff --git a/mkosi/distributions/rocky_epel.py b/mkosi/distributions/rocky_epel.py
deleted file mode 100644 (file)
index 5542738..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: LGPL-2.1+
-
-from mkosi.distributions.rocky import RockyInstaller
-
-
-class RockyEpelInstaller(RockyInstaller):
-    pass