diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-12-20 12:56:20 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-12-20 12:56:20 +0000 |
commit | 689495551d134dc7a945d0ed83c8e02a540c0601 (patch) | |
tree | b7794c21114bb2a706459b3410015ec49f3c7f82 /usr.sbin | |
parent | 8fd97d79dfb1bb6ac06f250054adc2fd0567e84f (diff) |
store pkgname in handle directly, so that we can delete the packing-list
itself when we're done: much lower memory footprint.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 14 |
1 files changed, 8 insertions, 6 deletions
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 <espie@openbsd.org> # @@ -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 (); } |