From: John Mulligan Date: Fri, 14 Feb 2025 19:50:42 +0000 (-0500) Subject: script/build-with-container: add a common packages target X-Git-Tag: v18.2.5~23^2~5 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=de0d9279445404c4d5a48dc97832ac8409989e8b;p=ceph-ci.git script/build-with-container: add a common packages target Add a `packages` target to build-with-container.py that requests a build of packages, whatever package type is native to the distro selected. For example `./src/script/build-with-container.py -d ubuntu22.04 -e packages` will automatically select a deb packages build where `./src/script/build-with-container.py -d centos9 -e packages` will trigger rpm packages to be built. The underlying package-type specific targets remain unchanged. Signed-off-by: John Mulligan (cherry picked from commit 37b7d509c59348ae11badd6673cb49ce9ce303fa) --- diff --git a/src/script/build-with-container.py b/src/script/build-with-container.py index 32f4d37088f..f03ef013686 100755 --- a/src/script/build-with-container.py +++ b/src/script/build-with-container.py @@ -102,6 +102,12 @@ class DistroKind(StrEnum): def uses_dnf(cls): return {cls.CENTOS8, cls.CENTOS9, cls.CENTOS10, cls.FEDORA41} + @classmethod + def uses_rpmbuild(cls): + # right now this is the same as uses_dnf, but perhaps not always + # let's be specific in our interface + return cls.uses_dnf() # but lazy in the implementation + @classmethod def aliases(cls): return { @@ -231,6 +237,7 @@ class Steps(StrEnum): SOURCE_RPM = "source-rpm" RPM = "rpm" DEBS = "debs" + PACKAGES = "packages" INTERACTIVE = "interactive" @@ -600,6 +607,15 @@ def bc_make_debs(ctx): _run(cmd, check=True, ctx=ctx) +@Builder.set(Steps.PACKAGES) +def bc_make_packages(ctx): + """Build some sort of distro packages - chooses target based on distro.""" + if ctx.cli.distro in DistroKind.uses_rpmbuild(): + ctx.build.wants(Steps.RPM, ctx) + else: + ctx.build.wants(Steps.DEBS, ctx) + + @Builder.set(Steps.CUSTOM) def bc_custom(ctx): """Run a custom build command."""