Skip to content

Commit

Permalink
jobs/job_read_cache: acquire transitive dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
sinanmohd committed Aug 29, 2024
1 parent 3b4bced commit 2f28cd1
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/jobs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 2f28cd1

Please sign in to comment.