Update of /cvsroot/fink/fink/perlmod/Fink
In directory vz-cvs-3.sog:/tmp/cvs-serv9937
Modified Files:
ChangeLog PkgVersion.pm
Log Message:
don't need to cache every phase's ENV separately if we know it is not
special-cased...it's not a cache if it's a ton of single-use items
Index: PkgVersion.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/PkgVersion.pm,v
retrieving revision 1.674
retrieving revision 1.675
diff -u -d -r1.674 -r1.675
--- PkgVersion.pm 5 Aug 2011 14:39:23 -0000 1.674
+++ PkgVersion.pm 6 Aug 2011 00:06:51 -0000 1.675
@@ -5011,34 +5011,22 @@
# returns hashref for the ENV to be used while running package scripts
# does not alter global ENV
-# get_env caches (unless in bootstrap mode) the results of _prepare_env
-# _prepare_env is an expensive call that regenerates the actual data
-
sub get_env {
my $self = shift;
- my $phase = shift; # string (selects cache item,
also
- # passed to
_prepare_env)
+ my $phase = shift; # string (selects cache item
special-case)
- if ($self->{_bootstrap}) {
- # don't pollute cache with bootstrap-specific tricks
- return $self->_prepare_env($phase);
+ my $cache = '_script_env'; # standard cache token
+ if (defined $phase && $phase eq 'installing') {
+ # special-case cache token
+ $cache .= "_$phase";
}
- my $cache = defined $phase ? "_script_env_$phase" : '_script_env';
- unless (exists $self->{$cache} and defined $self->{$cache} and ref
$self->{$cache} eq "HASH") {
- # no cache available, regenerate from scratch and cache
- $self->{$cache} = $self->_prepare_env($phase);
+ # just return cached copy if there is one
+ if (not $self->{_bootstrap} and exists $self->{$cache} and defined
$self->{$cache} and ref $self->{$cache} eq "HASH") {
+ # return ref to a copy, so caller changes do not modify cached
value
+ return \%{$self->{$cache}};
}
- # return ref to a copy, so caller changes do not modify cached value
- return \%{$self->{$cache}};
-}
-
-sub _prepare_env {
- my $self = shift;
- my $phase = shift || ''; # if 'installing', don't add
MaxBuildJobs
- # flags NB: not
public or stable feature!
-
# bits of ENV that can be altered by SetENVVAR and NoSetENVVAR in a
.info
# Remember to update Packaging Manual if you change this var list!
our @setable_env_vars = (
@@ -5277,6 +5265,11 @@
}
}
+ # cache a copy so caller's changes to returned val don't touch cached
val
+ if (not $self->{_bootstrap}) {
+ $self->{$cache} = { %script_env };
+ }
+
return \%script_env;
}
Index: ChangeLog
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/ChangeLog,v
retrieving revision 1.1735
retrieving revision 1.1736
diff -u -d -r1.1735 -r1.1736
--- ChangeLog 5 Aug 2011 14:39:23 -0000 1.1735
+++ ChangeLog 6 Aug 2011 00:06:51 -0000 1.1736
@@ -1,5 +1,10 @@
2011-08-05 Daniel Macks <[email protected]>
+ * PkgVersion.pm: get_env shares cache for all $phase that don't
+ have have $phase-specific effects on ENV
+
+2011-08-05 Daniel Macks <[email protected]>
+
* PkgVersion.pm: InstallScript disables UseMaxBuildJobs (separate
get_env result) rather than appending -j1 to MAKEFLAGS
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
Fink-commits mailing list
[email protected]
http://news.gmane.org/gmane.os.apple.fink.cvs