#define _GNU_SOURCE
#include <sys/types.h>
-#include <limits.h>
-#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
-#include <zlib.h>
-#include <getopt.h>
+#include <unistd.h>
#include "pool.h"
#include "repo.h"
usage(int status)
{
fprintf(stderr, "\nUsage:\n"
- "susetags2solv [-b <base>][-c <content>][-d <descrdir>][-h][-n <name>]\n"
+ "susetags2solv [-c <content>][-d <descrdir>][-h][-n <name>]\n"
" reads a 'susetags' repository from <stdin> and writes a .solv file to <stdout>\n"
- " -b <base>: save as multiple files starting with <base>\n"
" -c <contentfile> : parse given contentfile (for product information)\n"
" -d <descrdir> : do not read from stdin, but use data in descrdir\n"
" -h : print help & exit\n"
- " -n <name>: save attributes as <name>.attr\n"
);
exit(status);
}
main(int argc, char **argv)
{
const char *contentfile = 0;
- const char *attrname = 0;
const char *descrdir = 0;
- const char *basefile = 0;
const char *query = 0;
const char *mergefile = 0;
Id defvendor = 0;
Pool *pool;
Repo *repo;
- while ((c = getopt(argc, argv, "hn:c:d:b:q:M:X")) >= 0)
+ while ((c = getopt(argc, argv, "hc:d:q:M:X")) >= 0)
{
switch (c)
{
case 'h':
usage(0);
break;
- case 'n':
- attrname = optarg;
- break;
case 'c':
contentfile = optarg;
break;
case 'd':
descrdir = optarg;
break;
- case 'b':
- basefile = optarg;
- break;
case 'q':
query = optarg;
break;
fclose(fp);
}
- if (attrname)
- {
- /* ensure '.attr' suffix */
- const char *dot = strrchr(attrname, '.');
- if (!dot || strcmp(dot, ".attr"))
- {
- int len = strlen (attrname);
- char *newname = (char *)malloc(len + 6); /* alloc for <attrname>+'.attr'+'\0' */
- strcpy (newname, attrname);
- strcpy (newname+len, ".attr");
- attrname = newname;
- }
- }
-
/*
* descrdir path given, open files and read from there
*/
perror(fn);
exit(1);
}
- if (repo_add_susetags(repo, fp, defvendor, 0, flags | REPO_REUSE_REPODATA | REPO_NO_INTERNALIZE))
+ if (repo_add_susetags(repo, fp, defvendor, 0, flags | REPO_REUSE_REPODATA | REPO_NO_INTERNALIZE | SUSETAGS_RECORD_SHARES))
{
fprintf(stderr, "susetags2solv: %s: %s\n", fnp, pool_errstr(pool));
exit(1);
if (query)
doquery(pool, repo, query);
else
- tool_write(repo, basefile, attrname);
+ tool_write(repo, stdout);
pool_free(pool);
exit(0);
}