handle distfile failure better.

- we do rescan paths anyway, so make sure we queue only path.
- forgetting distfile details does not get around caching, so do creation
of distfiles in two times. cache is there to ensure unique distfiles, and
we can still forget details.
To do: remove distfiles from queue during forget, because there's no longer
any detail there.
This commit is contained in:
espie 2015-06-11 08:42:38 +00:00
parent aa211539a4
commit 5e55c60de7
3 changed files with 36 additions and 14 deletions

View File

@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
# $OpenBSD: Distfile.pm,v 1.5 2015/05/16 12:23:05 espie Exp $
# $OpenBSD: Distfile.pm,v 1.6 2015/06/11 08:42:38 espie Exp $
#
# Copyright (c) 2010-2013 Marc Espie <espie@openbsd.org>
#
@ -30,6 +30,18 @@ sub create
{
my ($class, $file, $short, $site, $distinfo, $v, $repo) = @_;
my $o = bless {
name => $file,
short => $short,
path => $v,
repo => $repo
}, $class;
return $o->complete($file, $short, $site, $distinfo, $v, $repo);
}
sub complete
{
my ($self, $file, $short, $site, $distinfo, $v, $repo) = @_;
my $sz = $distinfo->{size}{$file};
my $sha = $distinfo->{sha}{$file};
if (!defined $sz || !defined $sha) {
@ -37,15 +49,10 @@ sub create
return;
}
$repo->known_file($sha, $file);
bless {
name => $file,
short => $short,
sz => $sz,
sha => $sha,
site => $site,
path => $v,
repo => $repo,
}, $class;
$self->{sz} = $sz;
$self->{sha} = $sha;
$self->{site} = $site;
return $self;
}
sub user
@ -60,6 +67,11 @@ sub distdir
return join('/', $self->{repo}->distdir, @rest);
}
sub path
{
return shift->{path};
}
sub logger
{
my $self = shift;
@ -88,7 +100,11 @@ sub new
if (!defined $url) {
$url = $file;
}
$cache->{$full} //= $class->create($full, $url, @r);
my $c = $cache->{$full} //= $class->create($full, $url, @r);
if (defined $c && !defined $c->{sha}) {
$c->complete($full, $url, @r);
}
return $c;
}
sub logname

View File

@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
# $OpenBSD: Engine.pm,v 1.111 2015/06/08 11:06:08 espie Exp $
# $OpenBSD: Engine.pm,v 1.112 2015/06/11 08:42:38 espie Exp $
#
# Copyright (c) 2010-2013 Marc Espie <espie@openbsd.org>
#
@ -474,7 +474,7 @@ sub requeue_dist
sub rescan
{
my ($self, $v) = @_;
push(@{$self->{requeued}}, $v);
push(@{$self->{requeued}}, $v->path);
}
sub add_fatal

View File

@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
# $OpenBSD: PkgPath.pm,v 1.49 2015/05/10 08:14:14 espie Exp $
# $OpenBSD: PkgPath.pm,v 1.50 2015/06/11 08:42:38 espie Exp $
#
# Copyright (c) 2010-2013 Marc Espie <espie@openbsd.org>
#
@ -35,6 +35,12 @@ sub init
$self->{has} = 5;
}
sub path
{
my $self = shift;
return $self;
}
sub clone_properties
{
my ($n, $o) = @_;