diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2007-06-10 15:24:37 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2007-06-10 15:24:37 +0000 |
commit | af43d601f3f24f23e93e84d63024f19fdc40afae (patch) | |
tree | 858a57b18987e5d060243c6cedbee3e5d3645ff9 /usr.sbin | |
parent | 4366ccacdb906baa08223213087a3ffc7892ff35 (diff) |
set_infodir when we can in PackageLocation.
Create a full handle for replaced packages as well.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageLocation.pm | 7 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 16 |
2 files changed, 16 insertions, 7 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocation.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocation.pm index 3541a71f36b..91f44122cb7 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageLocation.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageLocation.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageLocation.pm,v 1.13 2007/06/04 18:55:47 espie Exp $ +# $OpenBSD: PackageLocation.pm,v 1.14 2007/06/10 15:24:36 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -207,8 +207,11 @@ sub plist my $value = $self->{contents}; return OpenBSD::PackingList->fromfile(\$value, $code); } elsif (defined $self->{dir} && -f $self->{dir}.CONTENTS) { - return OpenBSD::PackingList->fromfile($self->{dir}.CONTENTS, + my $plist = + OpenBSD::PackingList->fromfile($self->{dir}.CONTENTS, $code); + $plist->set_infodir($self->{dir}); + return $plist; } # hopeless $self->close_with_client_error; diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index 2d478072b07..d165c1211d9 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.318 2007/06/10 15:11:05 espie Exp $ +# $OpenBSD: pkg_add,v 1.319 2007/06/10 15:24:36 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -165,19 +165,25 @@ sub can_install return; } - my $rplist = OpenBSD::PackingList->from_installation($toreplace); + my $old_handle = OpenBSD::Handle->new; + $old_handle->{pkgname} = $toreplace; + $old_handle->{location} = OpenBSD::PackageRepository::Installed->new->find($toreplace, $state->{arch}); + if (!$old_handle->{location}) { + Fatal "Can't find $toreplace as an installed package\n"; + } + my $rplist = $old_handle->{location}->plist; if (!defined $rplist) { Fatal "Couldn't find packing-list for $toreplace\n"; } + $old_handle->{plist} = $rplist; + if (!OpenBSD::Replace::can_old_package_be_replaced($rplist, $pkgname, $state, \%conflicts)) { print "Can't update $toreplace into $pkgname\n"; $handle->set_error(OpenBSD::Handle::CANT_INSTALL); return; } - my $old_handle = OpenBSD::Handle->new; - $old_handle->{plist} = $rplist; - $old_handle->{pkgname} = $toreplace; + $set->add_older($old_handle); if ($rplist->has('manual-installation') && !$plist->has('manual-installation')) { |