summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2010-01-24 15:31:39 +0000
committerMarc Espie <espie@cvs.openbsd.org>2010-01-24 15:31:39 +0000
commitb76e3e683c141c7c88303aac8a023d4f829874a9 (patch)
tree50b82f292efd6a28e0777df23e8e1fd02f8f160c /usr.sbin/pkg_add
parentee39a674b487e765657673d5ef4bab899a58e8a9 (diff)
extra indirection: no match gives a reason why, so we can rebuild
report_problems to actually say what's wrong...
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/LibSpec.pm19
-rw-r--r--usr.sbin/pkg_add/OpenBSD/SharedLibs.pm9
2 files changed, 19 insertions, 9 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/LibSpec.pm b/usr.sbin/pkg_add/OpenBSD/LibSpec.pm
index 10681840e60..391be1b9b4f 100644
--- a/usr.sbin/pkg_add/OpenBSD/LibSpec.pm
+++ b/usr.sbin/pkg_add/OpenBSD/LibSpec.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: LibSpec.pm,v 1.3 2010/01/24 14:31:13 espie Exp $
+# $OpenBSD: LibSpec.pm,v 1.4 2010/01/24 15:31:38 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
@@ -207,27 +207,32 @@ sub lookup_stem
}
}
-sub match
+sub no_match
{
my ($spec, $library, $base) = @_;
if ($spec->major != $library->major) {
- return 0;
+ return "bad major";
}
if ($spec->minor > $library->minor) {
- return 0;
+ return "minor is too small";
}
if (defined $spec->{dir}) {
if ("$base/$spec->{dir}" eq $library->{dir}) {
- return 1;
+ return undef;
}
} else {
for my $d ($base, OpenBSD::Paths->library_dirs) {
if ("$d/lib" eq $library->{dir}) {
- return 1;
+ return undef;
}
}
}
- return 0;
+ return "bad directory";
+}
+sub match
+{
+ my ($spec, $library, $base) = @_;
+ return !$spec->no_match($library, $base);
}
1;
diff --git a/usr.sbin/pkg_add/OpenBSD/SharedLibs.pm b/usr.sbin/pkg_add/OpenBSD/SharedLibs.pm
index f3e02f442b7..64749c3de72 100644
--- a/usr.sbin/pkg_add/OpenBSD/SharedLibs.pm
+++ b/usr.sbin/pkg_add/OpenBSD/SharedLibs.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: SharedLibs.pm,v 1.46 2010/01/24 15:13:15 espie Exp $
+# $OpenBSD: SharedLibs.pm,v 1.47 2010/01/24 15:31:38 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -165,7 +165,12 @@ sub report_problem
} elsif (!defined $approx) {
$r = "| not found anywhere\n";
} else {
- $r .= join(',', sort map {$_->to_string} @$approx)."\n";
+ for my $bad (@$approx) {
+ my $ouch = $spec->no_match($bad, $base);
+ $ouch //= "not reachable";
+ $r .= "| ".$bad->to_string." (".$bad->origin."): ".
+ $ouch."\n";
+ }
}
if (!defined $printed->{$name} || $printed->{$name} ne $r) {
$printed->{$name} = $r;