[perl #50390] [BUG]: Parrot::Configure::Step::Methods::_handle_darwin_for_fink adding superfluous flags

2008-01-30 Thread James Keenan via RT
Resolved.  Patch applied in r23581.


[perl #50390] [BUG]: Parrot::Configure::Step::Methods::_handle_darwin_for_fink adding superfluous flags

2008-01-29 Thread via RT
# New Ticket Created by  James Keenan 
# Please include the string:  [perl #50390]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=50390 


In the course of research on http://rt.perl.org/rt3/Ticket/ 
Display.html?id=50056 tonight, use of Parrot::Configure::Trace  
indicated that auxiliary method _handle_darwin_for_fink was adding  
flag '-L/sw/lib' an unnecessary second time to 'linkflags' and  
'ldflags' at config step auto::gdbm (on my box, at least) and was  
adding '-I/sw/include' an unnecessary second time to 'ccflags'.

The attached patch for lib/Parrot/Configure/Step/Methods.pm corrects  
the problem by checking to see whether these flags are already in the  
attribute before adding them.
Index: lib/Parrot/Configure/Step/Methods.pm
===
--- lib/Parrot/Configure/Step/Methods.pm(revision 25337)
+++ lib/Parrot/Configure/Step/Methods.pm(working copy)
@@ -65,9 +65,21 @@
 my $fink_include_dir= $conf-data-get('fink_include_dir');
 if ( (defined $fink_lib_dir)  (defined $fink_include_dir) ) {
 if ( -f $fink_include_dir/$file ) {
-$conf-data-add( ' ', linkflags = -L$fink_lib_dir );
-$conf-data-add( ' ', ldflags   = -L$fink_lib_dir );
-$conf-data-add( ' ', ccflags   = -I$fink_include_dir );
+#$conf-data-add( ' ', linkflags = -L$fink_lib_dir );
+#$conf-data-add( ' ', ldflags   = -L$fink_lib_dir );
+#$conf-data-add( ' ', ccflags   = -I$fink_include_dir );
+my %intended = (
+linkflags = -L$fink_lib_dir,
+ldflags   = -L$fink_lib_dir,
+ccflags   = -I$fink_include_dir,
+);
+foreach my $flag (keys %intended) {
+my $flagstr = $conf-data-get($flag);
+my @elements = split /\s+/, $flagstr;
+my %seen = map {$_, 1} @elements;
+$conf-data-add( ' ', $flag = $intended{$flag} )
+unless $seen{$intended{$flag}};
+}
 }
 }
 }




Re: [perl #50390] [BUG]: Parrot::Configure::Step::Methods::_handle_darwin_for_fink adding superfluous flags

2008-01-29 Thread Will Coleda
On Jan 29, 2008 9:08 PM, via RT James Keenan
[EMAIL PROTECTED] wrote:
 # New Ticket Created by  James Keenan
 # Please include the string:  [perl #50390]
 # in the subject line of all future correspondence about this issue.
 # URL: http://rt.perl.org/rt3/Ticket/Display.html?id=50390 


 In the course of research on http://rt.perl.org/rt3/Ticket/
 Display.html?id=50056 tonight, use of Parrot::Configure::Trace
 indicated that auxiliary method _handle_darwin_for_fink was adding
 flag '-L/sw/lib' an unnecessary second time to 'linkflags' and
 'ldflags' at config step auto::gdbm (on my box, at least) and was
 adding '-I/sw/include' an unnecessary second time to 'ccflags'.

 The attached patch for lib/Parrot/Configure/Step/Methods.pm corrects
 the problem by checking to see whether these flags are already in the
 attribute before adding them.

 Index: lib/Parrot/Configure/Step/Methods.pm
 ===
 --- lib/Parrot/Configure/Step/Methods.pm(revision 25337)
 +++ lib/Parrot/Configure/Step/Methods.pm(working copy)
 @@ -65,9 +65,21 @@
  my $fink_include_dir= $conf-data-get('fink_include_dir');
  if ( (defined $fink_lib_dir)  (defined $fink_include_dir) ) {
  if ( -f $fink_include_dir/$file ) {
 -$conf-data-add( ' ', linkflags = -L$fink_lib_dir );
 -$conf-data-add( ' ', ldflags   = -L$fink_lib_dir );
 -$conf-data-add( ' ', ccflags   = -I$fink_include_dir );
 +#$conf-data-add( ' ', linkflags = -L$fink_lib_dir );
 +#$conf-data-add( ' ', ldflags   = -L$fink_lib_dir );
 +#$conf-data-add( ' ', ccflags   = -I$fink_include_dir );
 +my %intended = (
 +linkflags = -L$fink_lib_dir,
 +ldflags   = -L$fink_lib_dir,
 +ccflags   = -I$fink_include_dir,
 +);
 +foreach my $flag (keys %intended) {
 +my $flagstr = $conf-data-get($flag);
 +my @elements = split /\s+/, $flagstr;
 +my %seen = map {$_, 1} @elements;
 +$conf-data-add( ' ', $flag = $intended{$flag} )
 +unless $seen{$intended{$flag}};
 +}
  }
  }
  }






Would it make sense to make this the default behavior to
$conf-data-add, or perhaps add another add* variant?


-- 
Will Coke Coleda


[perl #50390] [BUG]: Parrot::Configure::Step::Methods::_handle_darwin_for_fink adding superfluous flags

2008-01-29 Thread James Keenan via RT
On Tue Jan 29 18:14:48 2008, coke wrote:

 
 Would it make sense to make this the default behavior to
 $conf-data-add, or perhaps add another add* variant?
 
 

The same thought occurred to me while I was eating my broccoli!  Great
minds ...

However ...

(a) To do it right, someone would have to survey all current uses of
$conf-data-add to assess the impact of a change; and

(b) That someone is not going to be me, as (i) I already have enough
Parrot projects on my plate, and (ii) I am being mandated to take
vacation days over the next two weeks.

Implication:  We need more cage-cleaners.