Repodata *data;
Id handle = 0;
int contentstyle = 0;
+ char *descrdir = 0;
+ char *datadir = 0;
int i = 0;
#define code10 (contentstyle == 10)
#define code11 (contentstyle == 11)
- if (contentstyle == 0)
+ if (istag ("CONTENTSTYLE"))
{
- if (istag ("CONTENTSTYLE"))
- {
- contentstyle = atoi(value);
- continue;
- }
+ contentstyle = atoi(value);
+ continue;
+ }
+ if (!contentstyle)
+ contentstyle = 10;
+
+ if (istag ("DESCRDIR"))
+ {
+ if (descrdir)
+ free(descrdir);
+ else
+ repo_set_str(repo, SOLVID_META, SUSETAGS_DESCRDIR, value);
+ if (s)
+ repo_set_str(repo, s - pool->solvables, SUSETAGS_DESCRDIR, value);
+ descrdir = strdup(value);
+ continue;
+ }
+ if (istag ("DATADIR"))
+ {
+ if (datadir)
+ free(datadir);
else
- contentstyle = 10;
+ repo_set_str(repo, SOLVID_META, SUSETAGS_DATADIR, value);
+ if (s)
+ repo_set_str(repo, s - pool->solvables, SUSETAGS_DATADIR, value);
+ datadir = strdup(value);
+ continue;
}
+ /* XXX: add those to SOLVID_META, too */
+ if (istag ("META"))
+ continue;
+ if (istag ("HASH"))
+ continue;
+ if (istag ("KEY"))
+ continue;
+
if ((code10 && istag ("PRODUCT"))
|| (code11 && istag ("NAME")))
{
repodata_extend(data, s - pool->solvables);
handle = s - pool->solvables;
s->name = str2id(pool, join(&pd, "product", ":", value), 1);
+ if (datadir)
+ repo_set_str(repo, s - pool->solvables, SUSETAGS_DATADIR, datadir);
+ if (descrdir)
+ repo_set_str(repo, s - pool->solvables, SUSETAGS_DESCRDIR, descrdir);
continue;
}
pd.tmprel = strdup(value);
else if (code11 && istag ("DISTRIBUTION"))
repo_set_str(repo, s - pool->solvables, SOLVABLE_DISTRIBUTION, value);
- else if (istag ("DATADIR"))
- repo_set_str(repo, s - pool->solvables, SUSETAGS_DATADIR, value);
else if (istag ("UPDATEURLS"))
add_multiple_urls(data, handle, value, str2id(pool, "update", 1));
else if (istag ("EXTRAURLS"))
pool_debug(pool, SAT_ERROR, "repo_content: malformed line: %s\n", line);
}
+ if (datadir)
+ free(datadir);
+ if (descrdir)
+ free(descrdir);
+
if (!s || !s->name)
{
- pool_debug(pool, SAT_FATAL, "repo_content: 'content' incomplete, no product solvable created !\n");
+ pool_debug(pool, SAT_FATAL, "repo_content: 'content' incomplete, no product solvable created!\n");
exit(1);
}
sat_free(pd.tmp);
sat_free(line);
sat_free(otherarchs);
+ join_freemem();
if (!(flags & REPO_NO_INTERNALIZE))
repodata_internalize(data);
}
KNOWNID(UPDATE_REBOOT, "update:reboot"), /* reboot suggested (kernel update) */
KNOWNID(UPDATE_RESTART, "update:restart"), /* restart suggested (update stack update) */
-KNOWNID(UPDATE_RELOGIN, "update:relogin"), /* restart suggested (update stack update) */
+KNOWNID(UPDATE_RELOGIN, "update:relogin"), /* relogin suggested */
-KNOWNID(UPDATE_MESSAGE, "update:message"), /* restart suggested (update stack update) */
- /* 'content' of patch, usually list of packages */
+KNOWNID(UPDATE_MESSAGE, "update:message"), /* informative message */
+
+/* 'content' of patch, usually list of packages */
KNOWNID(UPDATE_COLLECTION, "update:collection"), /* "name evr arch" */
KNOWNID(UPDATE_COLLECTION_NAME, "update:collection:name"), /* name */
KNOWNID(UPDATE_COLLECTION_EVR, "update:collection:evr"), /* epoch:version-release */
/* argh */
KNOWNID(SUSETAGS_DATADIR, "susetags:datadir"),
+KNOWNID(SUSETAGS_DESCRDIR, "susetags:descrdir"),
/* timestamp then the repository was generated */
KNOWNID(REPOSITORY_TIMESTAMP, "repository:timestamp"),
KNOWNID(DELTA_SEQ_EVR, "delta:seqevr"),
KNOWNID(DELTA_SEQ_NUM, "delta:seqnum"),
+/* XXX: shouldn't use a real ID */
KNOWNID(NAMESPACE_PRODUCTBUDDY, "namespace:productbuddy"),
KNOWNID(REPOSITORY_REPOMD, "repository:repomd"),
return fopencookie(gzf, "r", cio);
}
+/* content file query */
+static void
+doquery(Pool *pool, Repo *repo, const char *arg)
+{
+ char qbuf[256];
+ const char *str;
+ Id id;
+
+ snprintf(qbuf, sizeof(qbuf), "susetags:%s", arg);
+ id = str2id(pool, qbuf, 0);
+ if (!id)
+ return;
+ str = repo_lookup_str(repo, SOLVID_META, id);
+ if (str)
+ printf("%s\n", str);
+}
+
int
main(int argc, char **argv)
{
const char *attrname = 0;
const char *descrdir = 0;
const char *basefile = 0;
+ const char *query = 0;
Id product = 0;
int flags = 0;
int c;
- while ((c = getopt(argc, argv, "hkn:c:d:b:")) >= 0)
+ while ((c = getopt(argc, argv, "hkn:c:d:b:q:")) >= 0)
{
switch (c)
{
case 'b':
basefile = optarg;
break;
+ case 'q':
+ query = optarg;
+ break;
default:
usage(1);
break;
/* read data from stdin */
repo_add_susetags(repo, stdin, product, 0, REPO_REUSE_REPODATA | REPO_NO_INTERNALIZE);
repo_internalize(repo);
- tool_write(repo, basefile, attrname);
+
+ if (query)
+ doquery(pool, repo, query);
+ else
+ tool_write(repo, basefile, attrname);
pool_free(pool);
exit(0);
}