From: Michael Tremer Date: Tue, 6 Jul 2021 14:57:28 +0000 (+0000) Subject: builder: Implement passing build IDs X-Git-Tag: 0.9.28~1096 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eeba574840f80cc48ceea12ded066e7b7ed0d1fa;p=pakfire.git builder: Implement passing build IDs Signed-off-by: Michael Tremer --- diff --git a/src/_pakfire/pakfire.c b/src/_pakfire/pakfire.c index 9b46bd349..7a52b2549 100644 --- a/src/_pakfire/pakfire.c +++ b/src/_pakfire/pakfire.c @@ -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); diff --git a/src/scripts/pakfire-builder.in b/src/scripts/pakfire-builder.in index 902cff26f..565b18b4e 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 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