summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingList.pm10
-rw-r--r--usr.sbin/pkg_add/pkg_add5
2 files changed, 10 insertions, 5 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm
index 85d08e4078a..52f0acfd539 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackingList.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackingList.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackingList.pm,v 1.38 2004/11/13 12:49:58 espie Exp $
+# $OpenBSD: PackingList.pm,v 1.39 2004/11/13 13:55:03 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -62,12 +62,13 @@ sub read
{
my ($a, $fh, $code) = @_;
my $plist;
+ $code = \&defaultCode if !defined $code;
if (ref $a) {
$plist = $a;
} else {
$plist = new $a;
+ $plist->{code} = $code;
}
- $code = \&defaultCode if !defined $code;
&$code($fh,
sub {
local $_ = shift;
@@ -343,7 +344,6 @@ sub from_installation
$o->fromfile(OpenBSD::PackageInfo::installed_contents($pkgname),
$code);
if (defined $plist) {
- $plist->{code} = $code;
$plist_cache->{$code}->{$pkgname} = $plist;
return $plist;
} else {
@@ -375,7 +375,9 @@ sub forget
{
my ($self) = @_;
- delete $plist_cache->{$self->{code}}->{$self->pkgname()};
+ if (defined $plist_cache->{$self->{code}}) {
+ delete $plist_cache->{$self->{code}}->{$self->pkgname()};
+ }
}
1;
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index d4721a9ca1e..1ed8bef0e98 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.116 2004/11/13 13:34:02 espie Exp $
+# $OpenBSD: pkg_add,v 1.117 2004/11/13 13:55:02 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -417,6 +417,9 @@ sub really_add($$)
} else {
my $dest = installed_info($pkgname);
OpenBSD::Add::register_installation($dir, $dest, $plist);
+ if (!$state->{replace}) {
+ $plist->forget();
+ }
if (defined $handle->{solved_dependencies}) {
require OpenBSD::RequiredBy;