From 689495551d134dc7a945d0ed83c8e02a540c0601 Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Mon, 20 Dec 2004 12:56:20 +0000 Subject: store pkgname in handle directly, so that we can delete the packing-list itself when we're done: much lower memory footprint. --- usr.sbin/pkg_add/pkg_add | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index f186589c79a..658cb482612 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.154 2004/12/20 12:32:01 espie Exp $ +# $OpenBSD: pkg_add,v 1.155 2004/12/20 12:56:19 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie # @@ -146,7 +146,7 @@ sub pre_add($$) $errors++; return undef; } - my $pkgname = $plist->pkgname(); + my $pkgname = $handle->{pkgname} = $plist->pkgname(); if ($pkg ne '-') { if (OpenBSD::PackageName::url2pkgname($pkg) ne $pkgname) { print "Package name is not consistent ???\n"; @@ -564,6 +564,10 @@ sub install_package return () unless defined $handle; } + if (defined $state->{installed}->{$handle->{pkgname}}) { + return (); + } + my $plist = $handle->{plist}; if (is_installed($plist->pkgname()) && !$state->{forced}->{installed}) { @@ -577,9 +581,6 @@ sub install_package return (); } } - if (defined $state->{installed}->{$plist->pkgname()}) { - return (); - } if ($plist->has('arch')) { unless ($plist->{arch}->check($state->{arch})) { print "$pkg is not for the right architecture\n"; @@ -628,7 +629,8 @@ sub install_package } really_add($handle, $state); OpenBSD::PkgCfl::register($plist, $state); - $state->{installed}->{$plist->pkgname()} = 1; + delete $handle->{plist}; + $state->{installed}->{$handle->{pkgname}} = 1; return (); } -- cgit v1.2.3