From a20dd924fb1eb7729dcc88044f166deff1158bed Mon Sep 17 00:00:00 2001 From: espie Date: Thu, 17 Feb 2022 12:42:37 +0000 Subject: [PATCH] move summary.log generation into the subengine, because it's absurd to create it in dpb modes that don't build anything (such as -F and HISTORY_ONLY). No functional change. --- infrastructure/lib/DPB/Engine.pm | 63 +------------------------ infrastructure/lib/DPB/SubEngine.pm | 73 ++++++++++++++++++++++++++++- 2 files changed, 74 insertions(+), 62 deletions(-) diff --git a/infrastructure/lib/DPB/Engine.pm b/infrastructure/lib/DPB/Engine.pm index 89c916793a2..725a17e8b9f 100644 --- a/infrastructure/lib/DPB/Engine.pm +++ b/infrastructure/lib/DPB/Engine.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Engine.pm,v 1.144 2021/11/15 14:48:17 espie Exp $ +# $OpenBSD: Engine.pm,v 1.145 2022/02/17 12:42:37 espie Exp $ # # Copyright (c) 2010-2013 Marc Espie # @@ -686,66 +686,7 @@ sub end_dump sub smart_dump { my ($self, $fh) = @_; - - my $h = {}; - - for my $v (values %{$self->{tobuild}}) { - $v->{info}{problem} = 'not built'; - $v->{info}{missing} = $v->{info}{DEPENDS}; - $h->{$v} = $v; - } - - for my $v (values %{$self->{built}}) { - $v->{info}{problem} = 'not installable'; - $v->{info}{missing} = $v->{info}{RDEPENDS}; - $h->{$v} = $v; - } - for my $v (@{$self->{errors}}) { - $v->{info}{problem} = "errored"; - $h->{$v} = $v; - } - for my $v (@{$self->{locks}}) { - $v->{info}{problem} = "locked"; - $h->{$v} = $v; - } - my $cache = {}; - for my $v (sort {$a->fullpkgpath cmp $b->fullpkgpath} - values %$h) { - if (defined $cache->{$v->{info}}) { - print $fh $v->fullpkgpath, " same as ", - $cache->{$v->{info}}, "\n"; - next; - } - print $fh $v->fullpkgpath, " ", $v->{info}{problem}; - if (defined $v->{info}{missing}) { - $self->follow_thru($v, $fh, $v->{info}{missing}); - #print $fh " ", $v->{info}{missing}->string; - } - print $fh "\n"; - $cache->{$v->{info}} = $v->fullpkgpath; - } - print $fh '-'x70, "\n"; -} - -sub follow_thru -{ - my ($self, $v, $fh, $list) = @_; - my @d = (); - my $known = {$v => $v}; - while (1) { - my $w = (values %$list)[0]; - push(@d, $w); - if (defined $known->{$w}) { - last; - } - $known->{$w} = $w; - if (defined $w->{info}{missing}) { - $list = $w->{info}{missing}; - } else { - last; - } - } - print $fh " ", join(' -> ', map {$_->logname} @d); + $self->{buildable}->smart_dump($fh); } sub dump diff --git a/infrastructure/lib/DPB/SubEngine.pm b/infrastructure/lib/DPB/SubEngine.pm index 775d02d2cbd..53a507901ca 100644 --- a/infrastructure/lib/DPB/SubEngine.pm +++ b/infrastructure/lib/DPB/SubEngine.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: SubEngine.pm,v 1.34 2020/04/07 15:18:33 espie Exp $ +# $OpenBSD: SubEngine.pm,v 1.35 2022/02/17 12:42:37 espie Exp $ # # Copyright (c) 2010 Marc Espie # @@ -320,6 +320,72 @@ sub preempt_core return 0; } +sub smart_dump +{ + my ($self, $fh) = @_; + + my $h = {}; + my $engine = $self->{engine}; + + for my $v (values %{$engine->{tobuild}}) { + $v->{info}{problem} = 'not built'; + $v->{info}{missing} = $v->{info}{DEPENDS}; + $h->{$v} = $v; + } + + for my $v (values %{$engine->{built}}) { + $v->{info}{problem} = 'not installable'; + $v->{info}{missing} = $v->{info}{RDEPENDS}; + $h->{$v} = $v; + } + for my $v (@{$engine->{errors}}) { + $v->{info}{problem} = "errored"; + $h->{$v} = $v; + } + for my $v (@{$engine->{locks}}) { + $v->{info}{problem} = "locked"; + $h->{$v} = $v; + } + my $cache = {}; + for my $v (sort {$a->fullpkgpath cmp $b->fullpkgpath} + values %$h) { + if (defined $cache->{$v->{info}}) { + print $fh $v->fullpkgpath, " same as ", + $cache->{$v->{info}}, "\n"; + next; + } + print $fh $v->fullpkgpath, " ", $v->{info}{problem}; + if (defined $v->{info}{missing}) { + $self->follow_thru($v, $fh, $v->{info}{missing}); + #print $fh " ", $v->{info}{missing}->string; + } + print $fh "\n"; + $cache->{$v->{info}} = $v->fullpkgpath; + } + print $fh '-'x70, "\n"; +} + +sub follow_thru +{ + my ($self, $v, $fh, $list) = @_; + my @d = (); + my $known = {$v => $v}; + while (1) { + my $w = (values %$list)[0]; + push(@d, $w); + if (defined $known->{$w}) { + last; + } + $known->{$w} = $w; + if (defined $w->{info}{missing}) { + $list = $w->{info}{missing}; + } else { + last; + } + } + print $fh " ", join(' -> ', map {$_->logname} @d); +} + # for parts of dpb that won't run package DPB::SubEngine::Dummy; our @ISA = qw(DPB::SubEngine::BuildBase); @@ -347,4 +413,9 @@ sub is_dummy { return 1; } + +sub smart_dump +{ + # don't bother +} 1;