* for further information
*/
-#define RPMMD_KINDS_SEPARATELY (1 << 2)
-
extern void repo_add_rpmmd(Repo *repo, FILE *fp, const char *language, int flags);
cummulate = 0;
switch (tag_from_string(line)) /* check if accumulation is needed */
{
- case CTAG('+', 'P', 'r', 'q'):
- case CTAG('+', 'P', 'r', 'c'):
- case CTAG('+', 'P', 's', 'g'):
- if (!pd.kind || !(flags & SUSETAGS_KINDS_SEPARATELY))
- break;
case CTAG('+', 'D', 'e', 's'):
case CTAG('+', 'E', 'u', 'l'):
case CTAG('+', 'I', 'n', 's'):
case CTAG('+', 'A', 'u', 't'):
if (line[4] == ':')
cummulate = 1;
+ break;
+ default:
+ break;
}
line[0] = '='; /* handle lines between +Key:/-Key: as =Key: */
line[intag + keylen - 1] = ' ';
case CTAG('=', 'P', 'r', 'q'): /* pre-requires / packages required */
if (pd.kind)
{
- if (flags & SUSETAGS_KINDS_SEPARATELY)
- repodata_set_poolstr(data, handle, str2id(pool, "solvable:must", 1), line + 6);
- else
- s->requires = adddep(pool, &pd, s->requires, line, 0, 0); /* patterns: a required package */
+ s->requires = adddep(pool, &pd, s->requires, line, 0, 0); /* patterns: a required package */
}
else
s->requires = adddep(pool, &pd, s->requires, line, SOLVABLE_PREREQMARKER, 0); /* package: pre-requires */
freshens = adddep(pool, &pd, freshens, line, 0, pd.kind);
continue;
case CTAG('=', 'P', 'r', 'c'): /* packages recommended */
- if (flags & SUSETAGS_KINDS_SEPARATELY)
- repodata_set_poolstr(data, handle, str2id(pool, "solvable:should", 1), line + 6);
- else
- s->recommends = adddep(pool, &pd, s->recommends, line, 0, 0);
+ s->recommends = adddep(pool, &pd, s->recommends, line, 0, 0);
continue;
case CTAG('=', 'P', 's', 'g'): /* packages suggested */
- if (flags & SUSETAGS_KINDS_SEPARATELY)
- repodata_set_poolstr(data, handle, str2id(pool, "solvable:may", 1), line + 6);
- else
- s->suggests = adddep(pool, &pd, s->suggests, line, 0, 0);
+ s->suggests = adddep(pool, &pd, s->suggests, line, 0, 0);
continue;
case CTAG('=', 'P', 'c', 'n'): /* pattern: package conflicts */
- if (flags & SUSETAGS_KINDS_SEPARATELY)
- fprintf(stderr, "Unsupported: pattern -> package conflicts\n");
- else
- s->conflicts = adddep(pool, &pd, s->conflicts, line, 0, 0);
+ s->conflicts = adddep(pool, &pd, s->conflicts, line, 0, 0);
continue;
case CTAG('=', 'P', 'o', 'b'): /* pattern: package obsoletes */
- if (flags & SUSETAGS_KINDS_SEPARATELY)
- fprintf(stderr, "Unsupported: pattern -> package obsoletes\n");
- else
- s->obsoletes = adddep(pool, &pd, s->obsoletes, line, 0, 0);
+ s->obsoletes = adddep(pool, &pd, s->obsoletes, line, 0, 0);
continue;
case CTAG('=', 'P', 'f', 'r'): /* pattern: package freshens */
- if (flags & SUSETAGS_KINDS_SEPARATELY)
- fprintf(stderr, "Unsupported: pattern -> package freshens\n");
- else
- freshens = adddep(pool, &pd, freshens, line, 0, 0);
+ freshens = adddep(pool, &pd, freshens, line, 0, 0);
continue;
case CTAG('=', 'P', 's', 'p'): /* pattern: package supplements */
- if (flags & SUSETAGS_KINDS_SEPARATELY)
- fprintf(stderr, "Unsupported: pattern -> package supplements\n");
- else
- s->supplements = adddep(pool, &pd, s->supplements, line, 0, 0);
+ s->supplements = adddep(pool, &pd, s->supplements, line, 0, 0);
continue;
case CTAG('=', 'P', 'e', 'n'): /* pattern: package enhances */
- if (flags & SUSETAGS_KINDS_SEPARATELY)
- fprintf(stderr, "Unsupported: pattern -> package enhances\n");
- else
- s->enhances = adddep(pool, &pd, s->enhances, line, 0, 0);
+ s->enhances = adddep(pool, &pd, s->enhances, line, 0, 0);
continue;
case CTAG('=', 'V', 'e', 'r'): /* - version - */
last_found_pack = 0;
* if <attrname> given, write attributes as '<attrname>.attr'
*/
-#define SUSETAGS_KINDS_SEPARATELY (1 << 8)
#define SUSETAGS_EXTEND (1 << 9)
extern void repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int flags);
struct stateswitch *sw;
#if 0
- fprintf(stderr, "start: [%d]%s\n", pd->state, name);
+ fprintf(stderr, "start: [%d]%s\n", pd->state, name);
#endif
if (pd->depth != pd->statedepth)
{
Solvable *s = pd->solvable;
#if 0
- fprintf(stderr, "end: [%d]%s\n", pd->state, name);
+ fprintf(stderr, "end: [%d]%s\n", pd->state, name);
#endif
if (pd->depth != pd->statedepth)
{
pd->docontent = 0;
#if 0
- fprintf(stderr, "end: [%s] -> %d\n", name, pd->state);
+ fprintf(stderr, "end: [%s] -> %d\n", name, pd->state);
#endif
}
struct parsedata *pd = userData;
int l;
char *c;
- if (!pd->docontent) {
-#if 0
- char *dup = strndup( s, len );
- fprintf(stderr, "Content: [%d]'%s'\n", pd->state, dup );
- free( dup );
-#endif
+ if (!pd->docontent)
return;
- }
l = pd->lcontent + len + 1;
if (l > pd->acontent)
{
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include "pool.h"
#include "repo.h"
#include "common_write.h"
static void
-usage(const char *err)
+usage(int status)
{
- if (err)
- fprintf(stderr, "\n** Error:\n %s\n", err);
fprintf(stderr, "\nUsage:\n"
- "deltainfoxml2solv [-a][-h][-k][-n <attrname>]\n"
+ "deltainfoxml2solv [-a][-h][-n <attrname>]\n"
" reads a 'deltainfo.xml' file from <stdin> and writes a .solv file to <stdout>\n"
" -h : print help & exit\n"
- " -k : don't mix kinds (experimental!)\n"
" -n <name>: save attributes as <name>.attr\n"
);
- exit(0);
+ exit(status);
}
int
main(int argc, char **argv)
{
- int flags = 0;
+ int c, flags = 0;
char *attrname = 0;
Pool *pool = pool_create();
Repo *repo = repo_create(pool, "<stdin>");
- argv++;
- argc--;
- while (argc--)
- {
- const char *s = argv[0];
- if (*s++ == '-')
- while (*s)
- switch (*s++)
- {
- case 'h': usage(NULL); break;
- case 'n':
- if (argc)
- {
- attrname = argv[1];
- argv++;
- argc--;
- }
- else
- usage("argument required for '-n'");
- break;
- case 'k':
- break;
- default : break;
- }
- argv++;
+ while ((c = getopt(argc, argv, "hn:")) >= 0)
+ {
+ switch(c)
+ {
+ case 'h':
+ usage(0);
+ break;
+ case 'n':
+ attrname = optarg;
+ break;
+ default:
+ usage(1);
+ break;
+ }
}
-
repo_add_deltainfoxml(repo, stdin, flags);
- tool_write(repo, 0, 0);
+ tool_write(repo, 0, attrname);
pool_free(pool);
exit(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include "pool.h"
#include "repo.h"
#include "common_write.h"
static void
-usage(const char *err)
+usage(int status)
{
- if (err)
- fprintf(stderr, "\n** Error:\n %s\n", err);
fprintf(stderr, "\nUsage:\n"
- "diskusagexml2solv [-a][-h][-k][-n <attrname>]\n"
+ "diskusagexml2solv [-a][-h][-n <attrname>]\n"
" reads a 'diskusage.xml' file from <stdin> and writes a .solv file to <stdout>\n"
" -h : print help & exit\n"
- " -k : don't mix kinds (experimental!)\n"
" -n <name>: save attributes as <name>.attr\n"
);
- exit(0);
+ exit(status);
}
int
main(int argc, char **argv)
{
- int flags = 0;
+ int c, flags = 0;
char *attrname = 0;
Pool *pool = pool_create();
Repo *repo = repo_create(pool, "<stdin>");
- argv++;
- argc--;
- while (argc--)
- {
- const char *s = argv[0];
- if (*s++ == '-')
- while (*s)
- switch (*s++)
- {
- case 'h': usage(NULL); break;
- case 'n':
- if (argc)
- {
- attrname = argv[1];
- argv++;
- argc--;
- }
- else
- usage("argument required for '-n'");
- break;
- case 'k':
- break;
- default : break;
- }
- argv++;
+ while ((c = getopt(argc, argv, "hn:")) >= 0)
+ {
+ switch(c)
+ {
+ case 'h':
+ usage(0);
+ break;
+ case 'n':
+ attrname = optarg;
+ break;
+ default:
+ usage(1);
+ break;
+ }
}
-
repo_add_diskusagexml(repo, stdin, flags);
- tool_write(repo, 0, 0);
+ tool_write(repo, 0, attrname);
pool_free(pool);
exit(0);
}
static void
-usage( const char *err )
+usage(int status)
{
- if (err)
- fprintf (stderr, "\n** Error:\n %s\n", err);
fprintf( stderr, "\nUsage:\n"
"dumpsolv [-a] [<solvfile>]\n"
" -a read attributes.\n"
);
- exit(0);
+ exit(status);
}
#if 0
{
Repo *repo;
Pool *pool;
- int i, j, n;
+ int c, i, j, n;
Solvable *s;
pool = pool_create();
pool_setdebuglevel(pool, 1);
pool_setloadcallback(pool, loadcallback, 0);
- argv++;
- argc--;
- while (argc--)
+ while ((c = getopt(argc, argv, "ha")) >= 0)
{
- const char *s = argv[0];
- if (*s++ == '-')
- while (*s)
- switch (*s++)
- {
- case 'h': usage(NULL); break;
- case 'a': with_attr = 1; break;
- default : break;
- }
- else
+ switch(c)
{
- if (freopen (argv[0], "r", stdin) == 0)
- {
- perror(argv[0]);
- exit(1);
- }
- repo = repo_create(pool, argv[0]);
- if (repo_add_solv(repo, stdin))
- printf("could not read repository\n");
+ case 'h':
+ usage(0);
+ break;
+ case 'a':
+ with_attr = 1;
+ break;
+ default:
+ usage(1);
+ break;
}
- argv++;
}
-
+ for (; optind < argc; optind++)
+ {
+ if (freopen(argv[optind], "r", stdin) == 0)
+ {
+ perror(argv[optind]);
+ exit(1);
+ }
+ repo = repo_create(pool, argv[optind]);
+ if (repo_add_solv(repo, stdin))
+ printf("could not read repository\n");
+ }
if (!pool->nrepos)
{
repo = repo_create(pool, argc != 1 ? argv[1] : "<stdin>");
usage(int status)
{
fprintf(stderr, "\nUsage:\n"
- "rpmmd2solv [-a][-h][-k][-n <attrname>][-l <locale>]\n"
+ "rpmmd2solv [-a][-h][-n <attrname>][-l <locale>]\n"
" reads 'primary' from a 'rpmmd' repository from <stdin> and writes a .solv file to <stdout>\n"
" -h : print help & exit\n"
- " -k : don't mix kinds (experimental!)\n"
" -n <name>: save attributes as <name>.attr\n"
" -l <locale>: parse localization data for <locale>\n"
);
Pool *pool = pool_create();
Repo *repo = repo_create(pool, "<stdin>");
- while ((c = getopt (argc, argv, "hkn:b:d:l:")) >= 0)
+ while ((c = getopt (argc, argv, "hn:b:d:l:")) >= 0)
{
switch(c)
{
case 'h':
usage(0);
break;
- case 'k':
- flags |= RPMMD_KINDS_SEPARATELY; /* do not use! */
- break;
case 'n':
attrname = optarg;
break;
usage(int status)
{
fprintf(stderr, "\nUsage:\n"
- "susetags2solv [-b <base>][-c <content>][-d <descrdir>][-h][-k][-n <name>]\n"
+ "susetags2solv [-b <base>][-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"
- " -k : don't mix kinds (experimental!)\n"
" -n <name>: save attributes as <name>.attr\n"
);
exit(status);
int flags = 0;
int c;
- while ((c = getopt(argc, argv, "hkn:c:d:b:q:")) >= 0)
+ while ((c = getopt(argc, argv, "hn:c:d:b:q:")) >= 0)
{
switch (c)
{
case 'h':
usage(0);
break;
- case 'k':
- flags |= SUSETAGS_KINDS_SEPARATELY; /* do not use! */
- break;
case 'n':
attrname = optarg;
break;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include "pool.h"
#include "repo.h"
#include "common_write.h"
static void
-usage(const char *err)
+usage(int status)
{
- if (err)
- fprintf(stderr, "\n** Error:\n %s\n", err);
fprintf(stderr, "\nUsage:\n"
- "updateinfoxml2solv [-a][-h][-k][-n <attrname>]\n"
+ "updateinfoxml2solv [-h][-n <attrname>]\n"
" reads a 'updateinfo.xml' file from <stdin> and writes a .solv file to <stdout>\n"
" -h : print help & exit\n"
- " -k : don't mix kinds (experimental!)\n"
" -n <name>: save attributes as <name>.attr\n"
);
- exit(0);
+ exit(status);
}
int
main(int argc, char **argv)
{
- int flags = 0;
+ int c, flags = 0;
char *attrname = 0;
Pool *pool = pool_create();
Repo *repo = repo_create(pool, "<stdin>");
- argv++;
- argc--;
- while (argc--)
+ while ((c = getopt(argc, argv, "hn:")) >= 0)
{
- const char *s = argv[0];
- if (*s++ == '-')
- while (*s)
- switch (*s++)
- {
- case 'h': usage(NULL); break;
- case 'n':
- if (argc)
- {
- attrname = argv[1];
- argv++;
- argc--;
- }
- else
- usage("argument required for '-n'");
- break;
- case 'k':
- break;
- default : break;
- }
- argv++;
+ switch(c)
+ {
+ case 'h':
+ usage(0);
+ break;
+ case 'n':
+ attrname = optarg;
+ break;
+ default:
+ usage(1);
+ break;
+ }
}
-
repo_add_updateinfoxml(repo, stdin, flags);
- tool_write(repo, 0, 0);
+ tool_write(repo, 0, attrname);
pool_free(pool);
exit(0);
}