[svn:Module-Build] r12650 - in Module-Build/trunk: . lib/Module/Build

[email protected]
Newsgroups perl.module.build.checkins
Message-ID <[email protected]>
Author: dagolden
Date: Sun Mar 29 17:52:52 2009
New Revision: 12650

Modified:
   Module-Build/trunk/   (props changed)
   Module-Build/trunk/lib/Module/Build/Base.pm

Log:
add MYMETA.yml to MANIFEST.SKIP if needed during distcheck and manifest


Modified: Module-Build/trunk/lib/Module/Build/Base.pm
==============================================================================
--- Module-Build/trunk/lib/Module/Build/Base.pm	(original)
+++ Module-Build/trunk/lib/Module/Build/Base.pm	Sun Mar 29 17:52:52 2009
@@ -3106,6 +3106,8 @@
 sub ACTION_distcheck {
   my ($self) = @_;
 
+  $self->_check_mymeta_skip('MANIFEST.SKIP');
+
   require ExtUtils::Manifest;
   local $^W; # ExtUtils::Manifest is not warnings clean.
   my ($missing, $extra) = ExtUtils::Manifest::fullcheck();
@@ -3120,6 +3122,21 @@
   }
 }
 
+sub _check_mymeta_skip {
+  my $self = shift;
+  my $maniskip = shift || 'MANIFEST.SKIP';
+
+  require ExtUtils::Manifest;
+  local $^W; # ExtUtils::Manifest is not warnings clean.
+
+  my $skip_check = ExtUtils::Manifest::maniskip($maniskip);
+  my $mymetafile = $self->mymetafile;
+  if ( ! $skip_check->( $mymetafile ) ) {
+    $self->log_warn("File '$maniskip' does not include '$mymetafile'. Adding it now.\n");
+    $self->_append_maniskip("^$mymetafile\$", $maniskip);
+  }
+}
+
 sub _add_to_manifest {
   my ($self, $manifest, $lines) = @_;
   $lines = [$lines] unless ref $lines;
@@ -3350,6 +3367,19 @@
       });
 }
 
+
+sub _append_maniskip {
+  my $self = shift;
+  my $skip = shift;
+  my $file = shift || 'MANIFEST.SKIP';
+  return unless defined $skip && length $skip;
+  my $fh = IO::File->new(">> $file")
+    or die "Can't open $file: $!";
+
+  print $fh "$skip\n";
+  $fh->close();
+}
+
 sub _write_default_maniskip {
   my $self = shift;
   my $file = shift || 'MANIFEST.SKIP';
@@ -3421,6 +3451,9 @@
   my ($self) = @_;
 
   my $maniskip = 'MANIFEST.SKIP';
+
+  $self->_check_mymeta_skip( $maniskip );
+
   unless ( -e 'MANIFEST' || -e $maniskip ) {
     $self->log_warn("File '$maniskip' does not exist: Creating a default '$maniskip'\n");
     $self->_write_default_maniskip($maniskip);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.