better info rebuild: make Vars responsible for creating info "just in time"
by keeping local state. That way, when we rescan, we don't have to remove any info, and all affected infos are replaced at the same time.
This commit is contained in:
parent
b87d7dd53f
commit
97286a5a18
@ -1,5 +1,5 @@
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: Engine.pm,v 1.14 2010/10/31 11:07:20 espie Exp $
|
||||
# $OpenBSD: Engine.pm,v 1.15 2010/12/07 10:56:26 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -318,9 +318,6 @@ sub rebuild_info
|
||||
my ($self, $core) = @_;
|
||||
my @l = @{$self->{requeued}};
|
||||
$self->{requeued} = [];
|
||||
for my $v (@l) {
|
||||
delete $v->{info};
|
||||
}
|
||||
my @subdirs = map {$_->fullpkgpath} @l;
|
||||
$self->{grabber}->grab_subdirs($core, \@subdirs);
|
||||
$core->mark_ready;
|
||||
|
@ -1,5 +1,5 @@
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: PortInfo.pm,v 1.4 2010/12/06 13:20:45 espie Exp $
|
||||
# $OpenBSD: PortInfo.pm,v 1.5 2010/12/07 10:56:26 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -118,9 +118,9 @@ sub add
|
||||
{
|
||||
my ($class, $key, $self, $value, $parent) = @_;
|
||||
$self->{$key} //= bless {}, $class;
|
||||
my $info = DPB::PkgPath->new($value);
|
||||
$info->{parent} //= $parent;
|
||||
$self->{$key}{$info} = $info;
|
||||
my $path = DPB::PkgPath->new($value);
|
||||
$path->{parent} //= $parent;
|
||||
$self->{$key}{$path} = $path;
|
||||
return $self;
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ sub wanted
|
||||
sub new
|
||||
{
|
||||
my ($class, $pkgpath) = @_;
|
||||
$pkgpath->{info} //= bless {}, $class;
|
||||
$pkgpath->{info} = bless {}, $class;
|
||||
}
|
||||
|
||||
sub add
|
||||
|
@ -1,5 +1,5 @@
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: Vars.pm,v 1.10 2010/12/06 13:20:45 espie Exp $
|
||||
# $OpenBSD: Vars.pm,v 1.11 2010/12/07 10:56:26 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -113,6 +113,7 @@ sub grab_list
|
||||
my ($class, $core, $grabber, $subdirs, $log, $dpb, $code) = @_;
|
||||
$class->run_pipe($core, $grabber, $subdirs, $dpb);
|
||||
my $h = {};
|
||||
my $seen = {};
|
||||
my $fh = $core->fh;
|
||||
my $subdir;
|
||||
my $category;
|
||||
@ -157,7 +158,8 @@ sub grab_list
|
||||
$value = $1;
|
||||
}
|
||||
my $o = DPB::PkgPath->compose($pkgpath, $subdir);
|
||||
my $info = DPB::PortInfo->new($o);
|
||||
$seen->{$o} //= DPB::PortInfo->new($o);
|
||||
my $info = $seen->{$o};
|
||||
$h->{$o} = $o;
|
||||
eval { $info->add($var, $value, $o); };
|
||||
if ($@) {
|
||||
|
Loading…
Reference in New Issue
Block a user