Skip to content

Commit 0fea167

Browse files
committed
for .src.rpm files properly identify missing utils #869
Also fix latent bug in external_utility_exists() for the secondary case of using 'which' -- need to strip args from supplied exe first.
1 parent fd8d789 commit 0fea167

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

Unix/cloc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13857,7 +13857,7 @@ sub uncompress_archive_cmd { # {{{1
1385713857
$missing = "rpm2cpio";
1385813858
}
1385913859
} else {
13860-
$missing = "bzip2";
13860+
$missing = "cpio";
1386113861
}
1386213862
} elsif ($archive_file =~ /\.(whl|zip)$/i and !$ON_WINDOWS) {
1386313863
if (external_utility_exists("unzip")) {
@@ -13930,13 +13930,17 @@ sub read_list_file { # {{{1
1393013930
sub external_utility_exists { # {{{1
1393113931
my $exe = shift @_;
1393213932

13933+
# remove args, if any
13934+
my $leading_exe = $exe;
13935+
$leading_exe =~ s/^(\S+)\s*.*?$/$1/;
13936+
1393313937
my $success = 0;
1393413938
if ($ON_WINDOWS) {
1393513939
$success = 1 unless system $exe . ' > nul';
1393613940
} else {
1393713941
$success = 1 unless system $exe . ' >/dev/null 2>&1';
1393813942
if (!$success) {
13939-
$success = 1 unless system "which" . " $exe" . ' >/dev/null 2>&1';
13943+
$success = 1 unless system "which" . " $leading_exe" . ' >/dev/null 2>&1';
1394013944
}
1394113945
}
1394213946

cloc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13847,7 +13847,7 @@ sub uncompress_archive_cmd { # {{{1
1384713847
$missing = "rpm2cpio";
1384813848
}
1384913849
} else {
13850-
$missing = "bzip2";
13850+
$missing = "cpio";
1385113851
}
1385213852
} elsif ($archive_file =~ /\.(whl|zip)$/i and !$ON_WINDOWS) {
1385313853
if (external_utility_exists("unzip")) {
@@ -13920,13 +13920,17 @@ sub read_list_file { # {{{1
1392013920
sub external_utility_exists { # {{{1
1392113921
my $exe = shift @_;
1392213922

13923+
# remove args, if any
13924+
my $leading_exe = $exe;
13925+
$leading_exe =~ s/^(\S+)\s*.*?$/$1/;
13926+
1392313927
my $success = 0;
1392413928
if ($ON_WINDOWS) {
1392513929
$success = 1 unless system $exe . ' > nul';
1392613930
} else {
1392713931
$success = 1 unless system $exe . ' >/dev/null 2>&1';
1392813932
if (!$success) {
13929-
$success = 1 unless system "which" . " $exe" . ' >/dev/null 2>&1';
13933+
$success = 1 unless system "which" . " $leading_exe" . ' >/dev/null 2>&1';
1393013934
}
1393113935
}
1393213936

0 commit comments

Comments
 (0)