diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2009-12-31 12:38:20 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2009-12-31 12:38:20 +0000 |
commit | 2c7b3523fa52437c27237425bd0716eb61102f68 (patch) | |
tree | 6fb98e43f3e30d78e147b081ad02c485192ce124 /usr.sbin | |
parent | dd4e6ff643b80c29dbd4fd79230da576f17f7b1d (diff) |
add meat to the "can't install" stupid handle message
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Handle.pm | 11 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 26 |
2 files changed, 21 insertions, 16 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Handle.pm b/usr.sbin/pkg_add/OpenBSD/Handle.pm index 160be718381..e52c5f785ea 100644 --- a/usr.sbin/pkg_add/OpenBSD/Handle.pm +++ b/usr.sbin/pkg_add/OpenBSD/Handle.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Handle.pm,v 1.15 2009/12/30 10:02:52 espie Exp $ +# $OpenBSD: Handle.pm,v 1.16 2009/12/31 12:38:19 espie Exp $ # # Copyright (c) 2007-2009 Marc Espie <espie@openbsd.org> # @@ -34,8 +34,9 @@ use constant { sub cleanup { - my ($self, $error) = @_; + my ($self, $error, $errorinfo) = @_; $self->{error} //= $error; + $self->{errorinfo} //= $errorinfo; if (defined $self->location) { if (defined $self->{error} && $self->{error} == ALREADY_INSTALLED) { @@ -109,7 +110,11 @@ sub error_message if ($error == BAD_PACKAGE) { return "bad package"; } elsif ($error == CANT_INSTALL) { - return "can't install"; + if ($self->{errorinfo}) { + return "can't install: $self->{errorinfo}"; + } else { + return "can't install"; + } } elsif ($error == NOT_FOUND) { return "not found"; } elsif ($error == ALREADY_INSTALLED) { diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index 40dcd346436..f3fbb958047 100644 --- a/usr.sbin/pkg_add/pkg_add +++ b/usr.sbin/pkg_add/pkg_add @@ -1,7 +1,7 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_add,v 1.452 2009/12/30 23:45:57 espie Exp $ +# $OpenBSD: pkg_add,v 1.453 2009/12/31 12:38:19 espie Exp $ # # Copyright (c) 2003-2009 Marc Espie <espie@openbsd.org> # @@ -250,11 +250,11 @@ sub complete $o->complete_old($state); } - my $check = $set->can_install($state); + my $check = $set->install_issues($state); return 0 if !defined $check; - if (!$check) { - $set->cleanup(OpenBSD::Handle::CANT_INSTALL); + if ($check) { + $set->cleanup(OpenBSD::Handle::CANT_INSTALL, $check); $state->tracker->cant($set); } return 1; @@ -283,17 +283,17 @@ sub mark_as_manual_install } } -sub can_install +sub install_issues { my ($set, $state) = @_; my @conflicts = $set->find_conflicts($state); - return 1 if @conflicts == 0; + return 0 if @conflicts == 0; if (!$state->{allow_replacing}) { $state->errsay("Can't install ", $set->print, " because of conflicts (",join(',', @conflicts), ")"); - return 0; + return "conflicts"; } @@ -302,7 +302,7 @@ sub can_install if ($state->tracker->is_installed($toreplace)) { $state->errsay("Cannot replace $toreplace in ", $set->print, ": just got installed"); - return 0; + return "replacing just installed"; } next if defined $set->{older}->{$toreplace}; @@ -339,7 +339,7 @@ sub can_install $set->mark_as_manual_install if $manual_install; - return 1; + return 0; } sub check_forward_dependencies @@ -748,13 +748,13 @@ sub install_set $state->errsay("Can't install ", $set->print, ": can't resolve ", join(',', @baddeps)); $bad++; - $set->cleanup(OpenBSD::Handle::CANT_INSTALL); + $set->cleanup(OpenBSD::Handle::CANT_INSTALL,"bad dependencies"); $state->tracker->cant($set); return (); } if (!$set->solver->solve_wantlibs($state)) { - $set->cleanup(OpenBSD::Handle::CANT_INSTALL); + $set->cleanup(OpenBSD::Handle::CANT_INSTALL, "libs not found"); $state->tracker->cant($set); $bad++; return (); @@ -766,14 +766,14 @@ sub install_set # } # } if (!$set->recheck_conflicts($state)) { - $set->cleanup(OpenBSD::Handle::CANT_INSTALL); + $set->cleanup(OpenBSD::Handle::CANT_INSTALL, "fatal conflicts"); $state->tracker->cant($set); return (); } if ($set->older_to_do) { require OpenBSD::Replace; if (!OpenBSD::Replace::is_set_safe($set, $state)) { - $set->cleanup(OpenBSD::Handle::CANT_INSTALL); + $set->cleanup(OpenBSD::Handle::CANT_INSTALL, "exec detected"); $state->tracker->cant($set); return (); } |