]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Fix example to work with new and legacy appdata dirs.
authorAtri Bhattacharya <badshah400@gmail.com>
Wed, 20 Jul 2016 18:17:01 +0000 (20:17 +0200)
committerAtri Bhattacharya <badshah400@gmail.com>
Wed, 20 Jul 2016 18:17:01 +0000 (20:17 +0200)
examples/solv/repoinfo_system_rpm.c

index b385d726db754a3931d286dfdf150b572664842c..4926ecd22c2d1240c904071355ef651b9c6195c0 100644 (file)
@@ -27,7 +27,8 @@
 # define PRODUCTS_PATH "/etc/products.d"
 #endif
 #ifdef ENABLE_APPDATA
-# define APPDATA_PATH "/usr/share/appdata"
+# define APPDATA_PATH "/usr/share/metainfo"
+# define APPDATA_LEGACY_PATH "/usr/share/appdata"
 #endif
 
 static void
@@ -101,6 +102,12 @@ read_installed_rpm(struct repoinfo *cinfo)
       fprintf(stderr, "appdata reading failed: %s\n", pool_errstr(pool));
       return 0;
     }
+#elif defined(ENABLE_APPDATA) && defined(APPDATA_LEGACY_PATH)
+  if (repo_add_appdata_dir(repo, APPDATA_LEGACY_PATH, REPO_REUSE_REPODATA | REPO_NO_INTERNALIZE | REPO_USE_ROOTDIR))
+    {
+      fprintf(stderr, "appdata reading from legacy dir failed: %s\n", pool_errstr(pool));
+      return 0;
+    }
 #endif
   ofp = fopen(calc_cachepath(repo, 0, 0), "r");
   if (repo_add_rpmdb_reffp(repo, ofp, REPO_REUSE_REPODATA | REPO_NO_INTERNALIZE | REPO_USE_ROOTDIR))