diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2007-06-04 16:58:41 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2007-06-04 16:58:41 +0000 |
commit | 4467099f72c9909ac2706eda2edaeaa3a2c06939 (patch) | |
tree | 901f72a4b707b8c5416892267f283c248864081b /usr.sbin/pkg_add/OpenBSD | |
parent | 43700a42ebfaa129fde03814012c984c650af32e (diff) |
error code: if we can't find a given libspec, we look through all
known registered libs, and tell the user why this library doesn't match.
Example:
Can't install kdelibs-3.5.7: lib not found lib/qt3/qt-mt.31.0
qt-mt.31.0: found partial match in /usr/local/lib/qt3: major=32, minor=0 (bad major)
qt-mt.31.0: found partial match in /usr/local/lib: major=31, minor=0 (bad directory)
(after altering qt to have @lib lib/qt3/libqt-mt.so.32.0)
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Dependencies.pm | 3 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/SharedLibs.pm | 53 |
2 files changed, 54 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm index 6f51f6dba25..e5c747822be 100644 --- a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm +++ b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Dependencies.pm,v 1.50 2007/06/02 12:45:24 espie Exp $ +# $OpenBSD: Dependencies.pm,v 1.51 2007/06/04 16:58:40 espie Exp $ # # Copyright (c) 2005-2007 Marc Espie <espie@openbsd.org> # @@ -337,6 +337,7 @@ sub solve_wantlibs $h->{pkgname}, ": lib not found ", $lib->{name}, "\n"; $solver->dump if $okay; + OpenBSD::SharedLibs::report_problem($state->{localbase}, $lib->{name}); $okay = 0; } } diff --git a/usr.sbin/pkg_add/OpenBSD/SharedLibs.pm b/usr.sbin/pkg_add/OpenBSD/SharedLibs.pm index c6f7cdc91e1..5cd43fe76d4 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.19 2007/06/04 16:33:23 espie Exp $ +# $OpenBSD: SharedLibs.pm,v 1.20 2007/06/04 16:58:40 espie Exp $ # # Copyright (c) 2003-2005 Marc Espie <espie@openbsd.org> # @@ -170,4 +170,55 @@ sub lookup_libspec } } +sub write_entry +{ + my ($name, $d, $M, $m) = @_; + print "$name: found partial match in $d: major=$M, minor=$m "; +} + +sub why_is_this_bad +{ + my ($name, $d1, $d2, $M1, $M2, $m1, $m2, $pkgname) = @_; + if ($d1 ne $d2) { + print "(bad directory)\n"; + return; + } + if ($M1 != $M2) { + print "(bad major)\n"; + return; + } + if ($m1 < $m2) { + print "(too small minor)\n"; + return; + } + print "($pkgname not reachable)\n"; +} + +sub _report_problem +{ + my ($dir, $name) = @_; + if ($name =~ m/^(.*)\.(\d+)\.(\d+)$/o) { + my ($stem, $major, $minor) = ($1, $2, $3, $4); + return unless defined $registered_libs->{$stem}; + while (my ($d, $v) = each %{$registered_libs->{$stem}}) { + while (my ($M, $w) = each %$v) { + for my $e (@$w) { + write_entry($name, $d, $M, $e->[0]); + why_is_this_bad($name, $dir, $d, $major, $M, $minor, $e->[0], $e->[1]); + } + } + } + } +} + +sub report_problem +{ + my ($base, $libspec) = @_; + + if ($libspec =~ m|(.*)/|o) { + return _report_problem("$base/$1", $'); + } else { + return _report_problem("$base/lib", $libspec); + } +} 1; |