summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/repo_products.c31
-rw-r--r--tools/repo_products.h2
-rw-r--r--tools/rpmdb2solv.c47
3 files changed, 27 insertions, 53 deletions
diff --git a/tools/repo_products.c b/tools/repo_products.c
index def05bd..0576b64 100644
--- a/tools/repo_products.c
+++ b/tools/repo_products.c
@@ -106,7 +106,6 @@ struct parsedata {
struct stateswitch *swtab[NUMSTATES];
enum state sbtab[NUMSTATES];
- const char *attribute; /* only print this attribute, if currentproduct == baseproduct */
const char *tmplang;
@@ -278,16 +277,6 @@ endElement(void *userData, const char *name)
if (pd->currentproduct == pd->baseproduct)
repodata_set_str(pd->data, pd->handle, PRODUCT_TYPE, "base");
- // output distver if requested, only if the product is
- // a base product
- // this is yum $releasever variable
- if (pd->currentproduct == pd->baseproduct
- && pd->attribute
- && !strcmp(pd->attribute, "releasever"))
- {
- printf("%s\n", pd->tmpvers);
- }
-
if (pd->tmprel)
{
if (pd->tmpvers)
@@ -346,22 +335,10 @@ endElement(void *userData, const char *name)
break;
case STATE_TARGET:
repodata_set_str(pd->data, pd->handle, PRODUCT_REGISTER_TARGET, pd->content);
- if (pd->currentproduct == pd->baseproduct
- && pd->attribute
- && !strcmp(pd->attribute, "register.target"))
- {
- printf("%s\n", pd->content);
- }
- break;
+ break;
case STATE_REGRELEASE:
repodata_set_str(pd->data, pd->handle, PRODUCT_REGISTER_RELEASE, pd->content);
- if (pd->currentproduct == pd->baseproduct
- && pd->attribute
- && !strcmp(pd->attribute, "register.release"))
- {
- printf("%s\n", pd->content);
- }
- break;
+ break;
case STATE_CPEID:
if (pd->content)
repodata_set_str(pd->data, pd->handle, SOLVABLE_CPE_ID, pd->content);
@@ -594,7 +571,7 @@ parse_dir(DIR *dir, const char *path, struct parsedata *pd, int code11)
/* Oh joy! Three parsers for the price of one! */
void
-repo_add_products(Repo *repo, const char *proddir, const char *root, const char *attribute, int flags)
+repo_add_products(Repo *repo, const char *proddir, const char *root, int flags)
{
const char *fullpath = proddir;
DIR *dir;
@@ -616,8 +593,6 @@ repo_add_products(Repo *repo, const char *proddir, const char *root, const char
pd.content = sat_malloc(256);
pd.acontent = 256;
- pd.attribute = attribute;
-
for (i = 0, sw = stateswitches; sw->from != NUMSTATES; i++, sw++)
{
if (!pd.swtab[sw->from])
diff --git a/tools/repo_products.h b/tools/repo_products.h
index e79c7f1..aa0c2d9 100644
--- a/tools/repo_products.h
+++ b/tools/repo_products.h
@@ -5,4 +5,4 @@
* for further information
*/
-void repo_add_products(Repo *repo, const char *proddir, const char *root, const char *attribute, int flags);
+void repo_add_products(Repo *repo, const char *proddir, const char *root, int flags);
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);
}