Skip to content

Commit

Permalink
add MYMETA.yml to MANIFEST.SKIP if needed during distcheck and manifest
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.perl.org/modules/Module-Build/trunk@12650 50811bd7-b8ce-0310-adc1-d9db26280581
  • Loading branch information
xdg committed Mar 30, 2009
1 parent 1fc3c41 commit fb7414e
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions lib/Module/Build/Base.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3106,6 +3106,8 @@ sub ACTION_dist {
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();
Expand All @@ -3120,6 +3122,21 @@ sub ACTION_distcheck {
}
}

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;
Expand Down Expand Up @@ -3350,6 +3367,19 @@ sub ACTION_disttest {
});
}


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';
Expand Down Expand Up @@ -3421,6 +3451,9 @@ sub ACTION_manifest {
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);
Expand Down

0 comments on commit fb7414e

Please sign in to comment.