]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
builder: Implement passing build IDs
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 6 Jul 2021 14:57:28 +0000 (14:57 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 6 Jul 2021 14:57:28 +0000 (14:57 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/_pakfire/pakfire.c
src/scripts/pakfire-builder.in

index 9b46bd34982a39a0fd4eeaa706cbab559b7e219c..7a52b25492843d41c770c2cedb38e5321e02d271 100644 (file)
@@ -844,14 +844,15 @@ static PyObject* execute_return_value(int r) {
 }
 
 static PyObject* Pakfire_build(PakfireObject* self, PyObject* args, PyObject* kwargs) {
-       char* kwlist[] = {"path", "logging_callback", "interactive", NULL};
+       char* kwlist[] = { "path", "build_id", "logging_callback", "interactive", NULL };
 
        const char* path = NULL;
+       const char* build_id = NULL;
        PyObject* logging_callback = NULL;
        int interactive = 0;
 
-       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|Op", kwlist, &path,
-                       &logging_callback, &interactive))
+       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|zOp", kwlist, &path,
+                       &build_id, &logging_callback, &interactive))
                return NULL;
 
        int flags = 0;
@@ -870,7 +871,7 @@ static PyObject* Pakfire_build(PakfireObject* self, PyObject* args, PyObject* kw
        Pakfire_execute_logging_callback = logging_callback;
 
        // Run build
-       int r = pakfire_build(self->pakfire, path, NULL, NULL, flags,
+       int r = pakfire_build(self->pakfire, path, NULL, build_id, flags,
                (logging_callback) ? __Pakfire_execute_logging_callback : NULL, NULL);
 
        return execute_return_value(r);
index 902cff26fcde321b33c856350d4626802fbb7c81..565b18b4ef8fb8f130e163c364b9d947048bb61a 100644 (file)
@@ -24,6 +24,7 @@ import logging
 import os.path
 import sys
 import systemd.journal
+import uuid
 
 import pakfire
 import pakfire.logger
@@ -71,7 +72,8 @@ class Cli(object):
                build.add_argument("package", nargs=1,
                        help=_("Give name of at least one package to build"))
                build.set_defaults(func=self._build)
-
+               build.add_argument("--id", type=uuid.UUID, dest="build_id",
+                       help=_("Build ID"))
                build.add_argument("--resultdir", nargs="?",
                        help=_("Path were the output files should be copied to"))
                build.add_argument("-m", "--mode", nargs="?", default="development",
@@ -195,7 +197,10 @@ class Cli(object):
 
                # Initialise a builder instance and build this package
                p = self.pakfire(ns)
-               p.build(package)
+               p.build(
+                       package,
+                       build_id="%s" % ns.build_id,
+               )
 
        def _dist(self, ns):
                # Get the packages from the command line options