Update of /cvsroot/fink/fink/perlmod/Fink
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22755

Modified Files:
        ChangeLog PkgVersion.pm 
Log Message:
Use local() instead of temp var when we need to swap %ENV temporarily
to prevent runtime warning from certain versions of perl (buggily
sets undef in env then complains when assigning undef back into %ENV).


Index: PkgVersion.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/PkgVersion.pm,v
retrieving revision 1.486
retrieving revision 1.487
diff -u -d -r1.486 -r1.487
--- PkgVersion.pm       21 Oct 2005 19:20:09 -0000      1.486
+++ PkgVersion.pm       24 Oct 2005 21:55:36 -0000      1.487
@@ -4428,11 +4428,8 @@
        # get full environment: parse what a shell has after sourcing init.sh
        # script when starting with the (purified) ENV we have so far
        if (-r "$basepath/bin/init.sh") {
-               my %temp_ENV = %ENV;  # need to activatescript_env, so save ENV 
for later
-
-               %ENV = %script_env;
+               local %ENV = %script_env;
                my @vars = `sh -c ". $basepath/bin/init.sh ; /usr/bin/env"`;
-               %ENV = %temp_ENV;     # restore previous ENV
                chomp @vars;
                %script_env = map { split /=/,$_,2 } @vars;
                delete $script_env{_};  # artifact of how we fetch init.sh 
results
@@ -4538,20 +4535,18 @@
        my $phase = shift;
        my $no_expand = shift || 0;
        my $nonroot_okay = shift || 0;
-       my ($script_env, %env_bak);
-
-       my $notifier = Fink::Notify->new();
 
        # Expand percent shortcuts
        $script = &expand_percent($script, $self->{_expand}, 
$self->get_info_filename." $phase script") unless $no_expand;
 
-       # Run the script
-       $script_env = $self->get_env();# fetch script environment
-       %env_bak = %ENV;        # backup existing environment
-       %ENV = %$script_env;    # run under modified environment
-
-       my $result = &execute($script, nonroot_okay=>$nonroot_okay);
+       # Run the script under the modified environment
+       my $result;
+       {
+               local %ENV = %{$self->get_env()};
+               $result = &execute($script, nonroot_okay=>$nonroot_okay);
+       }
        if ($result) {
+               my $notifier = Fink::Notify->new();
                my $error = "phase " . $phase . ": " . $self->get_fullname()." 
failed";
                $notifier->notify(event => 'finkPackageBuildFailed', 
description => $error);
                if ($self->has_param('maintainer')) {
@@ -4564,7 +4559,6 @@
                }
                die $error . "\n";
        }
-       %ENV = %env_bak;        # restore previous environment
 }
 
 

Index: ChangeLog
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/ChangeLog,v
retrieving revision 1.1176
retrieving revision 1.1177
diff -u -d -r1.1176 -r1.1177
--- ChangeLog   24 Oct 2005 19:30:11 -0000      1.1176
+++ ChangeLog   24 Oct 2005 21:55:36 -0000      1.1177
@@ -1,5 +1,11 @@
 2005-10-24  Daniel Macks  <[EMAIL PROTECTED]>
 
+       * PkgVersion.pm: Use local() instead of temp var when we need to
+       swap %ENV temporarily to prevent runtime warning from certain
+       versions of perl.
+
+2005-10-24  Daniel Macks  <[EMAIL PROTECTED]>
+
        * Checksum.pm: get_all_checksums: don't crash if a back-end isn't
        implemented.
 



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
Fink-commits mailing list
Fink-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fink-commits

Reply via email to