From 6c505bfc6fe9fc24973e6cf53859fbf1559eea8f Mon Sep 17 00:00:00 2001 From: espie Date: Wed, 10 Jan 2007 01:41:29 +0000 Subject: [PATCH] cache mtrees read from dependencies so that we don't parse the same dependency twice across MULTI_PACKAGES. --- infrastructure/install/make-plist | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/infrastructure/install/make-plist b/infrastructure/install/make-plist index 3979bcb63c3..119be72cfaa 100755 --- a/infrastructure/install/make-plist +++ b/infrastructure/install/make-plist @@ -1,5 +1,5 @@ #! /usr/bin/perl -# $OpenBSD: make-plist,v 1.89 2007/01/09 19:40:49 espie Exp $ +# $OpenBSD: make-plist,v 1.90 2007/01/10 01:41:29 espie Exp $ # Copyright (c) 2004-2006 Marc Espie # # Permission to use, copy, modify, and distribute this software for any @@ -57,6 +57,7 @@ my $make = $ENV{MAKE}; my $portsdir = $ENV{PORTSDIR}; +my $cached_tree = {}; sub build_mtree { my ($sub, $deps) = @_; @@ -66,10 +67,16 @@ sub build_mtree for my $pkgpath (split /\s+/, $deps) { next if defined $stripped->{$pkgpath}; $stripped->{$pkgpath} = 1; + if (!defined $cached_tree->{$pkgpath}) { + $cached_tree->{$pkgpath} = {}; + open my $fh, "cd $portsdir && env -i SUBDIR=$pkgpath ECHO_MSG=: $make print-plist |" or die "blech\n"; + augment_mtree($cached_tree->{$pkgpath}, $fh); + close($fh); + } print STDERR "Subpackage $sub: Stripping dirs from $pkgpath\n"; - open my $fh, "cd $portsdir && env -i SUBDIR=$pkgpath ECHO_MSG=: $make print-plist |" or die "blech\n"; - augment_mtree($mtree, $fh); - close($fh); + for my $e (keys %{$cached_tree->{$pkgpath}}) { + $mtree->{$e} = 1; + } } return $mtree; }