Author: jkeenan
Date: Sun Mar 4 15:32:24 2007
New Revision: 17339
Added:
branches/buildtools/lib/Parrot/Distribution/
branches/buildtools/lib/Parrot/Distribution/ManifestSkip.pm
Modified:
branches/buildtools/lib/Parrot/Distribution.pm
branches/buildtools/t/distro/manifest_skip.t
branches/buildtools/tools/dev/gen_manifest_skip.pl
Log:
Refactoring of Parrot::Distribution::gen_manifest_skip() out of
Parrot::Distribution into Parrot::Distribution::ManifestSkip. This entailed
change in the way tools/dev/gen_manifest_skip.pl and t/distro/manifest_skip.t
called gen_manifest_skip().
Modified: branches/buildtools/lib/Parrot/Distribution.pm
==============================================================================
--- branches/buildtools/lib/Parrot/Distribution.pm (original)
+++ branches/buildtools/lib/Parrot/Distribution.pm Sun Mar 4 15:32:24 2007
@@ -32,11 +32,11 @@
use strict;
use warnings;
-use Data::Dumper;
use ExtUtils::Manifest;
use File::Spec;
-use Parrot::Revision;
-use Parrot::Configure::Step qw(capture_output);
+use lib ( "lib" );
+# use Parrot::Revision;
+# use Parrot::Configure::Step qw(capture_output);
use Parrot::Docs::Directory;
use base qw(Parrot::Docs::Directory);
@@ -697,51 +697,52 @@
}
-=item C<gen_manifest_skip>
-
-Query the svn:ignore property and generate the lines for MANIFEST.SKIP.
-
-=cut
-
-sub gen_manifest_skip {
-
- # manicheck.pl is probably only useful for checked out revisions
- # Checkout is done either with svn or svk
- my $svn_cmd;
- if ( defined $Parrot::Revision::svn_entries
- && $Parrot::Revision::svn_entries =~ m/\.svn/ )
- {
- $svn_cmd = 'svn';
- }
- else {
- $svn_cmd = 'svk';
- }
-
- # Find all directories in the Parrot distribution
- my %dir_list = map {
- my $dir = ( File::Spec->splitpath($_) )[1];
- $dir =~ s!\.svn/$!!;
- $dir => 1
- } keys %{ ExtUtils::Manifest::manifind() };
- my @skip; # regular expressions for files to skip
- foreach my $dir ( sort keys %dir_list ) {
- next if $dir =~ m/\.svn/;
- next if ( $dir && !-d $dir );
-
- my $patterns = capture_output("$svn_cmd propget svn:ignore $dir");
-
- # TODO: escape chars that are special in regular expressions
- push @skip, qq{# generated from svn:ignore of '$dir'}, map {
- my $end = $dir_list{ $dir . $_ } ? '$' : '/'; # ignore file or
dir
- s/\./\\./g; # . is simply a
dot
- s/\*/.*/g; # * is any amount
of chars
- "^${dir}${_}\$", # SVN globs are
specific to a dir
- "^${dir}${_}/", # SVN globs are
specific to a dir
- } split( /\n/, $patterns );
- }
-
- return [EMAIL PROTECTED];
-}
+#=item C<gen_manifest_skip>
+#
+#Query the svn:ignore property and generate the lines for MANIFEST.SKIP.
+#
+#=cut
+#
+#sub gen_manifest_skip {
+#
+# # manicheck.pl is probably only useful for checked out revisions
+# # Checkout is done either with svn or svk
+# my $svn_cmd;
+# if ( defined $Parrot::Revision::svn_entries
+# && $Parrot::Revision::svn_entries =~ m/\.svn/ )
+# {
+# $svn_cmd = 'svn';
+# }
+# else {
+# $svn_cmd = 'svk';
+# }
+#
+# # Find all directories in the Parrot distribution
+# my %dir_list = map {
+# my $dir = ( File::Spec->splitpath($_) )[1];
+# $dir =~ s!\.svn/$!!;
+# $dir => 1
+# } keys %{ ExtUtils::Manifest::manifind() };
+# my @skip; # regular expressions for files to skip
+# foreach my $dir ( sort keys %dir_list ) {
+# next if $dir =~ m/\.svn/;
+# next if ( $dir && !-d $dir );
+#
+# my $patterns = capture_output("$svn_cmd propget svn:ignore $dir");
+#
+# # TODO: escape chars that are special in regular expressions
+# push @skip, qq{# generated from svn:ignore of '$dir'}, map {
+# my $end = $dir_list{ $dir . $_ } ? '$' : '/';
+# # ignore file or dir
+# s/\./\\./g; # . is simply a dot
+# s/\*/.*/g; # * is any amount of chars
+# "^${dir}${_}\$", # SVN globs are specific to a dir
+# "^${dir}${_}/", # SVN globs are specific to a dir
+# } split( /\n/, $patterns );
+# }
+#
+# return [EMAIL PROTECTED];
+#}
=item C<generated_files>
Added: branches/buildtools/lib/Parrot/Distribution/ManifestSkip.pm
==============================================================================
--- (empty file)
+++ branches/buildtools/lib/Parrot/Distribution/ManifestSkip.pm Sun Mar 4
15:32:24 2007
@@ -0,0 +1,132 @@
+# Copyright (C) 2007, The Perl Foundation.
+# $Id: Distribution.pm 17319 2007-03-04 01:35:40Z jkeenan $
+
+=head1 NAME
+
+Parrot::Distribution::ManifestSkip - Functionality to generate MANIFEST.SKIP
+
+=head1 SYNOPSIS
+
+ use Parrot::Distribution::ManifestSkip qw( gen_manifest_skip );
+
+ $manifest_skip_lines_ref = gen_manifest_skip();
+
+=head1 DESCRIPTION
+
+Parrot::Distribution::ManifestSkip exports on request a single subroutine,
+F<gen_manifest_skip>(). This subroutine's principal use is in
+F<tools/dev/gen_manifest_skip.pl>.
+
+=head2 C<gen_manifest_skip()>
+
+=over 4
+
+B<Purpose:> Gather the names of files needed to populate MANIFEST.SKIP.
+
+B<Arguments:> None.
+
+B<Return Value:> Reference to an array holding the names of files needed to
+populate MANIFEST.SKIP.
+
+B<Comment:>
+
+This subroutine queries the svn:ignore property and generates the lines
+for MANIFEST.SKIP.
+
+=back
+
+=head2 Note
+
+This is B<not> a subclass of Parrot::Distribution. The subroutine the package
+exports formerly resided in that package but has been refactored into this
+package because it was not a true Parrot::Distribution method and because its
+purpose was quite distinct from the other Parrot::Distribution methods.
+
+=head1 PREREQUISITES
+
+=over 4
+
+=item * Perl 5
+
+=over 4
+
+=item * ExtUtils::Manifest
+
+=item * File::Spec
+
+=back
+
+=item * Parrot
+
+=over 4
+
+=item * Parrot::Configure::Step
+
+=item * Parrot::Revision
+
+=back
+
+=back
+
+=head1 AUTHOR
+
+=head1 SEE ALSO
+
+Parrot::Distribution. F<tools/dev/gen_manifest_skip.pl>.
+
+=cut
+
+package Parrot::Distribution::ManifestSkip;
+use strict;
+use ExtUtils::Manifest;
+use File::Spec;
+use lib qw( lib );
+use Parrot::Configure::Step qw(capture_output);
+use Parrot::Revision;
+our (@ISA, @EXPORT_OK);
[EMAIL PROTECTED] = qw( Exporter );
[EMAIL PROTECTED] = qw( gen_manifest_skip );
+
+
+sub gen_manifest_skip {
+
+ # manicheck.pl is probably only useful for checked out revisions
+ # Checkout is done either with svn or svk
+ my $svn_cmd;
+ if ( defined $Parrot::Revision::svn_entries
+ && $Parrot::Revision::svn_entries =~ m/\.svn/ )
+ {
+ $svn_cmd = 'svn';
+ }
+ else {
+ $svn_cmd = 'svk';
+ }
+
+ # Find all directories in the Parrot distribution
+ my %dir_list = map {
+ my $dir = ( File::Spec->splitpath($_) )[1];
+ $dir =~ s!\.svn/$!!;
+ $dir => 1
+ } keys %{ ExtUtils::Manifest::manifind() };
+ my @skip; # regular expressions for files to skip
+ foreach my $dir ( sort keys %dir_list ) {
+ next if $dir =~ m/\.svn/;
+ next if ( $dir && !-d $dir );
+
+ my $patterns = capture_output("$svn_cmd propget svn:ignore $dir");
+
+ # TODO: escape chars that are special in regular expressions
+ push @skip, qq{# generated from svn:ignore of '$dir'}, map {
+ my $end = $dir_list{ $dir . $_ } ? '$' : '/';
+ # ignore file or dir
+ s/\./\\./g; # . is simply a dot
+ s/\*/.*/g; # * is any amount of chars
+ "^${dir}${_}\$", # SVN globs are specific to a dir
+ "^${dir}${_}/", # SVN globs are specific to a dir
+ } split( /\n/, $patterns );
+ }
+
+ return [EMAIL PROTECTED];
+}
+
+1;
Modified: branches/buildtools/t/distro/manifest_skip.t
==============================================================================
--- branches/buildtools/t/distro/manifest_skip.t (original)
+++ branches/buildtools/t/distro/manifest_skip.t Sun Mar 4 15:32:24 2007
@@ -10,7 +10,8 @@
use Data::Dumper;
use File::Find qw(find);
use ExtUtils::Manifest;
-use Parrot::Distribution;
+# use Parrot::Distribution;
+use Parrot::Distribution::ManifestSkip qw( gen_manifest_skip );
use Parrot::Revision;
=head1 NAME
@@ -39,18 +40,18 @@
diag "this may take a while...";
- my $dist = Parrot::Distribution->new();
- my @from_svn = grep { $_ && $_ !~ m/^#/ } @{ $dist->gen_manifest_skip() };
+# my $dist = Parrot::Distribution->new();
+# my @from_svn = grep { $_ && $_ !~ m/^#/ } @{ $dist->gen_manifest_skip() };
+ my @from_svn = grep { $_ && $_ !~ m/^#/ } @{ gen_manifest_skip() };
unshift @from_svn, '\B\.svn\b', '^debian$', '^debian/'; # added in
gen_manifest_skip.pl
open( *MANIFEST_SKIP, '<', $manifest_skip ) or die "Can't open
$manifest_skip: $!";
my @from_manifest_skip = grep { $_ ne "\n" && $_ !~ m/^#/ }
(<*MANIFEST_SKIP>);
close(*MANIFEST_SKIP);
chomp(@from_manifest_skip);
- my ( $svn_miss, $manifest_skip_miss ) = list_diff( [EMAIL PROTECTED],
[EMAIL PROTECTED] );
+ my ( $svn_miss, $manifest_skip_miss ) =
+ list_diff( [EMAIL PROTECTED], [EMAIL PROTECTED] );
- # print Dumper( $svn_miss, $manifest_skip_miss, [EMAIL PROTECTED], [EMAIL
PROTECTED]);
-
- local $" = "\n\t";
+ local $" = "\n\t"; # $"
ok( [EMAIL PROTECTED], 'all files in MANIFEST.SKIP are also in svn:ignore'
)
or diag("File in MANIFEST.SKIP but not ignored by SVN:[EMAIL
PROTECTED]");
@@ -58,8 +59,6 @@
or diag("Files ignored by SVN but not in MANIFEST.SKIP:[EMAIL
PROTECTED]");
}
-
-
exit;
Modified: branches/buildtools/tools/dev/gen_manifest_skip.pl
==============================================================================
--- branches/buildtools/tools/dev/gen_manifest_skip.pl (original)
+++ branches/buildtools/tools/dev/gen_manifest_skip.pl Sun Mar 4 15:32:24 2007
@@ -23,11 +23,13 @@
use lib "$FindBin::Bin/../../lib";
use Data::Dumper;
-use Parrot::Distribution;
+# use Parrot::Distribution;
+use Parrot::Distribution::ManifestSkip qw( gen_manifest_skip );
-my $dist = Parrot::Distribution->new();
+# my $dist = Parrot::Distribution->new();
+# my $skip = $dist->gen_manifest_skip();
-my $skip = $dist->gen_manifest_skip();
+my $manifest_skip_lines_ref = gen_manifest_skip();
my $header = '# $' . 'Id' . '$' . "\n" . << 'END_HEADER'; # confuse SVN
# generated by tools/dev/gen_manifest_skip.pl NOW
@@ -48,12 +50,15 @@
my $now = localtime();
$header =~ s/NOW/$now/;
-print join( "\n", $header, @{$skip}, '' );
+print join( "\n", $header, @{$manifest_skip_lines_ref}, '' );
=head1 AUTHOR
Bernhard Schmalhofer - <[EMAIL PROTECTED]>
+Adapted to use Parrot::Distribution::ManifestSkip by James E Keenan
+([EMAIL PROTECTED]).
+
=cut
# Local Variables: