From 5b0079459ee194a2d6174ae2299e693df160191d Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Sat, 13 Nov 2004 12:49:59 +0000 Subject: synchronize installed stuff, using the cache in -n mode so that -n installations can proceed to the end... --- usr.sbin/pkg_add/OpenBSD/PackingList.pm | 15 ++++++++++----- usr.sbin/pkg_add/OpenBSD/Update.pm | 8 ++++++-- usr.sbin/pkg_add/pkg_add | 7 +++++-- 3 files changed, 21 insertions(+), 9 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm index e392d9445c7..85d08e4078a 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.37 2004/11/13 11:48:46 espie Exp $ +# $OpenBSD: PackingList.pm,v 1.38 2004/11/13 12:49:58 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie # @@ -353,16 +353,21 @@ sub from_installation return $plist_cache->{$code}->{$pkgname}; } +sub to_cache +{ + my ($self) = @_; + + $plist_cache->{\&defaultCode}->{$self->pkgname()} = $self; +} + sub to_installation { my ($self) = @_; require OpenBSD::PackageInfo; - my $pkgname = $self->pkgname(); - - $self->tofile(OpenBSD::PackageInfo::installed_contents($pkgname)); - $plist_cache->{\&defaultCode}->{$pkgname} = $self; + $self->tofile(OpenBSD::PackageInfo::installed_contents($self->pkgname())); + $self->to_cache(); } diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm index ed7fb8757cd..85590bceab0 100644 --- a/usr.sbin/pkg_add/OpenBSD/Update.pm +++ b/usr.sbin/pkg_add/OpenBSD/Update.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Update.pm,v 1.28 2004/11/13 11:54:30 espie Exp $ +# $OpenBSD: Update.pm,v 1.29 2004/11/13 12:49:58 espie Exp $ # # Copyright (c) 2004 Marc Espie # @@ -331,7 +331,10 @@ sub save_old_libraries my $stub_name = $stub_list->pkgname(); my $dest = installed_info($stub_name); print "Keeping them in $stub_name\n" if $state->{beverbose}; - unless ($state->{not}) { + if ($state->{not}) { + $stub_list->to_cache(); + $old_plist->to_cache(); + } else { mkdir($dest); my $oldname = $old_plist->pkgname(); open my $comment, '>', $dest.COMMENT; @@ -341,6 +344,7 @@ sub save_old_libraries $stub_list->to_installation(); $old_plist->to_installation(); } + add_installed($stubname); walk_depends_closure($old_plist->pkgname(), $stub_name, $state); } diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index 501e0763cd9..c8bc63feb3a 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.113 2004/11/13 12:33:01 espie Exp $ +# $OpenBSD: pkg_add,v 1.114 2004/11/13 12:49:58 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie # @@ -360,6 +360,7 @@ sub really_add($$) $state->set_pkgname($plist->{replacing}->pkgname()); require OpenBSD::Delete; OpenBSD::Delete::delete_plist($plist->{replacing}, $state); + delete_installed($plist->{replacing}->pkgname()); OpenBSD::ProgressMeter::set_header("$pkgname (installing)"); $state->set_pkgname($pkgname); @@ -411,7 +412,9 @@ sub really_add($$) OpenBSD::Add::borked_installation($plist, $dir); } } - if (!$not) { + if ($not) { + $plist->to_cache(); + } else { my $dest = installed_info($pkgname); OpenBSD::Add::register_installation($dir, $dest, $plist); if (defined $handle->{solved_dependencies}) { -- cgit v1.2.3