r76968 - in /trunk/dh-make-perl: Build.PL TODO debian/changelog debian/control lib/DhMakePerl/Command/Packaging.pm

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Sat Jul 2 20:56:48 UTC 2011


Author: dmn
Date: Sat Jul  2 20:56:45 2011
New Revision: 76968

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=76968
Log:
Use CPAN::Meta for processing META.* files, adding support for META.json.

Modified:
    trunk/dh-make-perl/Build.PL
    trunk/dh-make-perl/TODO
    trunk/dh-make-perl/debian/changelog
    trunk/dh-make-perl/debian/control
    trunk/dh-make-perl/lib/DhMakePerl/Command/Packaging.pm

Modified: trunk/dh-make-perl/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/Build.PL?rev=76968&op=diff
==============================================================================
--- trunk/dh-make-perl/Build.PL (original)
+++ trunk/dh-make-perl/Build.PL Sat Jul  2 20:56:45 2011
@@ -14,6 +14,7 @@
         'Array::Unique'             => 0,
         'Carp'                      => 0,
         'CPAN'                      => 0,
+        'CPAN::Meta'                => 0,
         'Cwd'                       => 0,
         'Dpkg'                      => 0,
         'Dpkg::Source::Package'     => 0,

Modified: trunk/dh-make-perl/TODO
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/TODO?rev=76968&op=diff
==============================================================================
--- trunk/dh-make-perl/TODO (original)
+++ trunk/dh-make-perl/TODO Sat Jul  2 20:56:45 2011
@@ -28,6 +28,3 @@
 * Really minor issue. The AptContents.t test can be thrown off if the contents
   directory has stuff lying around from a failed run. ~periapt
 * Add a switch for "app" (foo-bar) vs. "lib" (libfoo-bar-perl) packages?
-* process_meta in lib/DhMakePerl/Command/Packaging.pm only checks for META.yml, and not
-  META.json. And there are more moderm modules to deal with both in the meantime (CPAN::Meta*)
-  See also #589946.

Modified: trunk/dh-make-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/debian/changelog?rev=76968&op=diff
==============================================================================
--- trunk/dh-make-perl/debian/changelog (original)
+++ trunk/dh-make-perl/debian/changelog Sat Jul  2 20:56:45 2011
@@ -29,6 +29,7 @@
   * apply a patch from Manfred Stock fixing AptContents not to miss
     alternative dependencies when a given module is found in more than one
     package. Closes: #622852
+  * Use CPAN::Meta for processing META.* files, adding support for META.json.
 
  -- Salvatore Bonaccorso <carnil at debian.org>  Wed, 25 May 2011 16:04:40 +0200
 

Modified: trunk/dh-make-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/debian/control?rev=76968&op=diff
==============================================================================
--- trunk/dh-make-perl/debian/control (original)
+++ trunk/dh-make-perl/debian/control Sat Jul  2 20:56:45 2011
@@ -7,6 +7,7 @@
  libapt-pkg-perl,
  libarray-unique-perl,
  libclass-accessor-perl,
+ libcpan-meta-perl | perl (>= 5.14),
  libdpkg-perl,
  libemail-address-perl,
  libemail-date-format-perl,
@@ -51,6 +52,7 @@
  libapt-pkg-perl,
  libarray-unique-perl,
  libclass-accessor-perl,
+ libcpan-meta-perl | perl (>= 5.14),
  libdpkg-perl,
  libemail-address-perl,
  libemail-date-format-perl,

Modified: trunk/dh-make-perl/lib/DhMakePerl/Command/Packaging.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/DhMakePerl/Command/Packaging.pm?rev=76968&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl/Command/Packaging.pm (original)
+++ trunk/dh-make-perl/lib/DhMakePerl/Command/Packaging.pm Sat Jul  2 20:56:45 2011
@@ -22,6 +22,7 @@
 use Array::Unique;
 use Carp qw(confess);
 use CPAN ();
+use CPAN::Meta;
 use Cwd qw( getcwd );
 use Debian::Control::FromCPAN;
 use Debian::Dependencies;
@@ -158,38 +159,30 @@
 sub process_meta {
     my ($self) = @_;
 
-    my $file = $self->main_file('META.yml');
-
-    # META.yml non-existent?
-    unless ( -f $file ) {
-        $self->meta({});
-        return;
-    }
+    $self->meta({});
 
     # Command line option nometa causes this function not to be run
     if( $self->cfg->nometa ) {
-        $self->meta({});
         return;
     }
 
-    my $yaml;
-
-    # YAML::LoadFile dies when it cannot properly parse a file - catch it in
-    # an eval, and if it dies, return -again- just an empty hashref.
-    eval { $yaml = YAML::LoadFile($file); };
-    if ($@) {
-        print "Error parsing $file - Ignoring it.\n";
-        print "Please notify module upstream maintainer.\n";
-        $yaml = {};
-    }
-
-    if (ref $yaml ne 'HASH') {
-        print "$file does not contain a hash - Ignoring it\n";
-        $yaml = {};
-    }
-
-    # Returns a simple hashref with all the keys/values defined in META.yml
-    $self->meta($yaml);
+    my $meta = $self->main_file('META.json');
+    if ( -e $meta ) {
+        print "Using META.json\n" if $self->cfg->verbose;
+    }
+    else {
+        $meta = $self->main_file('META.yml');
+        if ( -e $meta ) {
+            print "Using META.yml\n" if $self->cfg->verbose;
+        }
+        else {
+            print "WARNING: Neither META.json nor META.yml was found\n";
+            return;
+        }
+    }
+
+    $meta = CPAN::Meta->load_file($meta);
+    $self->meta( $meta->as_struct );
 }
 
 sub set_package_name {




More information about the Pkg-perl-cvs-commits mailing list