import os.path
import sys
import systemd.journal
+import tempfile
import uuid
import pakfire
"""
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