more flexible error path while scanning, accumulate reasons why broken.
remove a few explicit (and implicit) die from Fetch: missing/out-of-sync distinfo no longer kill dpb, instead they're properly reported as broken paths and things still go on (note that even a missing SUPDISTFILE checksum *will* mark a path as broken, that's totally intentional)
This commit is contained in:
parent
baeec434e0
commit
8ddfdef47f
@ -1,5 +1,5 @@
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: Fetch.pm,v 1.31 2012/01/23 10:35:38 espie Exp $
|
||||
# $OpenBSD: Fetch.pm,v 1.32 2012/01/29 12:02:20 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -29,8 +29,12 @@ sub create
|
||||
{
|
||||
my ($class, $file, $short, $site, $distinfo, $v, $repo) = @_;
|
||||
|
||||
my $sz = $distinfo->{size}{$file} // 0;
|
||||
my $sz = $distinfo->{size}{$file};
|
||||
my $sha = $distinfo->{sha}{$file};
|
||||
if (!defined $sz || !defined $sha) {
|
||||
$v->break("Incomplete info for $file");
|
||||
return;
|
||||
}
|
||||
$repo->known_file($sha, $file);
|
||||
bless {
|
||||
name => $file,
|
||||
@ -450,7 +454,7 @@ sub distdir
|
||||
sub read_checksums
|
||||
{
|
||||
my $filename = shift;
|
||||
open my $fh, '<', $filename or die "Can't read distinfo $filename";
|
||||
open my $fh, '<', $filename or return;
|
||||
my $r = { size => {}, sha => {}};
|
||||
my $_;
|
||||
while (<$fh>) {
|
||||
@ -460,7 +464,7 @@ sub read_checksums
|
||||
} elsif (m/^SHA256 \((.*)\) \= (.*)$/) {
|
||||
$r->{sha}->{$1} = OpenBSD::sha->fromstring($2);
|
||||
} else {
|
||||
die "Unknown line in $filename: $_";
|
||||
next;
|
||||
}
|
||||
}
|
||||
return $r;
|
||||
@ -488,7 +492,8 @@ sub build_distinfo
|
||||
my $checksum_file = $info->{CHECKSUM_FILE};
|
||||
|
||||
if (!defined $checksum_file) {
|
||||
die "No checksum file for ".$v->fullpkgpath;
|
||||
$v->break("No checksum file");
|
||||
next;
|
||||
}
|
||||
$checksum_file = $checksum_file->string;
|
||||
$distinfo->{$checksum_file} //=
|
||||
@ -504,7 +509,8 @@ sub build_distinfo
|
||||
$site.= $2;
|
||||
}
|
||||
if (!defined $info->{$site}) {
|
||||
die "Can't find $site for $arg";
|
||||
$v->break("Can't find $site for $arg");
|
||||
return;
|
||||
}
|
||||
return DPB::Distfile->new($arg, $dir,
|
||||
$info->{$site}, $checksums, $v, $self);
|
||||
@ -512,12 +518,12 @@ sub build_distinfo
|
||||
|
||||
for my $d ((keys %{$info->{DISTFILES}}), (keys %{$info->{PATCHFILES}})) {
|
||||
my $file = &$build($d);
|
||||
$files->{$file} = $file;
|
||||
$files->{$file} = $file if defined $file;
|
||||
}
|
||||
for my $d (keys %{$info->{SUPDISTFILES}}) {
|
||||
my $file = &$build($d);
|
||||
if ($fetch_only) {
|
||||
$files->{$file} = $file;
|
||||
$files->{$file} = $file if defined $file;
|
||||
}
|
||||
}
|
||||
for my $k (qw(DIST_SUBDIR CHECKSUM_FILE DISTFILES
|
||||
|
@ -1,5 +1,5 @@
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: PkgPath.pm,v 1.25 2012/01/14 12:26:21 espie Exp $
|
||||
# $OpenBSD: PkgPath.pm,v 1.26 2012/01/29 12:02:20 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -391,4 +391,14 @@ sub merge_depends
|
||||
}
|
||||
}
|
||||
|
||||
sub break
|
||||
{
|
||||
my ($self, $why) = @_;
|
||||
if (defined $self->{broken}) {
|
||||
$self->{broken} .= " $why";
|
||||
} else {
|
||||
$self->{broken} = $why;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -1,5 +1,5 @@
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: Vars.pm,v 1.25 2011/12/04 12:05:41 espie Exp $
|
||||
# $OpenBSD: Vars.pm,v 1.26 2012/01/29 12:02:20 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -91,7 +91,7 @@ EOT
|
||||
close STDIN;
|
||||
open(STDIN, '<&', $rh);
|
||||
exec {$make} ('make', '-f', '-');
|
||||
die "oops";
|
||||
die "oops couldn't exec $make";
|
||||
}
|
||||
return @list;
|
||||
}
|
||||
@ -133,7 +133,7 @@ sub grab_list
|
||||
if (m/^\=\=\=\>\s*Exiting (.*) with an error$/) {
|
||||
undef $category;
|
||||
my $dir = DPB::PkgPath->new($1);
|
||||
$dir->{broken} = "exiting with an error";
|
||||
$dir->break("exiting with an error");
|
||||
$h->{$dir} = $dir;
|
||||
open my $quicklog, '>>',
|
||||
$grabber->logger->log_pkgpath($dir);
|
||||
@ -170,11 +170,11 @@ sub grab_list
|
||||
eval { $info->add($var, $value, $o); };
|
||||
if ($@) {
|
||||
print $log $@;
|
||||
$o->{broken} = "error with adding $var=$value";
|
||||
$o->break("error with adding $var=$value");
|
||||
}
|
||||
} elsif (m/^\>\>\s*Broken dependency:\s*(.*?)\s*non existent/) {
|
||||
my $dir = DPB::PkgPath->new($1);
|
||||
$dir->{broken} = "broken dependency";
|
||||
$dir->break("broken dependency");
|
||||
$h->{$dir} = $dir;
|
||||
print $log $_, "\n";
|
||||
print $log "Broken ", $dir->fullpkgpath, "\n";
|
||||
|
Loading…
x
Reference in New Issue
Block a user