]> git.ipfire.org Git - pakfire.git/commitdiff
builder: Run build scripts in all stages
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 2 Mar 2021 21:52:53 +0000 (21:52 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 2 Mar 2021 21:52:53 +0000 (21:52 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/builder.py

index f5a79533ebe48aa3abeae44a719f0678a14787ea..27ac7d341b618fdbc2d24ea569dd40342267fbf3 100644 (file)
@@ -62,6 +62,13 @@ BUILD_LOG_HEADER = """
 
 """
 
+BUILD_SCRIPT = """#!/bin/bash -xe
+
+%%{_%s}
+
+exit 0
+"""
+
 class Builder(object):
        def __init__(self, arch=None, build_id=None, logfile=None, **kwargs):
                self.config = config.Config("general.conf", "builder.conf")
@@ -350,6 +357,17 @@ class BuilderContext(object):
 
                print(makefile)
 
+               # Execute stages
+               for stage in ("prepare", "build", "test", "install"):
+                       # Fetch build script
+                       script = makefile.expand("build", BUILD_SCRIPT % stage)
+                       if not script:
+                               continue
+
+                       # Run it
+                       self.pakfire.execute_script(script,
+                               enable_network=False, interactive=False)
+
        def shell(self, packages=[], install=None):
                archives = []