summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-05-29 14:52:49 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-05-29 14:52:49 +0000
commit8c807d6c9d94f750e87fa7bdce3aaa3266c17347 (patch)
tree54b55637a9e435059d91f0419e3d972c70e84fdb /usr.sbin/pkg_add
parent2d7c5d871344801948f27bb9b5396c0e00cb15e9 (diff)
move code a bit, in preparation for multiple handles in an UpdateSet.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/pkg_add23
1 files changed, 11 insertions, 12 deletions
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index e5edc320891..61dc52f43eb 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.289 2007/05/29 14:39:03 espie Exp $
+# $OpenBSD: pkg_add,v 1.290 2007/05/29 14:52:48 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -317,14 +317,14 @@ sub failed_install
sub really_add
{
my ($set, $state) = @_;
+
+ for my $h ($set->newer) {
+ $h->{plist}->set_infodir($h->{location}->info);
+ }
my $handle = $set->handle;
- my $location = $handle->{location};
- my $destdir = $state->{destdir};
my $plist = $handle->{plist};
- $plist->set_infodir($location->info);
my $pkgname = $handle->{pkgname};
my $errors = 0;
- $state->{archive} = $location;
$state->set_pkgname($pkgname);
$set->setup_header($state);
@@ -344,13 +344,8 @@ sub really_add
$set->validate_plists($state);
- my $totsize = $plist->{totsize};
-
- if (!defined $location) {
- Fatal "Archive in $pkgname broken";
- }
- $ENV{'PKG_PREFIX'} = $plist->localbase;
+ $ENV{'PKG_PREFIX'} = $state->{localbase};
my $handler = sub {
$state->{interrupted} = shift;
@@ -370,6 +365,8 @@ sub really_add
my $donesize = 0;
$plist->{done} = [];
+ my $totsize = $handle->{totsize};
+ $state->{archive} = $handle->{location};
for my $item (@{$plist->{items}}) {
try {
$item->extract($state);
@@ -440,6 +437,8 @@ sub really_add
do_script($plist, INSTALL, $state, "PRE-INSTALL");
}
+ my $totsize = $handle->{totsize};
+ $state->{archive} = $handle->{location};
my $donesize = 0;
$state->{end_faked} = 0;
for my $item (@{$plist->{groups}}, @{$plist->{users}}, @{$plist->{items}}) {
@@ -466,7 +465,7 @@ sub really_add
}
try {
- $location->finish_and_close; }
+ $handle->{location}->finish_and_close; }
catchall {
Warn $_;
$errors++;