summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-06-07 12:57:34 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-06-07 12:57:34 +0000
commitdd2493287af9086596bc35e6c6bc6eb4967904c4 (patch)
tree223e027554ca978b891c70561e659ed8d126c2ab /usr.sbin/pkg_add
parenta2f0f8d9d590394b8bf720bb61d96d766410866b (diff)
make compute_size explicit. That way, we can do it once, at the right
moment.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Replace.pm4
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Vstat.pm7
-rw-r--r--usr.sbin/pkg_add/pkg_add9
3 files changed, 13 insertions, 7 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Replace.pm b/usr.sbin/pkg_add/OpenBSD/Replace.pm
index 13fef63eb67..68fa785b20a 100644
--- a/usr.sbin/pkg_add/OpenBSD/Replace.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Replace.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Replace.pm,v 1.35 2007/06/06 15:31:06 espie Exp $
+# $OpenBSD: Replace.pm,v 1.36 2007/06/07 12:57:33 espie Exp $
#
# Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org>
#
@@ -427,8 +427,6 @@ sub save_old_libraries
print "Libraries to keep: ", join(",", sort(keys %$libs)), "\n"
if $state->{beverbose};
($o->{plist}, my $stub_list) = split_libs($o->{plist}, $libs);
- $o->{totsize} = $o->{plist}->compute_size;
-
my $stub_name = $stub_list->pkgname;
my $dest = installed_info($stub_name);
print "Keeping them in $stub_name\n" if $state->{beverbose};
diff --git a/usr.sbin/pkg_add/OpenBSD/Vstat.pm b/usr.sbin/pkg_add/OpenBSD/Vstat.pm
index 0ec95fa5cde..e89a781f071 100644
--- a/usr.sbin/pkg_add/OpenBSD/Vstat.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Vstat.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Vstat.pm,v 1.37 2007/06/06 15:36:32 espie Exp $
+# $OpenBSD: Vstat.pm,v 1.38 2007/06/07 12:57:33 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -433,6 +433,11 @@ sub validate_plists
OpenBSD::Error::Fatal "fatal issues in ", $self->print;
}
OpenBSD::Vstat::synchronize();
+}
+
+sub compute_size
+{
+ my ($self, $state) = @_;
for my $h ($self->older_to_do, $self->newer) {
$h->{totsize} = $h->{plist}->compute_size;
}
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index 9b9574d3ed5..1d238aaba55 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.311 2007/06/05 23:19:00 espie Exp $
+# $OpenBSD: pkg_add,v 1.312 2007/06/07 12:57:33 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -367,10 +367,13 @@ sub really_add
if ($replacing) {
require OpenBSD::Replace;
+ OpenBSD::Replace::save_old_libraries($set, $state);
+ }
- $state->progress->set_header("$pkgname (extracting)");
+ $set->compute_size;
- OpenBSD::Replace::save_old_libraries($set, $state);
+ if ($replacing) {
+ $state->progress->set_header("$pkgname (extracting)");
try {
OpenBSD::Replace::perform_extraction($handle, $state);