diff options
author | sinanmohd <sinan@sinanmohd.com> | 2024-08-29 17:11:35 +0530 |
---|---|---|
committer | sinanmohd <sinan@sinanmohd.com> | 2024-08-29 17:12:24 +0530 |
commit | 2f28cd127018979b389ca23e41665a2bf1608b1c (patch) | |
tree | f1e64b363a61ec9625fd65a788a2680c0a392211 | |
parent | 3b4bcede398591bc2fdb9836e5e21a7f1913191d (diff) |
jobs/job_read_cache: acquire transitive dependencies
-rw-r--r-- | src/jobs.c | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -399,7 +399,7 @@ static int job_read_cache(struct job *job) { size_t argindex, n; FILE *nix_build_stream; - char *args[4]; + char *args[4], *trimmed; int ret, nlines; struct job *j; @@ -409,6 +409,7 @@ static int job_read_cache(struct job *job) args[argindex++] = "--dry-run"; args[argindex++] = job->drv_path; args[argindex++] = NULL; + struct job *dep_job = NULL; ret = vpopen(&nix_build_stream, "nix-build", args, VPOPEN_STDERR); if (ret < 0) @@ -425,10 +426,18 @@ static int job_read_cache(struct job *job) continue; } - j = job_search(job, trim(line)); + trimmed = trim(line); + j = job_search(job, trimmed); if (j == NULL) { - /* nix-eval-jobs doesn't count src */ - continue; + ret = job_new(&dep_job, NULL, trimmed, NULL, job); + if (ret < 0) + goto out_free_line; + + ret = job_deps_list_insert(job, dep_job); + if (ret < 0) + goto out_free_line; + + j = dep_job; } if (in_fetched_block) @@ -460,6 +469,8 @@ static int job_read_cache(struct job *job) out_free_line: free(line); fclose(nix_build_stream); + if (ret < 0) + job_free(dep_job); return ret; } |