aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-07-19 08:29:26 +0530
committersinanmohd <sinan@sinanmohd.com>2024-07-19 08:29:33 +0530
commitcf02c0ac1b7d8ed930a03339f639f819b3ad127b (patch)
tree34c4dbc359b469ca002f60ca9d3b0f0528d0944a /src
parent7d2e561246ed29eca19fe2a666ec2ae6e94964ad (diff)
evanix: add --cache-status flag
Diffstat (limited to 'src')
-rw-r--r--src/evanix.c16
-rw-r--r--src/jobs.c17
2 files changed, 28 insertions, 5 deletions
diff --git a/src/evanix.c b/src/evanix.c
index 4b6e4d9..42b89d7 100644
--- a/src/evanix.c
+++ b/src/evanix.c
@@ -18,6 +18,7 @@ static const char usage[] =
" -m, --max-build Max number of builds.\n"
" -r, --solver-report Print solver report.\n"
" -p, --pipelined <bool> Use evanix build pipeline.\n"
+ " -l, --cache-status <bool> Perform cache locality check.\n"
" -c, --close-unused-fd <bool> Close stderr on exec.\n"
"\n";
@@ -29,6 +30,7 @@ struct evanix_opts_t evanix_opts = {
.max_build = 0,
.system = NULL,
.solver_report = false,
+ .cache_status = true,
};
static int evanix_build_thread_create(struct build_thread *build_thread);
@@ -131,6 +133,7 @@ int main(int argc, char *argv[])
{"solver-report", no_argument, NULL, 'r'},
{"max-build", required_argument, NULL, 'm'},
{"pipelined", required_argument, NULL, 'p'},
+ {"cache-status", required_argument, NULL, 'l'},
{"close-unused-fd", required_argument, NULL, 'c'},
{NULL, 0, NULL, 0},
};
@@ -194,6 +197,19 @@ int main(int argc, char *argv[])
evanix_opts.close_unused_fd = ret;
break;
+ case 'l':
+ ret = atob(optarg);
+ if (ret < 0) {
+ fprintf(stderr,
+ "option --%s requires a bool argument\n"
+ "Try 'evanix --help' for more "
+ "information.\n",
+ longopts[longindex].name);
+ exit(EXIT_FAILURE);
+ }
+
+ evanix_opts.cache_status = ret;
+ break;
default:
fprintf(stderr,
"Try 'evanix --help' for more information.\n");
diff --git a/src/jobs.c b/src/jobs.c
index fc35f83..9d50950 100644
--- a/src/jobs.c
+++ b/src/jobs.c
@@ -388,9 +388,11 @@ int job_read(FILE *stream, struct job **job)
if (ret < 0)
goto out_free;
- ret = job_read_cache(j);
- if (ret < 0)
- goto out_free;
+ if (evanix_opts.cache_status) {
+ ret = job_read_cache(j);
+ if (ret < 0)
+ goto out_free;
+ }
out_free:
cJSON_Delete(root);
@@ -441,8 +443,6 @@ static int job_new(struct job **j, char *name, char *drv_path, char *attr,
return -errno;
}
job->scheduled = false;
- /* unset by job_read_cache() */
- job->stale = true;
job->reported = false;
job->id = -1;
@@ -458,6 +458,13 @@ static int job_new(struct job **j, char *name, char *drv_path, char *attr,
job->parents_filled = 0;
job->parents = NULL;
+ if (evanix_opts.cache_status) {
+ job->stale = true;
+ } else {
+ job->insubstituters = false;
+ job->stale = false;
+ }
+
if (attr != NULL) {
job->nix_attr_name = strdup(attr);
if (job->nix_attr_name == NULL) {