This proved surprisingly complicated. This should fix fetching for BUILD_DEPENDS = some/path:patch situations (where the path actually doesn't get built)
This could use a full bulk or two. (I expect to simplify the "new_path/new_fetch_path code later on, but for now, this should do) Index: Engine.pm =================================================================== RCS file: /cvs/ports/infrastructure/lib/DPB/Engine.pm,v retrieving revision 1.148 diff -u -p -r1.148 Engine.pm --- Engine.pm 8 Feb 2023 09:57:43 -0000 1.148 +++ Engine.pm 8 Feb 2023 10:24:53 -0000 @@ -336,8 +336,12 @@ sub adjust_extra $self->has_known_depends($d)) || ($d->has_fullpkgname && $d->fullpkgname eq $v->fullpkgname)) { - delete $v->{info}{$kind}{$d}; - $v->{info}{$kind2}{$d} = $d if defined $kind2; + if ($self->adjust_distfiles($d)) { + $not_yet++; + } else { + delete $v->{info}{$kind}{$d}; + $v->{info}{$kind2}{$d} = $d if defined $kind2; + } } else { $not_yet++; } @@ -531,6 +535,40 @@ sub new_path my $has = {}; $self->adjust_depends1($v, $has); $self->adjust_depends2($v, $has); +} + +sub new_fetch_path +{ + my ($self, $v) = @_; + if (defined $v->{info}{IGNORE} && + !$self->{state}{fetch_only}) { + $self->log('!', $v, $v->{info}{IGNORE}->string); + $self->stub_out($v); + return; + } + if (defined $v->{info}{MISSING_FILES}) { + $self->add_fatal($v, ["fetch manually"], + "Missing distfiles: ". + $v->{info}{MISSING_FILES}->string, + $v->{info}{FETCH_MANUALLY}->string); + return; + } + if (defined $v->{info}{FDEPENDS}) { + for my $f (values %{$v->{info}{FDEPENDS}}) { + if ($self->{tofetch}->contains($f) || + $self->{tofetch}{doing}{$f}) { + next; + } + if ($self->{tofetch}->is_done($f)) { + $v->{info}{distsize} //= 0; + $v->{info}{distsize} += $f->{sz}; + delete $v->{info}{FDEPENDS}{$f}; + next; + } + $self->{tofetch}->add($f); + $self->log('F', $f); + } + } } sub requeue Index: Grabber.pm =================================================================== RCS file: /cvs/ports/infrastructure/lib/DPB/Grabber.pm,v retrieving revision 1.45 diff -u -p -r1.45 Grabber.pm --- Grabber.pm 7 Jun 2022 16:13:16 -0000 1.45 +++ Grabber.pm 8 Feb 2023 10:24:53 -0000 @@ -118,8 +118,13 @@ sub finish } else { if ($v->{wantbuild}) { delete $v->{wantbuild}; + delete $v->{wantfetch}; $self->add_to_build($v); } + if ($v->{wantfetch}) { + delete $v->{wantfetch}; + $self->{engine}->new_fetch_path($v); + } if ($v->{dontjunk}) { $self->{builder}->dontjunk($v); } @@ -200,7 +205,12 @@ sub find_new_dirs delete $v->{wantinfo}; if (defined $v->{wantbuild}) { delete $v->{wantbuild}; + delete $v->{wantfetch}; $self->{engine}->new_path($v); + } + if (defined $v->{wantfetch}) { + delete $v->{wantfetch}; + $self->{engine}->new_fetch_path($v); } if (defined $v->{dontjunk}) { $self->{builder}->dontjunk($v); Index: PkgPath.pm =================================================================== RCS file: /cvs/ports/infrastructure/lib/DPB/PkgPath.pm,v retrieving revision 1.64 diff -u -p -r1.64 PkgPath.pm --- PkgPath.pm 11 Mar 2022 18:38:52 -0000 1.64 +++ PkgPath.pm 8 Feb 2023 10:24:53 -0000 @@ -332,6 +332,7 @@ sub merge_depends for my $d (values %{$info->{EXTRA}}) { $global3->{$d} = $d; $d->{wantinfo} = 1; + $d->{wantfetch} = 1; } }