summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-09-09 07:53:57 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-09-09 07:53:57 +0000
commitebc5b185c360f22186df959c44d60bcc66584735 (patch)
tree64b4d447c2d65a8290ca1b6b13ce07ec1eadf0bf
parent2a8c9bbf146a8a12247dbe93884785367d71c462 (diff)
downloadurpmi-ebc5b185c360f22186df959c44d60bcc66584735.tar
urpmi-ebc5b185c360f22186df959c44d60bcc66584735.tar.gz
urpmi-ebc5b185c360f22186df959c44d60bcc66584735.tar.bz2
urpmi-ebc5b185c360f22186df959c44d60bcc66584735.tar.xz
urpmi-ebc5b185c360f22186df959c44d60bcc66584735.zip
add whereis_binary()
(needed in upcoming should_we_migrate_back_rpmdb_db_version())
-rw-r--r--urpm/sys.pm13
1 files changed, 13 insertions, 0 deletions
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) = @_;