X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tools%2Frpmmd2solv.c;h=ad75025ea419abe36902c0c59d8d2c36061b30ff;hb=1aac48dff40ef592968a18058bad270da65ed847;hp=eee17ee48ef709421c3fadf0d4357e63acfc9099;hpb=b33428b853d91ff15eee32fd1407ae0924a56bb7;p=platform%2Fupstream%2Flibsolv.git diff --git a/tools/rpmmd2solv.c b/tools/rpmmd2solv.c index eee17ee..ad75025 100644 --- a/tools/rpmmd2solv.c +++ b/tools/rpmmd2solv.c @@ -5,25 +5,73 @@ * for further information */ +#define _GNU_SOURCE + #include -#include -#include #include #include #include +#include #include "pool.h" #include "repo.h" #include "repo_rpmmd.h" +#ifdef SUSE +#include "repo_autopattern.h" +#endif #include "common_write.h" +#include "solv_xfopen.h" + + +static void +usage(int status) +{ + fprintf(stderr, "\nUsage:\n" + "rpmmd2solv [-h]\n" + " reads 'primary' from a 'rpmmd' repository from and writes a .solv file to \n" + " -h : print help & exit\n" + ); + exit(status); +} int main(int argc, char **argv) { + int c; +#ifdef SUSE + int add_auto = 0; +#endif + Pool *pool = pool_create(); Repo *repo = repo_create(pool, ""); - repo_add_rpmmd(repo, stdin); - tool_write(repo, 0, 0); + + while ((c = getopt (argc, argv, "hX")) >= 0) + { + switch (c) + { + case 'h': + usage(0); + break; + case 'X': +#ifdef SUSE + add_auto = 1; +#endif + break; + default: + usage(1); + break; + } + } + if (repo_add_rpmmd(repo, stdin, 0, 0)) + { + fprintf(stderr, "rpmmd2solv: %s\n", pool_errstr(pool)); + exit(1); + } +#ifdef SUSE + if (add_auto) + repo_add_autopattern(repo, 0); +#endif + tool_write(repo, stdout); pool_free(pool); exit(0); }