aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/evanix.h1
-rw-r--r--src/evanix.c16
-rw-r--r--src/jobs.c17
3 files changed, 29 insertions, 5 deletions
diff --git a/include/evanix.h b/include/evanix.h
index 46879ad..9dbe2e7 100644
--- a/include/evanix.h
+++ b/include/evanix.h
@@ -9,6 +9,7 @@ struct evanix_opts_t {
bool ispipelined;
bool solver_report;
bool close_unused_fd;
+ bool cache_status;
char *system;
uint32_t max_build;
};
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) {