[81609] contrib/cpan2port/cpan2port

dports at macports.org dports at macports.org
Tue Aug 2 17:21:13 PDT 2011


Revision: 81609
          http://trac.macports.org/changeset/81609
Author:   dports at macports.org
Date:     2011-08-02 17:21:12 -0700 (Tue, 02 Aug 2011)
Log Message:
-----------
cpan2port: add build_requires dependencies as depends_build, and set
perl5.use_module_build the module has a Build.PL instead of Makefile.PL

Modified Paths:
--------------
    contrib/cpan2port/cpan2port

Modified: contrib/cpan2port/cpan2port
===================================================================
--- contrib/cpan2port/cpan2port	2011-08-03 00:10:19 UTC (rev 81608)
+++ contrib/cpan2port/cpan2port	2011-08-03 00:21:12 UTC (rev 81609)
@@ -118,6 +118,8 @@
     DEBUG::warn("$$info{name} will show deps");
     my $dist = find_dist( $info->{dist_dir}, $info->{module}->get )
         or die "can't find dist";
+    $$info{has_makefile_pl} = (-e "$dist/Makefile.PL");
+    $$info{has_build_pl} = (-e "$dist/Build.PL");
     $$info{depends} = (
         -e "$dist/META.yml"
             ? 'Module::Depends'
@@ -218,11 +220,13 @@
     my $checksums = '';
     my $depends = '';
     my $build_depends = '';
+    my $use_module_build = '';
+    
     if ( exists $$info{depends} ) {
          if ( my $check =  $$info{checksums} ) {
              my @hashes;
              foreach my $key (keys %{ $check }) { push @hashes, "$key ".$$check{$key}; }
-             $checksums = 'checksums   '.join(" \\\n".(' 'x12), at hashes);
+             $checksums = 'checksums           '.join(" \\\n".(' 'x20), at hashes);
          }
 
          if ( my $dep_ref = Huggy::depends_on($info) ) {
@@ -233,10 +237,28 @@
              if (@depends) {
                  $depends = 'depends_lib-append  '.join(" \\\n".(' 'x20), at depends);
              }
+         }
+         if ( my $dep_ref = Huggy::depends_on($info, during=>"build_requires") ) {
+             my @depends = map {
+                 MSG::warn "$$info{name} build_requires $_";
+                 'port:'.Huggy::from_port $_
+             } keys %{ $dep_ref };
+             if (@depends) {
+                 $build_depends = 'depends_build-append '.join(" \\\n".(' 'x21), at depends);
+             }
 
          }
     }
 
+    # If no Makefile.PL is present, maybe we need use_module_build?
+    if (!($$info{has_makefile_pl})) {
+        if ($$info{has_build_pl}) {
+            $use_module_build = "perl5.use_module_build";
+        } else {
+            MSG::warn "Didn't find either Makefile.PL or Build.PL";
+        }
+    }
+
     # Generate text for the portfile.
     # Note that two versions of perl5.setup are generated. The second is for
     # use when the distfile isn't in the customary location (unfortunately
@@ -273,6 +295,7 @@
 
 $depends
 $build_depends
+$use_module_build
 STOP
 
     return $portfile;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110802/a8a0928d/attachment.html>


More information about the macports-changes mailing list