From e95be8610dbcf027a75c3e5c7bfe42b5b7c25077 Mon Sep 17 00:00:00 2001 From: Klaus Kaempf Date: Wed, 13 Aug 2008 08:25:36 +0000 Subject: [PATCH] if -r (root dir) is given, its also honored by -p (product dir) --- tools/rpmdb2solv.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/tools/rpmdb2solv.c b/tools/rpmdb2solv.c index 1e015ef..d9b402a 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); -- 2.7.4