From: Michael Tremer Date: Thu, 22 Jul 2021 13:22:06 +0000 (+0000) Subject: pakfire-builder: Automatically run dist when passed makefiles X-Git-Tag: 0.9.28~1020 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f38ef94d6769a032e2e3b33aeccb7565797e64f7;p=pakfire.git pakfire-builder: Automatically run dist when passed makefiles Signed-off-by: Michael Tremer --- diff --git a/src/scripts/pakfire-builder.in b/src/scripts/pakfire-builder.in index 565b18b4e..28fb374e6 100644 --- a/src/scripts/pakfire-builder.in +++ b/src/scripts/pakfire-builder.in @@ -24,6 +24,7 @@ import logging import os.path import sys import systemd.journal +import tempfile import uuid import pakfire @@ -195,12 +196,27 @@ class Cli(object): """ package, = ns.package - # Initialise a builder instance and build this package - p = self.pakfire(ns) - p.build( - package, - build_id="%s" % ns.build_id, - ) + # Create a temporary directory if we need to call dist + tmp = tempfile.TemporaryDirectory(prefix="pakfire-builder-") + + try: + # Initialise a builder instance and build this package + p = self.pakfire(ns) + + # Package any makefiles + if package.endswith(".nm"): + package = p.dist(package, tmp.name) + print(package) + + # Run build + p.build( + package, + build_id="%s" % ns.build_id if ns.build_id else None, + ) + + # Cleanup the temporary directory + finally: + tmp.cleanup() def _dist(self, ns): # Get the packages from the command line options