[Libguestfs] [PATCH 1/2] lib: Allow db_dump package to be a weak dependency (RHBZ#1409024).

Richard W.M. Jones rjones at redhat.com
Thu Oct 5 13:41:31 UTC 2017


---
 lib/inspect-apps.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/inspect-apps.c b/lib/inspect-apps.c
index f0cf16b38..020a3332c 100644
--- a/lib/inspect-apps.c
+++ b/lib/inspect-apps.c
@@ -122,9 +122,14 @@ guestfs_impl_inspect_list_applications2 (guestfs_h *g, const char *root)
   if (STREQ (type, "linux") || STREQ (type, "hurd")) {
     if (STREQ (package_format, "rpm")) {
 #ifdef DB_DUMP
-      ret = list_applications_rpm (g, root);
-      if (ret == NULL)
-        return NULL;
+      /* Allow db_dump to be missing at runtime so that it can be
+       * installed as a weak dependency.
+       */
+      if (system (DB_DUMP " -V >/dev/null 2>&1") == 0) {
+        ret = list_applications_rpm (g, root);
+        if (ret == NULL)
+          return NULL;
+      }
 #endif
     }
     else if (STREQ (package_format, "deb")) {
-- 
2.13.2




More information about the Libguestfs mailing list