From: Daan De Meyer Date: Fri, 13 Jan 2023 12:15:08 +0000 (+0100) Subject: centos: Move epel selection to --repositories option X-Git-Tag: v15~365^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=58db029bac7d7f337d2af46ee1d526740a20e47e;p=thirdparty%2Fmkosi.git centos: Move epel selection to --repositories option Instead of having different distros for epel, let's just enable it via the --repositories option. --- diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3fd1703ce..eb04528be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 abe21c7a9..26662efc7 100644 --- 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 diff --git a/mkosi.md b/mkosi.md index 620d07de2..b96f2fb06 100644 --- 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` diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 814453cdb..9080415c4 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -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)) diff --git a/mkosi/backend.py b/mkosi/backend.py index 0d4c9fce8..74e73a8c1 100644 --- a/mkosi/backend.py +++ b/mkosi/backend.py @@ -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 index 4e7de899c..000000000 --- a/mkosi/distributions/alma_epel.py +++ /dev/null @@ -1,7 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1+ - -from mkosi.distributions.alma import AlmaInstaller - - -class AlmaEpelInstaller(AlmaInstaller): - pass diff --git a/mkosi/distributions/centos.py b/mkosi/distributions/centos.py index 7c45a8a49..d120339ac 100644 --- a/mkosi/distributions/centos.py +++ b/mkosi/distributions/centos.py @@ -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 index a6ba48d49..000000000 --- a/mkosi/distributions/centos_epel.py +++ /dev/null @@ -1,7 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1+ - -from mkosi.distributions.centos import CentosInstaller - - -class CentosEpelInstaller(CentosInstaller): - pass diff --git a/mkosi/distributions/fedora.py b/mkosi/distributions/fedora.py index c6ce5bd2a..f6ac14b09 100644 --- a/mkosi/distributions/fedora.py +++ b/mkosi/distributions/fedora.py @@ -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 index 55427381c..000000000 --- a/mkosi/distributions/rocky_epel.py +++ /dev/null @@ -1,7 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1+ - -from mkosi.distributions.rocky import RockyInstaller - - -class RockyEpelInstaller(RockyInstaller): - pass