From: Atri Bhattacharya Date: Wed, 20 Jul 2016 18:17:01 +0000 (+0200) Subject: Fix example to work with new and legacy appdata dirs. X-Git-Tag: 0.6.23~3^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19a561ded2cadc14844e3bcb05306918d566c10c;p=thirdparty%2Flibsolv.git Fix example to work with new and legacy appdata dirs. --- diff --git a/examples/solv/repoinfo_system_rpm.c b/examples/solv/repoinfo_system_rpm.c index b385d726..4926ecd2 100644 --- a/examples/solv/repoinfo_system_rpm.c +++ b/examples/solv/repoinfo_system_rpm.c @@ -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))