From 3972294e28309fc18baa53999eefe1f937b26b10 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Sat, 21 Jun 2014 18:41:23 +0200 Subject: (_find_file) introduce it either file has an absolute path and we check for its existence or it has not and we assume it's a binary to lookup in $PATH thus fixing a warning in mousedrake since commit be1d69418fda6e16422d634c59b54375bfa7a897 --- perl-install/do_pkgs.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'perl-install/do_pkgs.pm') diff --git a/perl-install/do_pkgs.pm b/perl-install/do_pkgs.pm index 5ca4b24fc..8b56be26c 100644 --- a/perl-install/do_pkgs.pm +++ b/perl-install/do_pkgs.pm @@ -111,6 +111,16 @@ sub ensure_binary_is_installed { 1; } +sub _find_file { + my ($file) = @_; + if ($file =~ m!/!) { + -e "$::prefix$file"; + } else { + # assume it's a binary to search in $PATH: + whereis_binary($file, $prefix); + } +} + =item ensure_files_are_installed($do, $pkgs, $b_auto) Takes a list of [ "package", "file" ] and installs package if file is not there. @@ -121,7 +131,7 @@ If $b_auto is set, (g)urpmi will not ask any questions. sub ensure_files_are_installed { my ($do, $pkgs, $b_auto) = @_; - my @not_installed = map { my ($package, $file) = @$_; if_(!whereis_binary($file, $::prefix), $package) } @$pkgs; + my @not_installed = map { my ($package, $file) = @$_; if_(!_find_file($file), $package) } @$pkgs; return 1 if !@not_installed; $do->in->ask_okcancel(N("Warning"), N("The following packages need to be installed:\n") . join(', ', @not_installed), 1) -- cgit v1.2.1