Author: dagolden
Date: Fri Sep 11 10:08:39 2009
New Revision: 13310

Modified:
   Module-Build/trunk/Changes
   Module-Build/trunk/lib/Module/Build/PPMMaker.pm
   Module-Build/trunk/t/ppm.t
   Module-Build/trunk/t/runthrough.t

Log:
update PPM generation to v4

Modified: Module-Build/trunk/Changes
==============================================================================
--- Module-Build/trunk/Changes  (original)
+++ Module-Build/trunk/Changes  Fri Sep 11 10:08:39 2009
@@ -7,6 +7,9 @@
    argument for modification.  The method now takes no arguments and just
    returns a hash reference of metadata. [David Golden]
 
+ Bug fixes:
+ - Updated PPM generation to PPM v4 (RT#49600) [Olivier Mengue]
+
  Other:
  - Replaced use of YAML.pm with YAML::Tiny; Module::Build::YAML is now
    based on YAML::Tiny as well [David Golden]

Modified: Module-Build/trunk/lib/Module/Build/PPMMaker.pm
==============================================================================
--- Module-Build/trunk/lib/Module/Build/PPMMaker.pm     (original)
+++ Module-Build/trunk/lib/Module/Build/PPMMaker.pm     Fri Sep 11 10:08:39 2009
@@ -35,7 +35,6 @@
     my $method = "dist_$info";
     $dist{$info} = $build->$method() or die "Can't determine distribution's 
$info\n";
   }
-  $dist{version} = $self->_ppd_version($dist{version});
 
   $self->_simple_xml_escape($_) foreach $dist{abstract}, @{$dist{author}};
 
@@ -43,21 +42,17 @@
   # various licenses
   my $ppd = <<"PPD";
 <SOFTPKG NAME=\"$dist{name}\" VERSION=\"$dist{version}\">
-    <TITLE>$dist{name}</TITLE>
     <ABSTRACT>$dist{abstract}</ABSTRACT>
 @{[ join "\n", map "    <AUTHOR>$_</AUTHOR>", @{$dist{author}} ]}
     <IMPLEMENTATION>
 PPD
 
-  # TODO: We could set <IMPLTYPE VALUE="PERL" /> or maybe
-  # <IMPLTYPE VALUE="PERL/XS" /> ???
-
   # We don't include recommended dependencies because PPD has no way
   # to distinguish them from normal dependencies.  We don't include
   # build_requires dependencies because the PPM installer doesn't
   # build or test before installing.  And obviously we don't include
   # conflicts either.
-  
+
   foreach my $type (qw(requires)) {
     my $prereq = $build->$type();
     while (my ($modname, $spec) = each %$prereq) {
@@ -74,27 +69,18 @@
         }
       }
 
-      # Another hack - dependencies are on modules, but PPD expects
-      # them to be on distributions (I think).
-      $modname =~ s/::/-/g;
-
-      $ppd .= sprintf(<<'EOF', $modname, $self->_ppd_version($min_version));
-        <DEPENDENCY NAME="%s" VERSION="%s" />
-EOF
+      # PPM4 spec requires a '::' for top level modules
+      $modname .= '::' unless $modname =~ /::/;
 
+      $ppd .= qq!        <REQUIRE NAME="$modname" VERSION="$min_version" />\n!;
     }
   }
 
   # We only include these tags if this module involves XS, on the
-  # assumption that pure Perl modules will work on any OS.  PERLCORE,
-  # unfortunately, seems to indicate that a module works with _only_
-  # that version of Perl, and so is only appropriate when a module
-  # uses XS.
+  # assumption that pure Perl modules will work on any OS.
   if (keys %{$build->find_xs_files}) {
     my $perl_version = $self->_ppd_version($build->perl_version);
-    $ppd .= sprintf(<<'EOF', $perl_version, $^O, 
$self->_varchname($build->config) );
-        <PERLCORE VERSION="%s" />
-        <OS NAME="%s" />
+    $ppd .= sprintf(<<'EOF', $self->_varchname($build->config) );
         <ARCHITECTURE NAME="%s" />
 EOF
   }
@@ -114,8 +100,8 @@
   my $ppd_file = "$dist{name}.ppd";
   my $fh = IO::File->new(">$ppd_file")
     or die "Cannot write to $ppd_file: $!";
-  
-  $fh->binmode(":utf8") 
+
+  $fh->binmode(":utf8")
     if $fh->can('binmode') && $] >= 5.008 && $Config{useperlio};
   print $fh $ppd;
   close $fh;

Modified: Module-Build/trunk/t/ppm.t
==============================================================================
--- Module-Build/trunk/t/ppm.t  (original)
+++ Module-Build/trunk/t/ppm.t  Fri Sep 11 10:08:39 2009
@@ -94,13 +94,10 @@
 # do a strict string comparison, but absent an XML parser it's the
 # best we can do.
 is $ppd, <<"---";
-<SOFTPKG NAME="$dist_filename" VERSION="0,01,0,0">
-    <TITLE>@{[$dist->name]}</TITLE>
+<SOFTPKG NAME="$dist_filename" VERSION="0.01">
     <ABSTRACT>Perl extension for blah blah blah</ABSTRACT>
     <AUTHOR>A. U. Thor, [email protected]</AUTHOR>
     <IMPLEMENTATION>
-        <PERLCORE VERSION="$perl_version" />
-        <OS NAME="$^O" />
         <ARCHITECTURE NAME="$varchname" />
         <CODEBASE HREF="/path/to/codebase-xs" />
     </IMPLEMENTATION>

Modified: Module-Build/trunk/t/runthrough.t
==============================================================================
--- Module-Build/trunk/t/runthrough.t   (original)
+++ Module-Build/trunk/t/runthrough.t   Fri Sep 11 10:08:39 2009
@@ -170,12 +170,11 @@
   # do a strict string comparison, but absent an XML parser it's the
   # best we can do.
   is $ppd, <<'EOF';
-<SOFTPKG NAME="Simple" VERSION="0,01,0,0">
-    <TITLE>Simple</TITLE>
+<SOFTPKG NAME="Simple" VERSION="0.01">
     <ABSTRACT>Perl extension for blah blah blah</ABSTRACT>
     <AUTHOR>A. U. Thor, [email protected]</AUTHOR>
     <IMPLEMENTATION>
-        <DEPENDENCY NAME="File-Spec" VERSION="0,0,0,0" />
+        <REQUIRE NAME="File::Spec" VERSION="0" />
         <CODEBASE HREF="/path/to/codebase" />
     </IMPLEMENTATION>
 </SOFTPKG>

Reply via email to