diff options
author | Michael Schroeder <mls@suse.de> | 2008-11-19 10:47:18 +0000 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2008-11-19 10:47:18 +0000 |
commit | 9fb91875d50b62918548fb14a0e94c25016bc315 (patch) | |
tree | 2a6dbfcb1ff31344b611311ba78d20caa7f31985 /tools/rpmdb2solv.c | |
parent | a6cdc4e57c480df9fb2aad5029cfcdff992b5a0d (diff) | |
download | libsolv-9fb91875d50b62918548fb14a0e94c25016bc315.tar.gz libsolv-9fb91875d50b62918548fb14a0e94c25016bc315.tar.bz2 libsolv-9fb91875d50b62918548fb14a0e94c25016bc315.zip |
- get rid of that horrible rpmdb2solv hack, it's not used any more
Diffstat (limited to 'tools/rpmdb2solv.c')
-rw-r--r-- | tools/rpmdb2solv.c | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/tools/rpmdb2solv.c b/tools/rpmdb2solv.c index b559777..f4bea47 100644 --- a/tools/rpmdb2solv.c +++ b/tools/rpmdb2solv.c @@ -34,7 +34,6 @@ usage(int status) { fprintf(stderr, "\nUsage:\n" "rpmdb2solv [-n] [-x] [-b <basefile>] [-p <productsdir>] [-r <root>]\n" - " -a <attr> : Only print this attribute, no .solv generation. E.g. '-a distribution.target'\n" " -n : No packages, do not read rpmdb, useful to only parse products\n" " -x : use extrapool\n" " -b <basefile> : Write .solv to <basefile>.solv instead of stdout\n" @@ -52,30 +51,26 @@ main(int argc, char **argv) Pool *pool = pool_create(); Repo *repo, *ref = 0; Repodata *data; - FILE *fp; Pool *refpool; int c, percent = 0; int extrapool = 0; int nopacks = 0; const char *root = 0; const char *basefile = 0; + const char *refname = 0; char *proddir = 0; - const char *attribute = 0; char *outfile = 0; /* * parse arguments */ - while ((c = getopt(argc, argv, "Pa:hnxb:r:p:o:")) >= 0) + while ((c = getopt(argc, argv, "Phnxb:r:p:o:")) >= 0) switch (c) { case 'h': usage(0); break; - case 'a': - attribute = optarg; - break; case 'r': root = optarg; break; @@ -108,24 +103,31 @@ main(int argc, char **argv) } /* - * ??? + * optional arg is old version of rpmdb solv file + * should make this a real option instead */ if (optind < argc) + refname = argv[optind]; + + if (refname) { - if (extrapool) - refpool = pool_create(); - else - refpool = pool; - if ((fp = fopen(argv[optind], "r")) == NULL) + FILE *fp; + if ((fp = fopen(refname, "r")) == NULL) { - perror(argv[optind]); - exit(1); + perror(refname); } - ref = repo_create(refpool, "ref"); - repo_add_solv(ref, fp); - repo_disable_paging(ref); - fclose(fp); + else + { + if (extrapool) + refpool = pool_create(); + else + refpool = pool; + ref = repo_create(refpool, "ref"); + repo_add_solv(ref, fp); + repo_disable_paging(ref); + fclose(fp); + } } /* @@ -157,7 +159,7 @@ main(int argc, char **argv) strcpy(buf + rootlen, proddir); } } - repo_add_products(repo, proddir, root, attribute, REPO_REUSE_REPODATA | REPO_NO_INTERNALIZE); + repo_add_products(repo, proddir, root, REPO_REUSE_REPODATA | REPO_NO_INTERNALIZE); if (buf != proddir) sat_free(buf); } @@ -173,10 +175,7 @@ main(int argc, char **argv) ref = 0; } - if (!attribute) - tool_write(repo, basefile, 0); - + tool_write(repo, basefile, 0); pool_free(pool); - exit(0); } |