r4207 - in /packages/libfile-remove-perl/trunk: ./ debian/
lib/File/ t/
eloy at users.alioth.debian.org
eloy at users.alioth.debian.org
Thu Nov 16 16:10:30 CET 2006
Author: eloy
Date: Thu Nov 16 16:10:30 2006
New Revision: 4207
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=4207
Log:
eloy: new upstream version
Added:
packages/libfile-remove-perl/trunk/Changes
- copied unchanged from r4206, packages/libfile-remove-perl/branches/upstream/current/Changes
packages/libfile-remove-perl/trunk/LICENSE
- copied unchanged from r4206, packages/libfile-remove-perl/branches/upstream/current/LICENSE
packages/libfile-remove-perl/trunk/t/01_compile.t
- copied unchanged from r4206, packages/libfile-remove-perl/branches/upstream/current/t/01_compile.t
packages/libfile-remove-perl/trunk/t/02_directories.t
- copied unchanged from r4206, packages/libfile-remove-perl/branches/upstream/current/t/02_directories.t
packages/libfile-remove-perl/trunk/t/03_deep_readonly.t
- copied unchanged from r4206, packages/libfile-remove-perl/branches/upstream/current/t/03_deep_readonly.t
packages/libfile-remove-perl/trunk/t/99_author.t
- copied unchanged from r4206, packages/libfile-remove-perl/branches/upstream/current/t/99_author.t
Removed:
packages/libfile-remove-perl/trunk/CHANGES
packages/libfile-remove-perl/trunk/SIGNATURE
packages/libfile-remove-perl/trunk/t/0_use.t
packages/libfile-remove-perl/trunk/t/1_directories.t
Modified:
packages/libfile-remove-perl/trunk/MANIFEST
packages/libfile-remove-perl/trunk/META.yml
packages/libfile-remove-perl/trunk/Makefile.PL
packages/libfile-remove-perl/trunk/debian/changelog
packages/libfile-remove-perl/trunk/debian/compat
packages/libfile-remove-perl/trunk/debian/control
packages/libfile-remove-perl/trunk/debian/watch
packages/libfile-remove-perl/trunk/lib/File/Remove.pm
Modified: packages/libfile-remove-perl/trunk/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libfile-remove-perl/trunk/MANIFEST?rev=4207&op=diff
==============================================================================
--- packages/libfile-remove-perl/trunk/MANIFEST (original)
+++ packages/libfile-remove-perl/trunk/MANIFEST Thu Nov 16 16:10:30 2006
@@ -1,9 +1,11 @@
-CHANGES
-MANIFEST
+Changes
+lib/File/Remove.pm
+LICENSE
Makefile.PL
+MANIFEST This list of files
README
-lib/File/Remove.pm
+t/01_compile.t
+t/02_directories.t
+t/03_deep_readonly.t
+t/99_author.t
META.yml Module meta-data (added by MakeMaker)
-SIGNATURE
-t/0_use.t
-t/1_directories.t
Modified: packages/libfile-remove-perl/trunk/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libfile-remove-perl/trunk/META.yml?rev=4207&op=diff
==============================================================================
--- packages/libfile-remove-perl/trunk/META.yml (original)
+++ packages/libfile-remove-perl/trunk/META.yml Thu Nov 16 16:10:30 2006
@@ -1,12 +1,16 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
-name: File-Remove
-version: 0.31
-version_from: lib/File/Remove.pm
-installdirs: site
-requires:
+--- #YAML:1.0
+name: File-Remove
+version: 0.34
+abstract: Remove files and directories
+license: ~
+generated_by: ExtUtils::MakeMaker version 6.31
+distribution_type: module
+requires:
File::Glob: 0
+ File::Path: 0
File::Spec: 0.84
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.17
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.2.html
+ version: 1.2
+author:
+ - Richard Soderberg <rs at localdomain>
Modified: packages/libfile-remove-perl/trunk/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libfile-remove-perl/trunk/Makefile.PL?rev=4207&op=diff
==============================================================================
--- packages/libfile-remove-perl/trunk/Makefile.PL (original)
+++ packages/libfile-remove-perl/trunk/Makefile.PL Thu Nov 16 16:10:30 2006
@@ -6,7 +6,16 @@
VERSION_FROM => 'lib/File/Remove.pm', # finds $VERSION
PREREQ_PM => {
'File::Spec' => 0.84,
+ 'File::Path' => 0,
'File::Glob' => 0,
+ # Win32::FileOp requires Win32::API
+ # Win32::API is not working at time of writing.
+ #($^O eq 'MSWin32' or $^O eq 'cygwin')
+ # ? ('Win32::FileOp' => 0)
+ # : (),
+ ($^O eq 'darwin')
+ ? ('Mac::Glue' => 0)
+ : (),
}, # e.g., Module::Name => 1.1
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'lib/File/Remove.pm', # retrieve abstract from module
Modified: packages/libfile-remove-perl/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libfile-remove-perl/trunk/debian/changelog?rev=4207&op=diff
==============================================================================
--- packages/libfile-remove-perl/trunk/debian/changelog (original)
+++ packages/libfile-remove-perl/trunk/debian/changelog Thu Nov 16 16:10:30 2006
@@ -1,3 +1,15 @@
+libfile-remove-perl (0.34-1) UNRELEASED; urgency=low
+
+ * New upstream release
+ * debian/control:
+ + Standards-Version increased to 3.7.2.1 without changes
+ + Uploaders: added me
+ + Build-Depends: debhelper increased to (>= 5.0.0)
+ * debian/compat:
+ + Upgraded to 5
+
+ -- Krzysztof Krzyzaniak (eloy) <eloy at debian.org> Thu, 16 Nov 2006 16:07:10 +0100
+
libfile-remove-perl (0.31-1) unstable; urgency=low
* New upstream release
@@ -18,4 +30,3 @@
* Initial Release (Closes: #302226)
-- Gunnar Wolf <gwolf at debian.org> Wed, 30 Mar 2005 12:35:42 -0600
-
Modified: packages/libfile-remove-perl/trunk/debian/compat
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libfile-remove-perl/trunk/debian/compat?rev=4207&op=diff
==============================================================================
--- packages/libfile-remove-perl/trunk/debian/compat (original)
+++ packages/libfile-remove-perl/trunk/debian/compat Thu Nov 16 16:10:30 2006
@@ -1,1 +1,1 @@
-4
+5
Modified: packages/libfile-remove-perl/trunk/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libfile-remove-perl/trunk/debian/control?rev=4207&op=diff
==============================================================================
--- packages/libfile-remove-perl/trunk/debian/control (original)
+++ packages/libfile-remove-perl/trunk/debian/control Thu Nov 16 16:10:30 2006
@@ -1,11 +1,11 @@
Source: libfile-remove-perl
Section: perl
Priority: optional
-Build-Depends: debhelper (>= 4.0.2)
+Build-Depends: debhelper (>= 5.0.0)
Build-Depends-Indep: perl (>= 5.8.0-7)
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: Gunnar Wolf <gwolf at debian.org>, Gustavo Franco <stratus at debian.org>
-Standards-Version: 3.6.2
+Uploaders: Gunnar Wolf <gwolf at debian.org>, Gustavo Franco <stratus at debian.org>, Krzysztof Krzyzaniak (eloy) <eloy at debian.org>
+Standards-Version: 3.7.2.1
XS-Vcs-Svn: svn://svn.debian.org/pkg-perl/packages/libfile-remove-perl/trunk/
Package: libfile-remove-perl
Modified: packages/libfile-remove-perl/trunk/debian/watch
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libfile-remove-perl/trunk/debian/watch?rev=4207&op=diff
==============================================================================
--- packages/libfile-remove-perl/trunk/debian/watch (original)
+++ packages/libfile-remove-perl/trunk/debian/watch Thu Nov 16 16:10:30 2006
@@ -3,4 +3,4 @@
# to check for upstream updates and more.
# Site Directory Pattern Version Script
version=2
-http://www.cpan.org/modules/by-module/File/File-Remove-(\d.*)\.tar\.gz debian uupdate
+http://www.cpan.org/modules/by-module/File/File-Remove-([\d\.]+)\.tar\.gz
Modified: packages/libfile-remove-perl/trunk/lib/File/Remove.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libfile-remove-perl/trunk/lib/File/Remove.pm?rev=4207&op=diff
==============================================================================
--- packages/libfile-remove-perl/trunk/lib/File/Remove.pm (original)
+++ packages/libfile-remove-perl/trunk/lib/File/Remove.pm Thu Nov 16 16:10:30 2006
@@ -1,4 +1,132 @@
package File::Remove;
+
+use strict;
+use vars qw(@EXPORT_OK @ISA $VERSION $debug $unlink $rmdir);
+BEGIN {
+ $VERSION = '0.34';
+ @ISA = qw(Exporter);
+ @EXPORT_OK = qw(remove rm trash); # nothing by default :)
+}
+
+# If we ever need a Mac::Glue object,
+# we will want to cache it.
+my $glue;
+
+use File::Spec ();
+use File::Path ();
+use File::Glob qw(bsd_glob);
+
+sub expand (@) {
+ map { File::Glob::bsd_glob($_) } @_;
+}
+
+# Are we on VMS?
+# If so copy File::Path and assume VMS::Filespec is loaded
+use constant IS_VMS => $^O eq 'VMS';
+
+
+
+
+
+#####################################################################
+# Main Functions
+
+# acts like unlink would until given a directory as an argument, then
+# it acts like rm -rf ;) unless the recursive arg is zero which it is by
+# default
+sub remove (@) {
+ my $recursive = (ref $_[0] eq 'SCALAR') ? shift : \0;
+ my @files = expand @_;
+
+ # Iterate over the files
+ my @removes;
+ foreach my $path ( @files ) {
+ unless ( -e $path ) {
+ print "missing: $path\n" if $debug;
+ push @removes, $path; # Say we deleted it
+ next;
+ }
+ unless ( IS_VMS ? VMS::Filespec::candelete($path) : -w $path ) {
+ print "nowrite: $path\n" if $debug;
+ next;
+ }
+
+ if ( -f $path or -l $path ) {
+ print "file: $path\n" if $debug;
+ if ( $unlink ? $unlink->($path) : unlink($path) ) {
+ push @removes, $path;
+ }
+
+ } elsif ( -d $path ) {
+ print "dir: $path\n" if $debug;
+ my $dir = File::Spec->canonpath( $path );
+ if ( $$recursive ) {
+ if ( File::Path::rmtree( [ $dir ], $debug, 0 ) ) {
+ push @removes, $path;
+ }
+
+ } else {
+ my ($save_mode) = (stat $dir)[2];
+ chmod $save_mode & 0777, $dir; # just in case we cannot remove it.
+ if ( $rmdir ? $rmdir->($dir) : rmdir($dir) ) {
+ push @removes, $path;
+ }
+ }
+
+ } else {
+ print "???: $path\n" if $debug;
+ }
+ }
+
+ return @removes;
+}
+
+sub rm (@) {
+ goto &remove;
+}
+
+sub trash (@) {
+ local $unlink = $unlink;
+ local $rmdir = $rmdir;
+
+ if ( ref $_[0] eq 'HASH' ) {
+ my %options = %{+shift @_};
+ $unlink = $options{unlink};
+ $rmdir = $options{rmdir};
+
+ } elsif ( $^O eq 'cygwin' || $^O =~ /^MSWin/ ) {
+ eval 'use Win32::FileOp ();';
+ die "Can't load Win32::FileOp to support the Recycle Bin: \$@ = $@" if length $@;
+ $unlink = \&Win32::FileOp::Recycle;
+ $rmdir = \&Win32::FileOp::Recycle;
+
+ } elsif ( $^O eq 'darwin' ) {
+ unless ( $glue ) {
+ eval 'use Mac::Glue ();';
+ die "Can't load Mac::Glue::Finder to support the Trash Can: \$@ = $@" if length $@;
+ $glue = Mac::Glue->new('Finder');
+ }
+ my $code = sub {
+ my @files = map { Mac::Glue::param_type(Mac::Glue::typeAlias() => $_) } @_;
+ $glue->delete(\@files);
+ };
+ $unlink = $code;
+ $rmdir = $code;
+ } else {
+ die "Support for trash() on platform '$^O' not available at this time.\n";
+ }
+ goto &remove;
+}
+
+sub undelete (@) {
+ goto &trash;
+}
+
+1;
+
+__END__
+
+=pod
=head1 NAME
@@ -23,7 +151,7 @@
=head1 DESCRIPTION
B<File::Remove::remove> removes files and directories. It acts like
-B</bin/rm>, for the most part. Although unlink can be given a list
+B</bin/rm>, for the most part. Although C<unlink> can be given a list
of files, it will not remove directories; this module remedies that.
It also accepts wildcards, * and ?, as arguments for filenames.
@@ -64,6 +192,9 @@
Requires L<Win32::FileOp>.
+Installation not actually enforced on Win32 yet, since L<Win32::FileOp>
+has badly failing dependencies at time of writing.
+
=item OS X
Requires L<Mac::Glue>.
@@ -85,7 +216,10 @@
=head1 AUTHOR
-Taken over by Richard Soderberg, E<lt>perl at crystalflame.netE<gt>, so as
+Taken over by Adam Kennedy E<lt>adamk at cpan.orgE<gt>, to fix the
+"deep readonly files" bug, and do some more cleaning up.
+
+Taken over by Richard Soderberg E<lt>perl at crystalflame.netE<gt>, so as
to port it to L<File::Spec> and add tests.
Original copyright: (c) 1998 by Gabor Egressy, E<lt>gabor at vmunix.comE<gt>.
@@ -94,103 +228,3 @@
you can redistribute and/or modify it under the same terms as Perl itself.
=cut
-
-use strict;
-use vars qw(@EXPORT_OK @ISA $VERSION $debug $unlink $rmdir);
- at ISA = qw(Exporter);
-# we export nothing by default :)
- at EXPORT_OK = qw(remove rm trash);
-
-use File::Spec;
-use File::Path qw(rmtree);
-use File::Glob qw(bsd_glob);
-
-$VERSION = '0.31';
-
-our $glue;
-
-sub expand (@)
-{
- map { bsd_glob $_ } @_;
-}
-
-# acts like unlink would until given a directory as an argument, then
-# it acts like rm -rf ;) unless the recursive arg is zero which it is by
-# default
-sub remove (@)
-{
- my $recursive;
- if(ref $_[0] eq 'SCALAR') {
- $recursive = shift;
- }
- else {
- $recursive = \0;
- }
- my @files = expand @_;
- my @removes;
-
- my $ret;
- for (@files) {
- print "file: $_\n" if $debug;
- if(-f $_ || -l $_) {
- print "file unlink: $_\n" if $debug;
- my $result = $unlink ? $unlink->($_) : unlink($_);
- push(@removes, $_) if $result;
- }
- elsif(-d $_) {
- print "dir: $_\n" if $debug;
- # XXX: this regex seems unnecessary, and may trigger bugs someday.
- # TODO: but better to trim trailing slashes for now.
- s/\/$//;
- if ($$recursive) {
- my $result = rmtree([$_], $debug, 1);
- push(@removes, $_) if $result;
- } else {
- my ($save_mode) = (stat $_)[2];
- chmod $save_mode & 0777,$_; # just in case we cannot remove it.
- my $result = $rmdir ? $rmdir->($_) : rmdir($_);
- push(@removes, $_) if $result;
- }
- } else {
- print "???: $_\n" if $debug;
- }
- }
-
- @removes;
-}
-
-sub rm (@) { goto &remove }
-
-sub trash (@) {
- our $unlink = $unlink;
- our $rmdir = $rmdir;
- if (ref($_[0]) eq 'HASH') {
- my %options = %{+shift @_};
- $unlink = $options{'unlink'};
- $rmdir = $options{'rmdir'};
- } elsif ($^O eq 'cygwin' || $^O =~ /^MSWin/) {
- eval 'use Win32::FileOp ();';
- die "Can't load Win32::FileOp to support the Recycle Bin: \$@ = $@" if length $@;
- $unlink = \&Win32::FileOp::Recycle;
- $rmdir = \&Win32::FileOp::Recycle;
- } elsif ($^O eq 'darwin') {
- unless ($glue) {
- eval 'use Mac::Glue ();';
- die "Can't load Mac::Glue::Finder to support the Trash Can: \$@ = $@" if length $@;
- $glue = Mac::Glue->new('Finder');
- }
- my $code = sub {
- my @files = map { Mac::Glue::param_type(Mac::Glue::typeAlias() => $_) } @_;
- $glue->delete(\@files);
- };
- $unlink = $code;
- $rmdir = $code;
- } else {
- die "Support for trash() on platform '$^O' not available at this time.\n";
- }
- goto &remove;
-}
-
-sub undelete (@) { goto &trash }
-
-1;
More information about the Pkg-perl-cvs-commits
mailing list