[prev in list] [next in list] [prev in thread] [next in thread]
List: opensuse-commit
Subject: commit perl-File-ShareDir-Install for openSUSE:Factory
From: root () hilbert ! suse ! de (h_root)
Date: 2014-02-28 18:01:00
Message-ID: 20140228180100.B5074AE03B () hilbert ! suse ! de
[Download RAW message or body]
Hello community,
here is the log from the commit of package perl-File-ShareDir-Install for \
openSUSE:Factory checked in at 2014-02-28 19:00:57 \
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing \
/work/SRC/openSUSE:Factory/perl-File-ShareDir-Install (Old) and \
/work/SRC/openSUSE:Factory/.perl-File-ShareDir-Install.new (New) \
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-File-ShareDir-Install"
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-File-ShareDir-Install/perl-File-ShareDir-Install.changes 2013-10-08 \
18:19:40.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.perl-File-ShareDir-Install.new/perl-File-ShareDir-Install.changes 2014-02-28 \
19:00:59.000000000 +0100 @@ -1,0 +2,13 @@
+Mon Feb 24 06:08:00 UTC 2014 - coolo@suse.com
+
+- updated to 0.08
+ - Tests may now be run in parallel
+ Thank you KENTNL@cpan.org
+
+ - Added delete_share
+ Thank you dmuey@cpan.org
+
+ - Added $INCLUDE_DOTFILES and $INCLUDE_DOTDIRS
+ Thank you sharyanto@cpan.org
+
+-------------------------------------------------------------------
Old:
----
File-ShareDir-Install-0.05.tar.gz
New:
----
File-ShareDir-Install-0.08.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-File-ShareDir-Install.spec ++++++
--- /var/tmp/diff_new_pack.L2fKWD/_old 2014-02-28 19:01:00.000000000 +0100
+++ /var/tmp/diff_new_pack.L2fKWD/_new 2014-02-28 19:01:00.000000000 +0100
@@ -1,7 +1,7 @@
#
# spec file for package perl-File-ShareDir-Install
#
-# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
Name: perl-File-ShareDir-Install
-Version: 0.05
+Version: 0.08
Release: 0
%define cpan_name File-ShareDir-Install
Summary: Install shared files
@@ -29,7 +29,6 @@
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl
BuildRequires: perl-macros
-#BuildRequires: perl(File::ShareDir::Install)
%{perl_requires}
%description
@@ -39,7 +38,11 @@
It is a port of the Module::Install::Share manpage to the
ExtUtils::MakeMaker manpage with the improvement of only installing the
-files you want; '.svn' and other source-control junk will be ignored.
+files you want; '.svn', '.git' and other source-control junk will be
+ignored.
+
+Please note that this module installs read-only data files; empty
+directories will be ignored.
%prep
%setup -q -n %{cpan_name}-%{version}
++++++ File-ShareDir-Install-0.05.tar.gz -> File-ShareDir-Install-0.08.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' \
'--exclude=.svnignore' old/File-ShareDir-Install-0.05/Changes \
new/File-ShareDir-Install-0.08/Changes
--- old/File-ShareDir-Install-0.05/Changes 2013-09-03 20:46:08.000000000 +0200
+++ new/File-ShareDir-Install-0.08/Changes 2014-01-29 16:33:45.000000000 +0100
@@ -1,5 +1,17 @@
Revision history for Perl extension File::ShareDir::Install.
+0.08 Jan 29 2015
+ - Tests may now be run in parallel
+ Thank you KENTNL@cpan.org
+
+0.07 Jan 17 2014
+ - Added delete_share
+ Thank you dmuey@cpan.org
+
+0.06 Jan 16 2014
+ - Added $INCLUDE_DOTFILES and $INCLUDE_DOTDIRS
+ Thank you sharyanto@cpan.org
+
0.05 Sep 3 2013
- Tweak doco and fix typos
Thank you dsteinbrunner@pobox.com
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' \
'--exclude=.svnignore' old/File-ShareDir-Install-0.05/MANIFEST \
new/File-ShareDir-Install-0.08/MANIFEST
--- old/File-ShareDir-Install-0.05/MANIFEST 2013-09-03 20:47:14.000000000 +0200
+++ new/File-ShareDir-Install-0.08/MANIFEST 2014-01-29 16:42:25.000000000 +0100
@@ -1,15 +1,21 @@
Changes
-Makefile.PL
MANIFEST
+Makefile.PL
README
lib/File/ShareDir/Install.pm
-t/module/again
-t/module/deeper/bonk
-t/module/bonk
-t/share/honk
t/00_compile.t
t/01_pod.t
t/02_pod_coverage.t
t/10_makefile.t
+t/11_dotfile.t
+t/module/.dir/something
+t/module/.something
+t/module/again
+t/module/bonk
+t/module/deeper/bonk
+t/share/.dir/something
+t/share/.something
+t/share/honk
+t/12_delete.t
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' \
'--exclude=.svnignore' old/File-ShareDir-Install-0.05/META.json \
new/File-ShareDir-Install-0.08/META.json
--- old/File-ShareDir-Install-0.05/META.json 2013-09-03 20:47:14.000000000 +0200
+++ new/File-ShareDir-Install-0.08/META.json 2014-01-29 16:42:24.000000000 +0100
@@ -39,5 +39,5 @@
}
},
"release_status" : "stable",
- "version" : "0.05"
+ "version" : "0.08"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' \
'--exclude=.svnignore' old/File-ShareDir-Install-0.05/META.yml \
new/File-ShareDir-Install-0.08/META.yml
--- old/File-ShareDir-Install-0.05/META.yml 2013-09-03 20:47:14.000000000 +0200
+++ new/File-ShareDir-Install-0.08/META.yml 2014-01-29 16:42:24.000000000 +0100
@@ -21,4 +21,4 @@
ExtUtils::MakeMaker: 6.11
File::Spec: 0
IO::Dir: 0
-version: 0.05
+version: 0.08
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' \
'--exclude=.svnignore' old/File-ShareDir-Install-0.05/lib/File/ShareDir/Install.pm \
new/File-ShareDir-Install-0.08/lib/File/ShareDir/Install.pm
--- old/File-ShareDir-Install-0.05/lib/File/ShareDir/Install.pm 2013-09-03 \
20:46:24.000000000 +0200
+++ new/File-ShareDir-Install-0.08/lib/File/ShareDir/Install.pm 2014-01-29 \
16:38:01.000000000 +0100 @@ -9,53 +9,120 @@
use File::Spec;
use IO::Dir;
-our $VERSION = '0.05';
+our $VERSION = '0.08';
our @DIRS;
-our %TYPES;
+our %ALREADY;
require Exporter;
our @ISA = qw( Exporter );
-our @EXPORT = qw( install_share );
-our @EXPORT_OK = qw( postamble install_share );
+our @EXPORT = qw( install_share delete_share );
+our @EXPORT_OK = qw( postamble install_share delete_share );
+our $INCLUDE_DOTFILES = 0;
+our $INCLUDE_DOTDIRS = 0;
#####################################################################
sub install_share
{
my $dir = @_ ? pop : 'share';
my $type = @_ ? shift : 'dist';
- unless ( defined $type and $type eq 'module' or $type eq 'dist' ) {
+ unless ( defined $type and
+ ( $type =~ /^(module|dist)$/ ) ) {
confess "Illegal or invalid share dir type '$type'";
}
- unless ( defined $dir and -d $dir ) {
- confess "Illegal or missing directory '$dir'";
+
+ if( $type eq 'dist' and @_ ) {
+ confess "Too many parameters to install_share";
+ }
+
+ my $def = _mk_def( $type );
+ _add_module( $def, $_[0] );
+
+ _add_dir( $def, $dir );
+}
+
+
+#####################################################################
+sub delete_share
+{
+ my $dir = @_ ? pop : '';
+ my $type = @_ ? shift : 'dist';
+ unless ( defined $type and
+ ( $type =~ /^(module|dist)$/ ) ) {
+ confess "Illegal or invalid share dir type '$type'";
}
if( $type eq 'dist' and @_ ) {
- confess "Too many parameters to share_dir";
+ confess "Too many parameters to delete_share";
}
- push @DIRS, $dir;
- $TYPES{$dir} = [ $type ];
- if( $type eq 'module' ) {
- my $module = _CLASS( $_[0] );
+ my $def = _mk_def( "delete-$type" );
+ _add_module( $def, $_[0] );
+ _add_dir( $def, $dir );
+}
+
+
+
+#
+# Build a task definition
+sub _mk_def
+{
+ my( $type ) = @_;
+ return { type=>$type,
+ dotfiles => $INCLUDE_DOTFILES,
+ dotdirs => $INCLUDE_DOTDIRS
+ };
+}
+
+#
+# Add the module to a task definition
+sub _add_module
+{
+ my( $def, $class ) = @_;
+ if( $def->{type} =~ /module$/ ) {
+ my $module = _CLASS( $class );
unless ( defined $module ) {
confess "Missing or invalid module name '$_[0]'";
}
- push @{ $TYPES{$dir} }, $module;
+ $def->{module} = $module;
}
-
}
+#
+# Add directories to a task definition
+# Save the definition
+sub _add_dir
+{
+ my( $def, $dir ) = @_;
+
+ $dir = [ $dir ] unless ref $dir;
+
+ my $del = 0;
+ $del = 1 if $def->{type} =~ /^delete-/;
+
+ foreach my $d ( @$dir ) {
+ unless ( $del or (defined $d and -d $d) ) {
+ confess "Illegal or missing directory '$d'";
+ }
+ if( not $del and $ALREADY{ $d }++ ) {
+ confess "Directory '$d' is already being installed";
+ }
+ push @DIRS, { %$def };
+ $DIRS[-1]{dir} = $d;
+ }
+}
+
+
#####################################################################
+# Build the postamble section
sub postamble
{
my $self = shift;
my @ret; # = $self->SUPER::postamble( @_ );
- foreach my $dir ( @DIRS ) {
- push @ret, __postamble_share_dir( $self, $dir, @{ $TYPES{ $dir } } );
+ foreach my $def ( @DIRS ) {
+ push @ret, __postamble_share_dir( $self, $def );
}
return join "\n", @ret;
}
@@ -63,33 +130,40 @@
#####################################################################
sub __postamble_share_dir
{
- my( $self, $dir, $type, $mod ) = @_;
+ my( $self, $def ) = @_;
+
+ my $dir = $def->{dir};
+ $DB::single = 1;
my( $idir );
- if ( $type eq 'dist' ) {
- $idir = File::Spec->catdir( '$(INST_LIB)',
- qw( auto share dist ),
- '$(DISTNAME)'
- );
+
+ if( $def->{type} eq 'delete-dist' ) {
+ $idir = File::Spec->catdir( _dist_dir(), $dir );
}
- else {
- my $module = $mod;
- $module =~ s/::/-/g;
- $idir = File::Spec->catdir( '$(INST_LIB)',
- qw( auto share module ),
- $module
- );
+ elsif( $def->{type} eq 'delete-module' ) {
+ $idir = File::Spec->catdir( _module_dir( $def ), $dir );
+ }
+ elsif ( $def->{type} eq 'dist' ) {
+ $idir = _dist_dir();
+ }
+ else { # delete-share and share
+ $idir = _module_dir( $def );
}
- my $files = {};
- _scan_share_dir( $files, $idir, $dir );
-
- my $autodir = '$(INST_LIB)';
- my $pm_to_blib = $self->oneliner(<<CODE, ['-MExtUtils::Install']);
+ my @cmds;
+ if( $def->{type} =~ /^delete-/ ) {
+ @cmds = "\$(RM_RF) $idir";
+ }
+ else {
+ my $autodir = '$(INST_LIB)';
+ my $pm_to_blib = $self->oneliner(<<CODE, ['-MExtUtils::Install']);
pm_to_blib({\@ARGV}, '$autodir')
CODE
- my @cmds = $self->split_command( $pm_to_blib, %$files );
+ my $files = {};
+ _scan_share_dir( $files, $idir, $dir, $def );
+ @cmds = $self->split_command( $pm_to_blib, %$files );
+ }
my $r = join '', map { "\t\$(NOECHO) $_\n" } @cmds;
@@ -99,19 +173,49 @@
return "config::\n$r";
}
+# Get the per-dist install directory.
+# We depend on the Makefile for most of the info
+sub _dist_dir
+{
+ return File::Spec->catdir( '$(INST_LIB)',
+ qw( auto share dist ),
+ '$(DISTNAME)'
+ );
+}
+
+# Get the per-module install directory
+# We depend on the Makefile for most of the info
+sub _module_dir
+{
+ my( $def ) = @_;
+ my $module = $def->{module};
+ $module =~ s/::/-/g;
+ return File::Spec->catdir( '$(INST_LIB)',
+ qw( auto share module ),
+ $module
+ );
+}
sub _scan_share_dir
{
- my( $files, $idir, $dir ) = @_;
+ my( $files, $idir, $dir, $def ) = @_;
my $dh = IO::Dir->new( $dir ) or die "Unable to read $dir: $!";
my $entry;
while( defined( $entry = $dh->read ) ) {
- next if $entry =~ /^\./ or $entry =~ /(~|,v)$/;
+ next if $entry =~ /(~|,v|#)$/;
my $full = File::Spec->catfile( $dir, $entry );
if( -f $full ) {
+ next if not $def->{dotfiles} and $entry =~ /^\./;
$files->{ $full } = File::Spec->catfile( $idir, $entry );
}
elsif( -d $full ) {
+ if( $def->{dotdirs} ) {
+ next if $entry eq '.' or $entry eq '..' or
+ $entry =~ /^\.(svn|git|cvs)$/;
+ }
+ else {
+ next if $entry =~ /^\./;
+ }
_scan_share_dir( $files, File::Spec->catdir( $idir, $entry ), $full );
}
}
@@ -158,9 +262,12 @@
allows you to locate these files after installation.
It is a port of L<Module::Install::Share> to L<ExtUtils::MakeMaker> with the
-improvement of only installing the files you want; C<.svn> and other
+improvement of only installing the files you want; C<.svn>, C<.git> and other
source-control junk will be ignored.
+Please note that this module installs read-only data files; empty
+directories will be ignored.
+
=head1 EXPORT
=head2 install_share
@@ -173,14 +280,18 @@
into a per-dist or per-module share directory. Must be called before
L<WriteMakefile>.
-The first 2 forms are equivalent.
-
-The files will be installed when you run C<make install>.
+The first 2 forms are equivalent; the files are installed in a per-distribution
+directory. For example C</usr/lib/perl5/site_perl/auto/share/dist/My-Dist>. The
+name of that directory can be recovered with L<File::ShareDir/dist_dir>.
+
+The last form installs files in a per-module directory. For example
+C</usr/lib/perl5/site_perl/auto/share/module/My-Dist-Package>. The name of that
+directory can be recovered with L<File::ShareDir/module_dir>.
-To locate the files after installation so they can be used inside your
-module, see L<File::ShareDir>.
+The parameter C<$dir> may be an array of directories.
- my $dir = File::ShareDir::module_dir( $module );
+The files will be installed when you run C<make install>. However, the list
+of files to install is generated when Makefile.PL is run.
Note that if you make multiple calls to C<install_share> on different
directories that contain the same filenames, the last of these calls takes
@@ -189,13 +300,45 @@
install_share 'share1';
install_share 'share2';
-And both C<share1> and C<share2> contain a fill called C<info>, the file
-C<share2/info> will be installed into your C<dist_dir()>.
+And both C<share1> and C<share2> contain a file called C<info.txt>, the file
+C<share2/info.txt> will be installed into your C<dist_dir()>.
+
+=head2 delete_share
+
+ delete_share $list;
+ delete_share dist => $list;
+ delete_share module => $module, $list;
+
+Remove previously installed files or directories.
+
+Unlike L</install_share>, the last parameter is a list of files or
+directories that were previously installed. These files and directories will
+be deleted when you run C<make install>.
+
+The parameter C<$list> may be an array of files or directories.
+
+Deletion happens in-order along with installation. This means that you may
+delete all previously installed files by putting the following at the top of
+your Makefile.PL.
+
+ delete_share '.';
+
+You can also selectively remove some files from installation.
+
+ install_share 'some-dir';
+ if( ... ) {
+ delete_share 'not-this-file.rc';
+ }
=head2 postamble
-Exported into the MY package. Only documented here if you need to write your
-own postamble.
+This function must be exported into the MY package. You will normaly do this
+with the following.
+
+ package MY;
+ use File::ShareDir::Install qw( postamble );
+
+If you need to overload postamble, use the following.
package MY;
use File::ShareDir::Install;
@@ -207,6 +350,44 @@
return join "\n", @ret;
}
+=head1 CONFIGURATION
+
+2 variables control the handling of dot-files and dot-directories.
+
+A dot-file has a filename that starts with a period (.). For example
+C<.htaccess>. A dot-directory (or dot-dir) is a directory that starts with a
+period (.). For example C<.config/>. Not all filesystems support the use
+of dot-files.
+
+=head2 $INCLUDE_DOTFILES
+
+If set to a true value, dot-files will be copied. Default is false.
+
+=head2 $INCLUDE_DOTDIRS
+
+If set to a true value, the files inside dot-directories will be copied.
+Known version control directories are still ignored. Default is false.
+
+=head2 Note
+
+These variables only influence subsequent calls to C<install_share()>. This allows
+you to control the behaviour for each directory.
+
+For example:
+
+ $INCLUDE_DOTDIRS = 1;
+ install_share 'share1';
+ $INCLUDE_DOTFILES = 1;
+ $INCLUDE_DOTDIRS = 0;
+ install_share 'share2';
+
+The directory C<share1> will have files in its dot-directories installed,
+but not dot-files. The directory C<share2> will have files in its dot-files
+installed, but dot-directories will be ignored.
+
+
+
+
=head1 SEE ALSO
L<File::ShareDir>, L<Module::Install>.
@@ -217,7 +398,7 @@
=head1 COPYRIGHT AND LICENSE
-Copyright (C) 2009-2011 by Philip Gwyn
+Copyright (C) 2009-2014 by Philip Gwyn
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.8 or,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' \
'--exclude=.svnignore' old/File-ShareDir-Install-0.05/t/02_pod_coverage.t \
new/File-ShareDir-Install-0.08/t/02_pod_coverage.t
--- old/File-ShareDir-Install-0.05/t/02_pod_coverage.t 2010-10-19 21:03:02.000000000 \
+0200
+++ new/File-ShareDir-Install-0.08/t/02_pod_coverage.t 2014-01-17 19:50:16.000000000 \
+0100 @@ -11,8 +11,6 @@
pod_coverage_ok(
"File::ShareDir::Install",
{ also_private => [
-# qr/^(OH|SE)_.+$/,
-# qr/^(handler_for|instantiate|set_objectre)$/
],
},
"File::ShareDir::Install, ignoring private functions",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' \
'--exclude=.svnignore' old/File-ShareDir-Install-0.05/t/10_makefile.t \
new/File-ShareDir-Install-0.08/t/10_makefile.t
--- old/File-ShareDir-Install-0.05/t/10_makefile.t 2011-08-26 19:40:55.000000000 \
+0200
+++ new/File-ShareDir-Install-0.08/t/10_makefile.t 2014-01-29 16:37:02.000000000 \
+0100 @@ -6,15 +6,15 @@
use Config;
use File::Path qw( rmtree );
-use Test::More ( tests => 15 );
+use Test::More ( tests => 16 );
use ExtUtils::MakeMaker;
-my $FILE = 'test-Makefile';
-rmtree( [ qw( tlib troot ) ], 0, 0 );
+my $FILE = "test-$$-Makefile";
+rmtree( [ "tlib-$$", "troot-$$" ], 0, 0 );
END {
$FILE and -f $FILE and unlink $FILE;
- rmtree( [ qw( tlib troot ) ], 0, 0 );
+ rmtree( [ "tlib-$$", "troot-$$" ], 0, 0 );
}
use File::ShareDir::Install;
@@ -29,8 +29,8 @@
WriteMakefile(
NAME => 'File::ShareDir::Install',
VERSION_FROM => 'lib/File/ShareDir/Install.pm',
- INST_LIB => 'tlib/lib',
- PREFIX => 'troot',
+ INST_LIB => "tlib-$$/lib",
+ PREFIX => "troot-$$",
MAKEFILE => $FILE,
PREREQ_PM => {},
($] >= 5.005 ?
@@ -55,9 +55,11 @@
ok( $content =~ m(t.module.again.+share.module.My-Test.again), "Shared by module \
again" ); ok( $content =~ m(t.module.deeper.bonk.+share.module.My-Test.deeper.bonk), \
"Shared by module in subdirectory" );
+ok( $content !~ m(t.share.\.something), "Don't share dot files" );
+
#####
mysystem( $Config{make}, '-f', $FILE );
-my $TOP = "tlib/lib/auto/share";
+my $TOP = "tlib-$$/lib/auto/share";
ok( -f "$TOP/dist/File-ShareDir-Install/honk", "Copied to blib for dist" );
ok( -f "$TOP/module/My-Test/bonk", "Copied to blib for module" );
ok( -f "$TOP/module/My-Test/again", "Copied to blib for module again" );
@@ -77,7 +79,7 @@
}
else {
$TOP = "$1/auto/share";
- $TOP =~ s/\$\(SITEPREFIX\)/troot/;
+ $TOP =~ s/\$\(SITEPREFIX\)/troot-$$/;
ok( -f "$TOP/dist/File-ShareDir-Install/honk", "Copied to blib for dist" );
ok( -f "$TOP/module/My-Test/bonk", "Copied to blib for module" );
ok( -f "$TOP/module/My-Test/again", "Copied to blib for module again" );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' \
'--exclude=.svnignore' old/File-ShareDir-Install-0.05/t/11_dotfile.t \
new/File-ShareDir-Install-0.08/t/11_dotfile.t
--- old/File-ShareDir-Install-0.05/t/11_dotfile.t 1970-01-01 01:00:00.000000000 +0100
+++ new/File-ShareDir-Install-0.08/t/11_dotfile.t 2014-01-29 16:36:16.000000000 +0100
@@ -0,0 +1,84 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Config;
+
+use File::Path qw( rmtree );
+use Test::More ( tests => 9 );
+
+use ExtUtils::MakeMaker;
+
+my $FILE = "test-$$-Makefile";
+rmtree( [ "tlib-$$", "troot-$$" ], 0, 0 );
+END {
+ $FILE and -f $FILE and unlink $FILE;
+ rmtree( [ "tlib-$$", "troot-$$" ], 0, 0 );
+}
+
+use File::ShareDir::Install;
+
+$File::ShareDir::Install::INCLUDE_DOTFILES = 1;
+install_share 't/share';
+$File::ShareDir::Install::INCLUDE_DOTFILES = 0;
+$File::ShareDir::Install::INCLUDE_DOTDIRS = 1;
+install_share module => 'My::Test' => 't/module';
+
+
+delete $ENV{PERL_MM_OPT}; # local::lib + PREFIX below will FAIL
+# XXX maybe we should just remove INSTALL_BASE=[^ ]+ from PERL_MM_OPT?
+
+WriteMakefile(
+ NAME => 'File::ShareDir::Install',
+ VERSION_FROM => 'lib/File/ShareDir/Install.pm',
+ INST_LIB => "tlib-$$/lib",
+ PREFIX => "troot-$$",
+ MAKEFILE => $FILE,
+ PREREQ_PM => {},
+ ($] >= 5.005 ?
+ (ABSTRACT_FROM => 'lib/File/ShareDir/Install.pm',
+ AUTHOR => 'Philip Gwyn <fil@localdomain>') : ()),
+);
+
+sub slurp
+{
+ local @ARGV = @_;
+ local $/;
+ local $.;
+ <>;
+};
+
+
+#####
+ok( -f $FILE, "Created $FILE" );
+my $content = slurp $FILE;
+ok( $content =~ m(t.share.\.something), "Shared a dotfile" );
+ok( $content !~ m(t.share.\.dir), " ... but not a dotdir" );
+
+ok( $content !~ m(t.module.dir), "Shared a dotdir " );
+ok( $content !~ m(t.module.something), " ... but not a dotfile " );
+
+#####
+mysystem( $Config{make}, '-f', $FILE );
+my $TOP = "tlib-$$/lib/auto/share";
+ok( -f "$TOP/dist/File-ShareDir-Install/.something", "Copied a dotfile" );
+ok( !-d "$TOP/dist/File-ShareDir-Install/.dir", " ... but not dotdir" );
+ok( -d "$TOP/module/My-Test/.dir", "Copied a dotdir" );
+ok( !-f "$TOP/module/My-Test/.something", " ... but not a dotfile" );
+
+
+#####################################
+sub mysystem
+{
+ my $cmd = join ' ', @_;
+ my $ret = qx($cmd 2>&1);
+ return unless $?;
+ die "Error running $cmd: ?=$? ret=$ret";
+}
+
+###########################################################################
+package MY;
+
+use File::ShareDir::Install qw(postamble);
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' \
'--exclude=.svnignore' old/File-ShareDir-Install-0.05/t/12_delete.t \
new/File-ShareDir-Install-0.08/t/12_delete.t
--- old/File-ShareDir-Install-0.05/t/12_delete.t 1970-01-01 01:00:00.000000000 +0100
+++ new/File-ShareDir-Install-0.08/t/12_delete.t 2014-01-29 16:36:42.000000000 +0100
@@ -0,0 +1,81 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Config;
+
+use File::Path qw( rmtree );
+use Test::More ( tests => 7 );
+
+use ExtUtils::MakeMaker;
+
+my $FILE = "test-$$-Makefile";
+rmtree( [ "tlib-$$", "troot-$$" ], 0, 0 );
+END {
+ $FILE and -f $FILE and unlink $FILE;
+ rmtree( [ "tlib-$$", "troot-$$" ], 0, 0 );
+}
+
+use File::ShareDir::Install;
+
+install_share 't/share';
+install_share module => 'My::Test' => 't/module';
+delete_share 'module' => 'My::Test' => [ qw( again deeper ) ];
+delete_share 'dist' => 'honk';
+
+delete $ENV{PERL_MM_OPT}; # local::lib + PREFIX below will FAIL
+# XXX maybe we should just remove INSTALL_BASE=[^ ]+ from PERL_MM_OPT?
+
+WriteMakefile(
+ NAME => 'File::ShareDir::Install',
+ VERSION_FROM => 'lib/File/ShareDir/Install.pm',
+ INST_LIB => "tlib-$$/lib",
+ PREFIX => "troot-$$",
+ MAKEFILE => $FILE,
+ PREREQ_PM => {},
+ ($] >= 5.005 ?
+ (ABSTRACT_FROM => 'lib/File/ShareDir/Install.pm',
+ AUTHOR => 'Philip Gwyn <fil@localdomain>') : ()),
+);
+
+sub slurp
+{
+ local @ARGV = @_;
+ local $/;
+ local $.;
+ <>;
+};
+
+
+#####
+ok( -f $FILE, "Created $FILE" );
+my $content = slurp $FILE;
+
+ok( $content =~ /RM_RF.+module.My-Test.again/, "Remove a file" );
+ok( $content =~ /RM_RF.+module.My-Test.deeper/, "Remove a dir" );
+ok( $content =~ /RM_RF.+dist...DISTNAME..honk/, "Remove from per-dist" )
+ or die $content;
+
+
+#####
+mysystem( $Config{make}, '-f', $FILE );
+my $TOP = "tlib-$$/lib/auto/share";
+ok( -f "$TOP/module/My-Test/bonk", "Installed this file" );
+ok( !-f "$TOP/module/My-Test/again", "Removed this file" );
+ok( !-d "$TOP/dist/File-ShareDir-Install/deeper", "Removed a directory" );
+
+#####################################
+sub mysystem
+{
+ my $cmd = join ' ', @_;
+ my $ret = qx($cmd 2>&1);
+ return unless $?;
+ die "Error running $cmd: ?=$? ret=$ret";
+}
+
+###########################################################################
+package MY;
+
+use File::ShareDir::Install qw(postamble);
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' \
'--exclude=.svnignore' old/File-ShareDir-Install-0.05/t/module/.dir/something \
new/File-ShareDir-Install-0.08/t/module/.dir/something
--- old/File-ShareDir-Install-0.05/t/module/.dir/something 1970-01-01 \
01:00:00.000000000 +0100
+++ new/File-ShareDir-Install-0.08/t/module/.dir/something 2014-01-16 \
20:28:18.000000000 +0100 @@ -0,0 +1 @@
+Thu Jan 16 14:28:18 EST 2014
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' \
'--exclude=.svnignore' old/File-ShareDir-Install-0.05/t/module/.something \
new/File-ShareDir-Install-0.08/t/module/.something
--- old/File-ShareDir-Install-0.05/t/module/.something 1970-01-01 01:00:00.000000000 \
+0100
+++ new/File-ShareDir-Install-0.08/t/module/.something 2014-01-16 20:24:28.000000000 \
+0100 @@ -0,0 +1 @@
+Thu Jan 16 14:24:28 EST 2014
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' \
'--exclude=.svnignore' old/File-ShareDir-Install-0.05/t/share/.dir/something \
new/File-ShareDir-Install-0.08/t/share/.dir/something
--- old/File-ShareDir-Install-0.05/t/share/.dir/something 1970-01-01 \
01:00:00.000000000 +0100
+++ new/File-ShareDir-Install-0.08/t/share/.dir/something 2014-01-16 \
20:28:28.000000000 +0100 @@ -0,0 +1 @@
+Thu Jan 16 14:28:28 EST 2014
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' \
'--exclude=.svnignore' old/File-ShareDir-Install-0.05/t/share/.something \
new/File-ShareDir-Install-0.08/t/share/.something
--- old/File-ShareDir-Install-0.05/t/share/.something 1970-01-01 01:00:00.000000000 \
+0100
+++ new/File-ShareDir-Install-0.08/t/share/.something 2014-01-16 20:03:44.000000000 \
+0100 @@ -0,0 +1 @@
+Thu Jan 16 14:03:44 EST 2014
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic