[Bps-public-commit] r18884 - Shipwright/trunk/lib/Shipwright/Source

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Mar 19 23:24:32 EDT 2009


Author: sunnavy
Date: Thu Mar 19 23:24:32 2009
New Revision: 18884

Modified:
   Shipwright/trunk/lib/Shipwright/Source/Base.pm

Log:
replace feature cmd in Makefile.PL which uses Module::Install

Modified: Shipwright/trunk/lib/Shipwright/Source/Base.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Source/Base.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Source/Base.pm	Thu Mar 19 23:24:32 2009
@@ -177,6 +177,7 @@
                 $makefile =~
                   s/^\s*build_requires(?!\w)/shipwright_build_requires/mg;
                 $makefile =~ s/^\s*features(?!\w)/shipwright_features/mg;
+                $makefile =~ s/^\s*feature(?!\w)/shipwright_feature/mg;
                 my $shipwright_makefile = <<'EOF';
 my $shipwright_req = {};
 
@@ -198,6 +199,26 @@
     goto &build_requires;
 }
 
+sub shipwright_feature {
+    my $name = shift;
+    my @mods = @_;
+    for ( my $i = 0 ; $i < @mods ; $i++ ) {
+        if ( $mods[$i] eq '-default' ) {
+            $i++;    # skip the -default value
+        }
+        elsif ( $mods[ $i + 1 ] =~ /^[\d\.]*$/ ) {
+
+            # index $i+1 is a version
+            $shipwright_req->{recommends}{ $mods[$i] } = $mods[ $i + 1 ] || 0;
+            $i++;
+        }
+        else {
+            $shipwright_req->{recommends}{ $mods[$i] } = 0;
+        }
+    }
+    goto &feature;
+}
+
 sub shipwright_features {
     my @args = @_;
     while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) {



More information about the Bps-public-commit mailing list