- use the new EU::MM META_MERGE facility instead of generating
authorTony Cook <tony@develop=help.com>
Mon, 31 Aug 2009 13:57:23 +0000 (13:57 +0000)
committerTony Cook <tony@develop=help.com>
Mon, 31 Aug 2009 13:57:23 +0000 (13:57 +0000)
   META.yml from scratch
   https://rt.cpan.org/Ticket/Display.html?id=47888

Changes
Makefile.PL

diff --git a/Changes b/Changes
index 3260878f63c69ef5a01cb7d37184abdb88ea74cc..96098545233a47dfc135c1243bcc247d75773b93 100644 (file)
--- a/Changes
+++ b/Changes
@@ -30,6 +30,10 @@ Bug fixes:
    - reformatting
    - update URLs
 
+ - use the new EU::MM META_MERGE facility instead of generating
+   META.yml from scratch
+   https://rt.cpan.org/Ticket/Display.html?id=47888
+
 Imager 0.67 - 12 Dec 2008
 ===========
 
index ce37cf0f38eef084aadc914d4981454ccf38cf55..2ea3019dcfba5f25b05022e7567c63fa1c085144 100644 (file)
@@ -5,7 +5,6 @@ use Cwd;
 use Config;
 use File::Spec;
 use Getopt::Long;
-use vars qw(%Recommends);
 use ExtUtils::Manifest qw(maniread);
 use vars qw(%formats $VERBOSE $INCPATH $LIBPATH $NOLOG $DEBUG_MALLOC $MANUAL $CFLAGS $LFLAGS $DFLAGS);
 
@@ -158,9 +157,6 @@ my @objs = qw(Imager.o draw.o polygon.o image.o io.o iolayer.o
               bmp.o tga.o color.o fills.o imgdouble.o limits.o hlines.o
               imext.o scale.o rubthru.o render.o paste.o compose.o);
 
-$Recommends{Imager} =
-  { 'Parse::RecDescent' => 0 };
-
 my %opts=(
           'NAME'         => 'Imager',
           'VERSION_FROM' => 'Imager.pm',
@@ -168,7 +164,7 @@ my %opts=(
           'DEFINE'       => "$OSDEF $CFLAGS",
           'INC'          => "$lib_cflags $DFLAGS $F_INC",
           'OBJECT'       => join(' ', @objs, $F_OBJECT),
-          clean          => { FILES=>'testout meta.tmp rubthru.c scale.c conv.c  filters.c gaussian.c render.c rubthru.c' },
+          clean          => { FILES=>'testout rubthru.c scale.c conv.c  filters.c gaussian.c render.c rubthru.c' },
           PM             => gen_PM(),
          PREREQ_PM      => { 'Test::More' => 0.47 },
          );
@@ -189,8 +185,17 @@ if ($MM_ver > 6.06) {
   $opts{AUTHOR} = 'Tony Cook <tony@imager.perl.org>, Arnar M. Hrafnkelsson';
   $opts{ABSTRACT} = 'Perl extension for Generating 24 bit Images';
 }
-if ($MM_ver > 6.10) {
-  $opts{NO_META} = 1;
+
+if ($MM_ver >= 6.46) {
+  $opts{META_MERGE} =
+    {
+     recommends =>
+     {
+      "Parse::RecDescent" => 0
+     },
+     license => "perl",
+     dynamic_config => 1,
+    };
 }
 
 make_imconfig(\@defines);
@@ -198,8 +203,6 @@ make_imconfig(\@defines);
 if ($VERBOSE) { print Dumper(\%opts); }
 mkdir('testout',0777); # since we cannot include it in the archive.
 
-make_metafile(\%opts);
-
 WriteMakefile(%opts);
 
 exit;
@@ -941,70 +944,6 @@ sub gen_PM {
   \%pm;
 }
 
-sub make_metafile {
-  my ($opts) = @_;
-
-  # extract the version
-  my $version = MM->parse_version($opts->{VERSION_FROM})
-    or die "Could not extract version number from $opts->{VERSION_FROM}\n";
-
-  # we don't set this on older EU::MM and it corrupts META.yml
-  # so don't generate it
-  return unless $opts->{AUTHOR};
-
-  my $meta = <<YAML;
---- #YAML:1.0
-name: $opts->{NAME}
-version: $version
-version_from: $opts->{VERSION_FROM}
-author:
-YAML
-  for my $author (split /,\s*/, $opts->{AUTHOR}) {
-    $meta .= " - $author\n";
-  }
-  $meta .= <<YAML;
-abstract: $opts->{ABSTRACT}
-installdirs: site
-YAML
-  if (keys %{$Recommends{$opts->{NAME}}}) {
-    $meta .= "recommends:\n";
-    while (my ($module, $version) = each %{$Recommends{$opts->{NAME}}}) {
-      $meta .= "  $module: $version\n";
-    }
-  }
-  if ($opts->{PREREQ_PM}) {
-    $meta .= "requires:\n";
-    while (my ($module, $version) = each %{$opts->{PREREQ_PM}}) {
-      $meta .= "  $module: $version\n";
-    }
-  }
-  $meta .= <<YAML;
-license: perl
-dynamic_config: 1
-distribution_type: module
-meta-spec:
-  version: 1.3
-  url: http://module-build.sourceforge.net/META-spec-v1.3.html
-generated_by: $opts->{NAME} version $version
-YAML
-  my $save_meta;
-  if (open META, "< META.yml") {
-    my $old_meta = do { local $/; <META> };
-    close META;
-
-    $save_meta = $old_meta ne $meta;
-  }
-  else {
-    ++$save_meta;
-  }
-  if ($save_meta) {
-    print "Updating META.yml\n";
-    open META, "> META.yml" or die "Cannot create META.yml: $!";
-    print META $meta;
-    close META;
-  }
-}
-
 my $home;
 sub _tilde_expand {
   my ($path) = @_;