From: John Mulligan Date: Tue, 11 Feb 2025 23:36:13 +0000 (-0500) Subject: script/build-with-container: add more distro aliases X-Git-Tag: v19.2.3~318^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e0fcb80d37ed13df65e1cbb83bcee39d4fb22d83;p=ceph.git script/build-with-container: add more distro aliases Add a system to define distro name aliases and use that to define some additional aliases, primarily to match ubuntu codenames rather than version numbers. Requested by Zack. Signed-off-by: John Mulligan (cherry picked from commit 65f055f0d8390b9787007433d16cf3a1737584ff) --- diff --git a/src/script/build-with-container.py b/src/script/build-with-container.py index 08e98833ae99..f00eb39ce82d 100755 --- a/src/script/build-with-container.py +++ b/src/script/build-with-container.py @@ -102,6 +102,28 @@ class DistroKind(StrEnum): def uses_dnf(cls): return {cls.CENTOS8, cls.CENTOS9, cls.CENTOS10, cls.FEDORA41} + @classmethod + def aliases(cls): + return { + str(cls.CENTOS10): cls.CENTOS10, + "centos10stream": cls.CENTOS10, + str(cls.CENTOS8): cls.CENTOS8, + str(cls.CENTOS9): cls.CENTOS9, + "centos9stream": cls.CENTOS9, + str(cls.FEDORA41): cls.FEDORA41, + "fc41": cls.FEDORA41, + str(cls.UBUNTU2204): cls.UBUNTU2204, + "ubuntu-jammy": cls.UBUNTU2204, + "jammy": cls.UBUNTU2204, + str(cls.UBUNTU2404): cls.UBUNTU2404, + "ubuntu-noble": cls.UBUNTU2404, + "noble": cls.UBUNTU2404, + } + + @classmethod + def from_alias(cls, value): + return cls.aliases()[value] + class DefaultImage(StrEnum): CENTOS10 = "quay.io/centos/centos:stream10" @@ -636,7 +658,8 @@ def parse_cli(build_step_names): parser.add_argument( "--distro", "-d", - choices=[str(f) for f in DistroKind], + choices=DistroKind.aliases().keys(), + type=DistroKind.from_alias, default=str(DistroKind.CENTOS9), help="Specify a distro short name", )