pf-tools commit: r888 [parmelan-guest] - in /branches/next-gen: debian/changelog lib/PFTools/Update/Addfile.pm lib/PFTools/Update/Addlink.pm lib/PFTools/Update/Common.pm
parmelan-guest at users.alioth.debian.org
parmelan-guest at users.alioth.debian.org
Tue Sep 7 14:36:24 UTC 2010
Author: parmelan-guest
Date: Tue Sep 7 14:36:23 2010
New Revision: 888
URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=888
Log:
* debian/changelog: use native versioning, since we maintain the debian/
directory ourselves in the same repository.
* Don't call mkdir, use File::Path's make_path() instead.
Modified:
branches/next-gen/debian/changelog
branches/next-gen/lib/PFTools/Update/Addfile.pm
branches/next-gen/lib/PFTools/Update/Addlink.pm
branches/next-gen/lib/PFTools/Update/Common.pm
Modified: branches/next-gen/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/debian/changelog?rev=888&op=diff
==============================================================================
--- branches/next-gen/debian/changelog (original)
+++ branches/next-gen/debian/changelog Tue Sep 7 14:36:23 2010
@@ -1,3 +1,15 @@
+pf-tools (1.0.1~WIP) unstable; urgency=low
+
+ * WORK IN PROGRESS, DO NOT RELEASE!
+
+ * debian/changelog: use native versioning, since we maintain the debian/
+ directory ourselves in the same repository.
+ * Start using perltidy --perl-best-practices
+ * Use English
+ * Don't call mkdir, use File::Path's make_path() instead.
+
+ -- Thomas Parmelan <tom+pf-tools at ankh.fr.EU.org> Tue, 07 Sep 2010 12:47:14 +0200
+
pf-tools (1.0-1) unstable; urgency=low
* new upstream release
Modified: branches/next-gen/lib/PFTools/Update/Addfile.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Update/Addfile.pm?rev=888&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/Update/Addfile.pm (original)
+++ branches/next-gen/lib/PFTools/Update/Addfile.pm Tue Sep 7 14:36:23 2010
@@ -138,7 +138,7 @@
copy( $dest, $dest . '.dpkg-dist' );
}
Do_moveold( $dest, $options );
- if ( Mk_dest_dir($dest) || !copy( $tmp, $dest ) ) {
+ if ( !Mk_dest_dir($dest) || !copy( $tmp, $dest ) ) {
Warn( $CODE->{'OPEN'},
"Unable to copy file " . $tmp . " to " . $dest );
return 1;
Modified: branches/next-gen/lib/PFTools/Update/Addlink.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Update/Addlink.pm?rev=888&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/Update/Addlink.pm (original)
+++ branches/next-gen/lib/PFTools/Update/Addlink.pm Tue Sep 7 14:36:23 2010
@@ -75,7 +75,7 @@
Do_before_change( $ref_section, $options, $hash_subst ) && return 1;
if ( !$options->{'simul'} ) {
Do_moveold( $dest, $options );
- if ( Mk_dest_dir($dest) || ln_sfn( $source, $dest ) ) {
+ if ( !Mk_dest_dir($dest) || ln_sfn( $source, $dest ) ) {
Warn( $CODE->{'OPEN'},
"Unable to symlink " . $dest . " to " . $source );
return 1;
Modified: branches/next-gen/lib/PFTools/Update/Common.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Update/Common.pm?rev=888&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/Update/Common.pm (original)
+++ branches/next-gen/lib/PFTools/Update/Common.pm Tue Sep 7 14:36:23 2010
@@ -22,9 +22,11 @@
use strict;
use warnings;
+use Carp;
use English qw( -no_match_vars ); # Avoids regex performance penalty
use Exporter;
use File::Copy;
+use File::Path qw( make_path );
use PFTools::Conf;
use PFTools::Logger;
@@ -274,9 +276,15 @@
}
}
-sub Mk_dest_dir ($) {
+# Mk_dest_dir: wrapper around make_path, trying to remove any existing
+# non-directory that would prevent make_path to create the directory.
+# Returns true on success.
+sub Mk_dest_dir {
my ($dir) = @_;
+ return unless $dir;
+
+ # FIXME rewrite this part, it's really unreadable!!
$dir =~ s://:/:g; # supprimer // sinon ca marche moins bien
$dir =~ s:/[^/]+/*$::;
my $dir2 = $dir;
@@ -286,7 +294,14 @@
if ( $dir2 ne "" && -e $dir2 && !-d $dir2 ) {
unlink($dir2);
}
- $dir && return system( "/bin/mkdir -p '" . $dir . "' >/dev/null 2>&1" );
+
+ eval { make_path($dir); };
+ if ($EVAL_ERROR) {
+ carp "make_path($dir): $EVAL_ERROR"; # FIXME cf. deferredlog*
+ return;
+ }
+
+ return 1; # OK
}
sub Get_tmp_dest ($) {
More information about the pf-tools-commits
mailing list