39 lines
1.2 KiB
Diff
39 lines
1.2 KiB
Diff
From d78c898c7e2bc5f12cbebef98b95a7908d9120f1 Mon Sep 17 00:00:00 2001
|
|
From: Pino Toscano <ptoscano@redhat.com>
|
|
Date: Tue, 7 Oct 2014 11:51:15 +0200
|
|
Subject: [PATCH] rpm: check for providers for not found package
|
|
|
|
If a package is not found among the ones installed, check whether there
|
|
is any other package providing it (only a single one).
|
|
---
|
|
src/rpm.ml | 13 ++++++++++++-
|
|
1 file changed, 12 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/rpm.ml b/src/rpm.ml
|
|
index 71cdab2..b5c5ff5 100644
|
|
--- a/src/rpm.ml
|
|
+++ b/src/rpm.ml
|
|
@@ -158,7 +158,18 @@ let rpm_package_of_string str =
|
|
Not_found ->
|
|
let r =
|
|
try Some (pkg_of_rpm (query str))
|
|
- with Not_found -> None in
|
|
+ with Not_found ->
|
|
+ try
|
|
+ let p = rpm_pkg_whatprovides (get_rpm ()) str in
|
|
+ (* Pick only a provided package when there is just one of them,
|
|
+ * otherwise there is no reliable way to know which one to pick
|
|
+ * if there are multiple providers.
|
|
+ *)
|
|
+ if Array.length p = 1 then
|
|
+ Some (pkg_of_rpm (query p.(0)))
|
|
+ else
|
|
+ None
|
|
+ with Not_found -> None in
|
|
Hashtbl.add rpmh str r;
|
|
r
|
|
|
|
--
|
|
1.9.3
|
|
|