don't stop at the first error, report all

This commit is contained in:
espie 2010-02-27 10:05:42 +00:00
parent 0118b624ce
commit f71d67db02

View File

@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
# $OpenBSD: Signature.pm,v 1.2 2010/02/27 09:53:09 espie Exp $
# $OpenBSD: Signature.pm,v 1.3 2010/02/27 10:05:42 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
@ -38,22 +38,23 @@ sub new
sub compare1
{
my ($s1, $s2) = @_;
my $r = '';
while (my ($stem, $lib) = each %$s1) {
if (!defined $s2->{$stem}) {
return "Can't find ".$lib->to_string;
}
if ($s2->{$stem}->to_string ne $lib->to_string) {
return "versions don't match: ".
$s2->{$stem}->to_string." vs ". $lib->to_string;
$r .= "Can't find ".$lib->to_string."\n";
} elsif ($s2->{$stem}->to_string ne $lib->to_string) {
$r .= "versions don't match: ".
$s2->{$stem}->to_string." vs ". $lib->to_string.
"\n";
}
}
return 0;
return $r;
}
sub compare
{
my ($s1, $s2) = @_;
return compare1($s1, $s2) || compare1($s2, $s1);
return compare1($s1, $s2) . compare1($s2, $s1);
}
package DPB::Signature::Task;
@ -108,14 +109,14 @@ sub add_tasks
sub compare
{
my ($s1, $s2) = @_;
my $r = '';
for my $dir (OpenBSD::Paths->library_dirs) {
my $r = $s1->{$dir}->compare($s2->{$dir});
if ($r) {
DPB::Reporter->myprint("Error between $s1->{host} and $s2->{host}: $r\n");
return 1;
}
$r .= $s1->{$dir}->compare($s2->{$dir});
}
return 0;
if ($r) {
DPB::Reporter->myprint("Error between $s1->{host} and $s2->{host}: $r");
}
return $r;
}
my $ref;
@ -127,7 +128,7 @@ sub matches
$ref = $self;
return 1;
} else {
return $self->compare($ref) == 0;
return $self->compare($ref) eq '';
}
}
1;