diff options
author | Guillem Jover <guillem@debian.org> | 2019-05-01 23:19:17 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2019-10-12 16:37:22 +0200 |
commit | 1973a0789cea5ac0e7da10a81cc5cca8384200df (patch) | |
tree | c3cc7693f17610d1b65fc47c37dedf64b4e6a5ca | |
parent | 522e3b46ee9861f6e1b87124066d716a5b6a6c0c (diff) | |
download | dpkg-1973a0789cea5ac0e7da10a81cc5cca8384200df.tar.gz |
perl: Use File::Copy instead of spawning mv/cp commands
We use cp() in Dpkg::Source::Package to preserve the file attributes,
but just move() in dpkg-buildpackage where it does not matter.
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | scripts/Dpkg/Source/Package.pm | 5 | ||||
-rwxr-xr-x | scripts/dpkg-buildpackage.pl | 4 |
3 files changed, 6 insertions, 4 deletions
diff --git a/debian/changelog b/debian/changelog index bcec8748f..0418c6fe6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -20,6 +20,7 @@ dpkg (1.20.0) UNRELEASED; urgency=medium - man: Fix uncommon wording constructs. * Code internals: - Dpkg::Source::Package: Refactor original tarball handling. + - perl: Use File::Copy instead of spawning mv/cp commands. * Build system: - Bump minimal Perl version to 5.24.1. diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm index df3ac8737..e800a6392 100644 --- a/scripts/Dpkg/Source/Package.pm +++ b/scripts/Dpkg/Source/Package.pm @@ -44,6 +44,7 @@ our @EXPORT_OK = qw( use Exporter qw(import); use POSIX qw(:errno_h :sys_wait_h); use Carp; +use File::Copy qw(cp); use File::Basename; use Dpkg::Gettext; @@ -519,8 +520,8 @@ sub extract { my $src = File::Spec->catfile($self->{basedir}, $orig); my $dst = File::Spec->catfile($destdir, $orig); if (not check_files_are_the_same($src, $dst, 1)) { - system('cp', '--', $src, $dst); - subprocerr("cp $src to $dst") if $?; + cp($src, $dst) + or syserror(g_('cannot copy %s to %s'), $src, $dst); } } } diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl index e48f972a9..2c49738b5 100755 --- a/scripts/dpkg-buildpackage.pl +++ b/scripts/dpkg-buildpackage.pl @@ -851,8 +851,8 @@ sub signfile { '--output', "$signfile.asc", $signfile); my $status = $?; if ($status == 0) { - system('mv', '--', "$signfile.asc", "../$file") - and subprocerr('mv'); + move("$signfile.asc", "../$file") + or syserror(g_('cannot move %s to %s'), "$signfile.asc", "../$file"); } print "\n"; |