From 86ea81e339aeb4d313b38518a231be63f4ca9d87 Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Thu, 16 Dec 2004 11:07:34 +0000 Subject: renamed borked_installation from borked.n to partial- ... partial-.n if needed. Make borked_installation take a message, to show installation/deinstallation issues correctly. Fix handling of ^C: this may lead some system calls to return early, thus registering as errors: so always mark the last file as done, so that borked installation will register it correctly. Kill packing-list cache for anything but depends: we've got a global cache of libraries now (use it in pkg_add). Make almost everyone look at $main::not, so that we can call register_installation to_installation RequirementList->add/delete safely. Simplify $not logic accordingly, do thing much more closely to what would happen without -n. This should allow pkg_add/pkg_delete -n to handle most nasty cases correctly now, since all the relevant information is kept internally in a compact format: - register of shared libraries - global register of conflicts - cache of depends. --- usr.sbin/pkg_add/OpenBSD/PackingList.pm | 35 ++++++++++----------------------- 1 file changed, 10 insertions(+), 25 deletions(-) (limited to 'usr.sbin/pkg_add/OpenBSD/PackingList.pm') diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm index 6c6f8a42758..781983dcb24 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.42 2004/12/15 01:07:10 espie Exp $ +# $OpenBSD: PackingList.pm,v 1.43 2004/12/16 11:07:33 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie # @@ -67,7 +67,6 @@ sub read $plist = $a; } else { $plist = new $a; - $plist->{code} = $code; } &$code($fh, sub { @@ -334,30 +333,22 @@ sub from_installation require OpenBSD::PackageInfo; - if (defined $plist_cache->{\&defaultCode}->{$pkgname}) { - return $plist_cache->{\&defaultCode}->{$pkgname}; - } $code = \&defaultCode if !defined $code; - if (!defined $plist_cache->{$code}->{$pkgname}) { - my $plist = - $o->fromfile(OpenBSD::PackageInfo::installed_contents($pkgname), - $code); - if (defined $plist) { - $plist_cache->{$code}->{$pkgname} = $plist; - return $plist; - } else { - return undef; - } + if ($code == \&DependOnly && defined $plist_cache->{$pkgname}) { + return $plist_cache->{$pkgname}; + } + my $plist = + $o->fromfile(OpenBSD::PackageInfo::installed_contents($pkgname), + $code); + if (defined $plist && $code == \&DependOnly) { + $plist_cache->{$pkgname} = $plist; } - return $plist_cache->{$code}->{$pkgname}; + return $plist; } sub to_cache { - my ($self) = @_; - - $plist_cache->{\&defaultCode}->{$self->pkgname()} = $self; } sub to_installation @@ -366,7 +357,6 @@ sub to_installation require OpenBSD::PackageInfo; - $self->to_cache(); return if $main::not; $self->tofile(OpenBSD::PackageInfo::installed_contents($self->pkgname())); @@ -375,11 +365,6 @@ sub to_installation sub forget { - my ($self) = @_; - - if (defined $plist_cache->{$self->{code}}) { - delete $plist_cache->{$self->{code}}->{$self->pkgname()}; - } } 1; -- cgit v1.2.3