[dpkg] 171/192: Dpkg::Source::Package::V3: Use find_command() instead of ad-hoc code
Ximin Luo
infinity0 at debian.org
Tue Oct 17 11:04:15 UTC 2017
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch pu/reproducible_builds
in repository dpkg.
commit e48a0b532be96f587c5d479c150ba50857792fff
Author: Guillem Jover <guillem at debian.org>
Date: Fri Oct 6 09:39:07 2017 +0200
Dpkg::Source::Package::V3: Use find_command() instead of ad-hoc code
---
debian/changelog | 2 ++
scripts/Dpkg/Source/Package/V3/Bzr.pm | 7 ++-----
scripts/Dpkg/Source/Package/V3/Git.pm | 7 ++-----
3 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index f2230e3..e481b07 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -104,6 +104,8 @@ dpkg (1.19.0) UNRELEASED; urgency=medium
by switching from a capturing regex to split() plus a checking regex.
- Auto-convert binary signatures to OpenPGP ASCII Armor in
Dpkg::Source::Package when building source packages.
+ - Switch Dpkg::Source::Package::V3 modules to use find_command() instead
+ of ad-hoc code.
* Documentation:
- Document currently accepted syntax for changelogs in deb-changelog(5).
Closes: #858579
diff --git a/scripts/Dpkg/Source/Package/V3/Bzr.pm b/scripts/Dpkg/Source/Package/V3/Bzr.pm
index 7264e1e..4df7959 100644
--- a/scripts/Dpkg/Source/Package/V3/Bzr.pm
+++ b/scripts/Dpkg/Source/Package/V3/Bzr.pm
@@ -36,6 +36,7 @@ use Dpkg::Compression;
use Dpkg::ErrorHandling;
use Dpkg::Source::Archive;
use Dpkg::Exit qw(push_exit_handler pop_exit_handler);
+use Dpkg::Path qw(find_command);
use Dpkg::Source::Functions qw(erasedir);
use parent qw(Dpkg::Source::Package);
@@ -43,11 +44,7 @@ use parent qw(Dpkg::Source::Package);
our $CURRENT_MINOR_VERSION = '0';
sub import {
- foreach my $dir (split(/:/, $ENV{PATH})) {
- if (-x "$dir/bzr") {
- return 1;
- }
- }
+ return 1 if find_command('bzr');
error(g_('cannot unpack bzr-format source package because ' .
'bzr is not in the PATH'));
}
diff --git a/scripts/Dpkg/Source/Package/V3/Git.pm b/scripts/Dpkg/Source/Package/V3/Git.pm
index 3113ca4..72a2499 100644
--- a/scripts/Dpkg/Source/Package/V3/Git.pm
+++ b/scripts/Dpkg/Source/Package/V3/Git.pm
@@ -31,6 +31,7 @@ use File::Temp qw(tempdir);
use Dpkg::Gettext;
use Dpkg::ErrorHandling;
use Dpkg::Exit qw(push_exit_handler pop_exit_handler);
+use Dpkg::Path qw(find_command);
use Dpkg::Source::Functions qw(erasedir);
use parent qw(Dpkg::Source::Package);
@@ -46,11 +47,7 @@ delete $ENV{GIT_ALTERNATE_OBJECT_DIRECTORIES};
delete $ENV{GIT_WORK_TREE};
sub import {
- foreach my $dir (split(/:/, $ENV{PATH})) {
- if (-x "$dir/git") {
- return 1;
- }
- }
+ return 1 if find_command('git');
error(g_('cannot unpack git-format source package because ' .
'git is not in the PATH'));
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git
More information about the Reproducible-commits
mailing list