aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-07-02 13:50:56 +0530
committersinanmohd <sinan@sinanmohd.com>2024-07-02 22:58:48 +0530
commit623e4436ead7e9cd5c0d29eb14437c5cc5d20674 (patch)
treea1035fe243b1ffb08baaba2b1d43d5d011912475 /src
parent96647a48d9ddf12e239d99af514a743721c06f84 (diff)
evanix: add --max-build flag
Diffstat (limited to 'src')
-rw-r--r--src/evanix.c18
-rw-r--r--src/solver_util.c2
2 files changed, 20 insertions, 0 deletions
diff --git a/src/evanix.c b/src/evanix.c
index 27ab428..29b78f3 100644
--- a/src/evanix.c
+++ b/src/evanix.c
@@ -1,5 +1,6 @@
#include <getopt.h>
#include <stdlib.h>
+#include <stdlib.h>
#include <string.h>
#include "build.h"
@@ -15,6 +16,7 @@ static const char usage[] =
" -d, --dry-run Show what derivations would be "
"built.\n"
" -s, --system System to build for."
+ " -m, --max-build Max number of builds."
" -p, --pipelined <bool> Use evanix build pipeline.\n"
" -c, --close-stderr-exec <bool> Close stderr on exec.\n"
"\n";
@@ -24,6 +26,7 @@ struct evanix_opts_t evanix_opts = {
.isflake = false,
.ispipelined = true,
.isdryrun = false,
+ .max_build = 0,
.system = NULL,
};
@@ -102,6 +105,7 @@ int main(int argc, char *argv[])
{"flake", no_argument, NULL, 'f'},
{"dry-run", no_argument, NULL, 'd'},
{"system", required_argument, NULL, 's'},
+ {"max-build", required_argument, NULL, 'm'},
{"pipelined", required_argument, NULL, 'p'},
{"close-stderr-exec", required_argument, NULL, 'c'},
{NULL, 0, NULL, 0},
@@ -123,6 +127,20 @@ int main(int argc, char *argv[])
case 's':
evanix_opts.system = optarg;
break;
+ case 'm':
+ ret = atoi(optarg);
+ if (ret <= 0) {
+ fprintf(stderr,
+ "option --%s requires a natural number "
+ "argument\n"
+ "Try 'evanix --help' for more "
+ "information.\n",
+ longopts[longindex].name);
+ exit(EXIT_FAILURE);
+ }
+
+ evanix_opts.max_build = ret;
+ break;
case 'p':
ret = atob(optarg);
if (ret < 0) {
diff --git a/src/solver_util.c b/src/solver_util.c
index 950c176..a4fd092 100644
--- a/src/solver_util.c
+++ b/src/solver_util.c
@@ -7,6 +7,8 @@
#include "solver_util.h"
#include "util.h"
+static int dag_id_assign(struct job *j, struct jobid *jobid);
+
static int dag_id_assign(struct job *j, struct jobid *jobid)
{
size_t newsize;