From ebc5b185c360f22186df959c44d60bcc66584735 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 9 Sep 2008 07:53:57 +0000 Subject: add whereis_binary() (needed in upcoming should_we_migrate_back_rpmdb_db_version()) --- urpm/sys.pm | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'urpm/sys.pm') diff --git a/urpm/sys.pm b/urpm/sys.pm index 631c7016..2e36a273 100644 --- a/urpm/sys.pm +++ b/urpm/sys.pm @@ -108,6 +108,19 @@ sub _expand_symlink { $pdir; } +sub whereis_binary { + my ($prog, $o_prefix) = @_; + if ($prog =~ m!/!) { + warn qq(don't call whereis_binary with a name containing a "/" (the culprit is: $prog)\n); + return; + } + my $prefix = $o_prefix || ''; + foreach (split(':', $ENV{PATH})) { + my $f = "$_/$prog"; + -x "$prefix$f" and return $f; + } +} + sub may_clean_rpmdb_shared_regions { my ($urpm, $test) = @_; -- cgit v1.2.1