From: Klaus Kaempf Date: Wed, 13 Aug 2008 08:25:36 +0000 (+0000) Subject: if -r (root dir) is given, its also honored by -p (product dir) X-Git-Tag: BASE-SuSE-Code-12_1-Branch~308^2~266 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e95be8610dbcf027a75c3e5c7bfe42b5b7c25077;p=thirdparty%2Flibsolv.git if -r (root dir) is given, its also honored by -p (product dir) --- diff --git a/tools/rpmdb2solv.c b/tools/rpmdb2solv.c index 1e015ef5..d9b402ad 100644 --- a/tools/rpmdb2solv.c +++ b/tools/rpmdb2solv.c @@ -103,9 +103,31 @@ main(int argc, char **argv) if (!nopacks) repo_add_rpmdb(repo, repodata, ref, root); - if (proddir) - repo_add_products(repo, repodata, proddir); - + if (proddir && *proddir) + { + /* if given, not '/', and proddir does not start with */ + if (root && *root) + { + int rootlen = strlen(root); + if (strncmp(root, proddir, rootlen)) + { + char *buf; + buf = (char *)sat_malloc(rootlen + strlen(proddir) + 2); /* + '/' + \0 */ + strcpy(buf, root); + if (root[rootlen-1] != '/' + && *proddir != '/') + { + strcpy(buf+rootlen, "/"); + ++rootlen; + } + strcpy(buf+rootlen, proddir); + proddir = buf; + } + } + + repo_add_products(repo, repodata, proddir); + } + if (repodata) repodata_internalize(repodata);