ソースを参照

perl: Switch from legacy File::Path functions to new ones

Use make_path() instead of mkpath(), and remove_tree() instead of
rmtree().
Guillem Jover 11 年 前
コミット
5e59d94a17
共有5 個のファイルを変更した13 個の追加12 個の削除を含む
  1. 1 0
      debian/changelog
  2. 4 4
      dselect/methods/ftp/install.pl
  3. 4 4
      scripts/Dpkg/Source/Package/V2.pm
  4. 2 2
      scripts/Dpkg/Source/Patch.pm
  5. 2 2
      scripts/dpkg-name.pl

+ 1 - 0
debian/changelog

@@ -32,6 +32,7 @@ dpkg (1.18.0) UNRELEASED; urgency=low
     This was a temporary workaround for very old gcc toolchains. See #453267.
   * Prefer multiarch paths to multilib ones in Dpkg::Shlibs.
     Thanks to Helmut Grohne <helmut@subdivi.de>. Closes: #772184
+  * Switch perl code from legacy File::Path functions to new ones.
 
  -- Guillem Jover <guillem@debian.org>  Tue, 09 Dec 2014 23:53:18 +0100
 

+ 4 - 4
dselect/methods/ftp/install.pl

@@ -21,7 +21,7 @@ use warnings;
 
 eval q{
     use Net::FTP;
-    use File::Path;
+    use File::Path qw(make_path remove_tree);
     use File::Basename;
     use File::Find;
     use Data::Dumper;
@@ -56,7 +56,7 @@ my $methdir = "$vardir/methods/ftp";
 read_config("$methdir/vars");
 
 chdir "$methdir";
-mkpath(["$methdir/$CONFIG{dldir}"], 0, 0755);
+make_path("$methdir/$CONFIG{dldir}", { mode => 0755 });
 
 
 #Read md5sums already calculated
@@ -230,7 +230,7 @@ foreach my $pkg (keys(%pkgs)) {
 	}
 	$dir = dirname($fn);
 	if(! -d "$dldir/$dir") {
-	    mkpath(["$dldir/$dir"], 0, 0755);
+	    make_path("$dldir/$dir", { mode => 0755 });
 	}
 	@info = @{$pkgfiles{$fn}};
 	$csize = int($info[1]/1024)+1;
@@ -615,7 +615,7 @@ if (yesno('y', "\nDo you wish to delete the installed package (.deb) files?")) {
 
 # remove whole ./debian directory if user wants to
 if (yesno('n', "\nDo you want to remove $dldir directory?")) {
-    rmtree("$dldir");
+    remove_tree($dldir);
 }
 
 #Store useful md5sums

+ 4 - 4
scripts/Dpkg/Source/Package/V2.pm

@@ -42,7 +42,7 @@ use POSIX qw(:errno_h);
 use Cwd;
 use File::Basename;
 use File::Temp qw(tempfile tempdir);
-use File::Path;
+use File::Path qw(make_path);
 use File::Spec;
 use File::Find;
 use File::Copy;
@@ -537,7 +537,7 @@ sub do_build {
 
     # Install the diff as the new autopatch
     if ($self->{options}{auto_commit}) {
-        mkpath(File::Spec->catdir($dir, 'debian', 'patches'));
+        make_path(File::Spec->catdir($dir, 'debian', 'patches'));
         $autopatch = $self->register_patch($dir, $tmpdiff,
                                            $self->get_autopatch_name());
         info(g_('local changes have been recorded in a new patch: %s'),
@@ -679,7 +679,7 @@ sub do_commit {
         $patch_name =~ s/\s+/-/g;
         $patch_name =~ s/\///g;
     }
-    mkpath(File::Spec->catdir($dir, 'debian', 'patches'));
+    make_path(File::Spec->catdir($dir, 'debian', 'patches'));
     my $patch = $self->register_patch($dir, $tmpdiff, $patch_name);
     my @editors = ('sensible-editor', $ENV{VISUAL}, $ENV{EDITOR}, 'vi');
     my $editor = first { find_command($_) } @editors;
@@ -750,7 +750,7 @@ sub update_debian_source_include_binaries {
     return unless scalar(@unknown_binaries);
 
     my $incbin_file = $self->{include_binaries_path};
-    mkpath(File::Spec->catdir($self->{dir}, 'debian', 'source'));
+    make_path(File::Spec->catdir($self->{dir}, 'debian', 'source'));
     open(my $incbin_fh, '>>', $incbin_file)
         or syserr(g_('cannot write %s'), $incbin_file);
     foreach my $binary (@unknown_binaries) {

+ 2 - 2
scripts/Dpkg/Source/Patch.pm

@@ -30,7 +30,7 @@ use POSIX qw(:errno_h :sys_wait_h);
 use File::Find;
 use File::Basename;
 use File::Spec;
-use File::Path;
+use File::Path qw(make_path);
 use File::Compare;
 use Fcntl ':mode';
 #XXX: Needed for sub-second timestamps, require recent perl
@@ -549,7 +549,7 @@ sub prepare_apply {
     my ($self, $analysis, %opts) = @_;
     if ($opts{create_dirs}) {
 	foreach my $dir (keys %{$analysis->{dirtocreate}}) {
-	    eval { mkpath($dir, 0, 0777); };
+	    eval { make_path($dir, { mode => 0777 }); };
 	    syserr(g_('cannot create directory %s'), $dir) if $@;
 	}
     }

+ 2 - 2
scripts/dpkg-name.pl

@@ -22,7 +22,7 @@ use warnings;
 use strict;
 
 use File::Basename;
-use File::Path;
+use File::Path qw(make_path);
 
 use Dpkg ();
 use Dpkg::Gettext;
@@ -183,7 +183,7 @@ sub move($)
         my $dir = getdir($filename, $fields, $arch);
         if (! -d $dir) {
             if ($options{createdir}) {
-                if (mkpath($dir)) {
+                if (make_path($dir)) {
                     info(g_("created directory '%s'"), $dir);
                 } else {
                     error(g_("cannot create directory '%s'"), $dir);