pf-tools commit: r893 [parmelan-guest] - in /branches/next-gen: README.coding.style lib/PFTools/VCS.pm

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Tue Sep 7 21:50:20 UTC 2010


Author: parmelan-guest
Date: Tue Sep  7 21:50:18 2010
New Revision: 893

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=893
Log:
Use remove_tree() instead of system and rm -rf

Modified:
    branches/next-gen/README.coding.style
    branches/next-gen/lib/PFTools/VCS.pm

Modified: branches/next-gen/README.coding.style
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/README.coding.style?rev=893&op=diff
==============================================================================
--- branches/next-gen/README.coding.style (original)
+++ branches/next-gen/README.coding.style Tue Sep  7 21:50:18 2010
@@ -14,3 +14,11 @@
   good reason not to do so), and separated in two groups: first the standard
   packages, then a new line and our own packages.
 
+* Always use a bare "return;" on failure. Always return a true value on
+  success (but not necessarily 1).
+
+
+The following line is only here to tell Vim my preferences when editing this
+file :
+* vim: set tw=78 sw=2 comments=fb\:*,fb\:-,fb\:+,fb\:=>:
+

Modified: branches/next-gen/lib/PFTools/VCS.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/VCS.pm?rev=893&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/VCS.pm (original)
+++ branches/next-gen/lib/PFTools/VCS.pm Tue Sep  7 21:50:18 2010
@@ -27,7 +27,7 @@
 
 use English qw( -no_match_vars );    # Avoids regex performance penalty
 use Exporter;
-use File::Path qw( make_path );
+use File::Path qw( make_path remove_tree );
 
 use PFTools::Logger;
 
@@ -86,13 +86,8 @@
     print $cvs_cmd. "\n" if ( $options->{'debug'} || $options->{'verbose'} );
 
     my $co_dir = $pf_config->{'path'}->{'checkout_dir'};
-    unless ( -d $co_dir ) {
-        make_path($co_dir);
-    }
-    else {
-        system( "/bin/rm -rf '".$co_dir."'; /bin/mkdir -p '".
-            $co_dir."' 2>/dev/null" );
-    }
+    remove_tree($co_dir);
+    make_path($co_dir);
 
     $ret = deferredlogsystem( "cd '" . $co_dir . "';" . $cvs_cmd );
     if ($ret) {
@@ -142,13 +137,8 @@
     print $svn_cmd. "\n" if ( $options->{'debug'} || $options->{'verbose'} );
 
     my $co_dir = $pf_config->{'path'}->{'checkout_dir'};
-    unless ( -d $co_dir ) {
-        make_path($co_dir);
-    }
-    else {
-        system( "/bin/rm -rf '".$co_dir."'; /bin/mkdir -p '".
-            $co_dir."' 2>/dev/null" );
-    }
+    remove_path($co_dir);
+    make_path($co_dir);
     
     $ret = deferredlogsystem( "cd '" . $co_dir . "';" . $svn_cmd );
     if ($ret) {




More information about the pf-tools-commits mailing list