repodata_set_str(pd->data, pd->handle, PRODUCT_REGISTER_RELEASE, pd->content);
break;
case STATE_CPEID:
- if (pd->content)
+ if (*pd->content)
repodata_set_str(pd->data, pd->handle, SOLVABLE_CPEID, pd->content);
default:
break;
STATE_CHECKSUM,
STATE_TIMESTAMP,
STATE_OPENCHECKSUM,
+ STATE_SIZE,
NUMSTATES
};
{ STATE_DATA, "location", STATE_LOCATION, 0 },
{ STATE_DATA, "checksum", STATE_CHECKSUM, 1 },
{ STATE_DATA, "timestamp", STATE_TIMESTAMP, 1 },
- { STATE_DATA, "open-checksum", STATE_OPENCHECKSUM, 1 },
+ { STATE_DATA, "open-checksum", STATE_OPENCHECKSUM, 1 },
+ { STATE_DATA, "size", STATE_SIZE, 1 },
{ NUMSTATES }
};
switch(pd->state)
{
- case STATE_START: break;
case STATE_REPOMD:
{
const char *updstr;
}
break;
}
- case STATE_SUSEINFO: break;
- case STATE_EXPIRE: break;
- case STATE_KEYWORDS: break;
- case STATE_KEYWORD: break;
- case STATE_CONTENT: break;
- case STATE_REVISION: break;
case STATE_DISTRO:
{
/* this is extra metadata about the product this repository
pd->statedepth--;
switch (pd->state)
{
- case STATE_START: break;
case STATE_REPOMD:
if (pd->timestamp > 0)
repodata_set_num(pd->data, SOLVID_META, REPOSITORY_TIMESTAMP, pd->timestamp);
repodata_add_flexarray(pd->data, SOLVID_META, REPOSITORY_REPOMD, pd->rdhandle);
pd->rdhandle = 0;
break;
- case STATE_LOCATION: break;
case STATE_CHECKSUM:
case STATE_OPENCHECKSUM:
/* repomd.xml content and suseinfo.xml keywords are equivalent */
case STATE_CONTENT:
case STATE_KEYWORD:
- if (pd->content)
+ if (*pd->content)
repodata_add_poolstr_array(pd->data, SOLVID_META, REPOSITORY_KEYWORDS, pd->content);
break;
case STATE_REVISION:
- if (pd->content)
+ if (*pd->content)
repodata_add_poolstr_array(pd->data, SOLVID_META, REPOSITORY_REVISION, pd->content);
break;
case STATE_DISTRO:
/* distro tag is used in repomd.xml to say the product this repo is
made for */
- if (pd->content)
+ if (*pd->content)
repodata_set_str(pd->data, pd->rphandle, REPOSITORY_PRODUCT_LABEL, pd->content);
repodata_add_flexarray(pd->data, SOLVID_META, REPOSITORY_DISTROS, pd->rphandle);
break;
case STATE_UPDATES:
- /* distro tag is used in suseinfo.xml to say the repo updates a product
+ /* updates tag is used in suseinfo.xml to say the repo updates a product
however it s not yet a tag standarized for repomd.xml */
- if (pd->content)
+ if (*pd->content)
repodata_set_str(pd->data, pd->ruhandle, REPOSITORY_PRODUCT_LABEL, pd->content);
repodata_add_flexarray(pd->data, SOLVID_META, REPOSITORY_UPDATES, pd->ruhandle);
break;
case STATE_REPO:
- if (pd->content)
+ if (*pd->content)
repodata_add_poolstr_array(pd->data, SOLVID_META, REPOSITORY_REPOID, pd->content);
break;
- case STATE_SUSEINFO: break;
- case STATE_KEYWORDS: break;
- case NUMSTATES: break;
+ case STATE_SIZE:
+ if (*pd->content)
+ repodata_set_num(pd->data, pd->rdhandle, REPOSITORY_REPOMD_SIZE, strtoull(pd->content, 0, 10));
+ break;
default:
break;
}
repodata_set_void(pd->data, handle, SOLVABLE_ISVISIBLE);
break;
case STATE_INCLUDESENTRY:
- {
- const char *tmp = find_attr("pattern", atts);
- if (tmp)
- repodata_add_poolstr_array(pd->data, pd->handle, SOLVABLE_INCLUDES, join2(&pd->jd, "pattern", ":", tmp));
- break;
- }
+ str = find_attr("pattern", atts);
+ if (str)
+ repodata_add_poolstr_array(pd->data, pd->handle, SOLVABLE_INCLUDES, join2(&pd->jd, "pattern", ":", str));
+ break;
case STATE_EXTENDSENTRY:
- {
- const char *tmp = find_attr("pattern", atts);
- if (tmp)
- repodata_add_poolstr_array(pd->data, pd->handle, SOLVABLE_EXTENDS, join2(&pd->jd, "pattern", ":", tmp));
- break;
- }
+ str = find_attr("pattern", atts);
+ if (str)
+ repodata_add_poolstr_array(pd->data, pd->handle, SOLVABLE_EXTENDS, join2(&pd->jd, "pattern", ":", str));
+ break;
case STATE_LOCATION:
str = find_attr("href", atts);
if (str)
repodata_set_location(pd->data, handle, 0, 0, str);
break;
case STATE_CHECKSUM:
- {
- const char *tmp = find_attr("type", atts);
- pd->chksumtype = tmp && *tmp ? solv_chksum_str2type(tmp) : 0;
- if (!pd->chksumtype)
- pd->ret = pool_error(pool, -1, "line %d: unknown checksum type: %s", (unsigned int)XML_GetCurrentLineNumber(*pd->parser), tmp ? tmp: "NULL");
- break;
- }
+ str = find_attr("type", atts);
+ pd->chksumtype = str && *str ? solv_chksum_str2type(str) : 0;
+ if (!pd->chksumtype)
+ pd->ret = pool_error(pool, -1, "line %d: unknown checksum type: %s", (unsigned int)XML_GetCurrentLineNumber(*pd->parser), str ? str : "NULL");
+ break;
case STATE_TIME:
{
unsigned int t;
break;
}
case STATE_SIZE:
- {
- unsigned long long k;
- str = find_attr("installed", atts);
- if (str && (k = strtoull(str, 0, 10)) != 0)
- repodata_set_num(pd->data, handle, SOLVABLE_INSTALLSIZE, k);
- /* XXX the "package" attribute gives the size of the rpm file,
- i.e. the download size. Except on packman, there it seems to be
- something else entirely, it has a value near to the other two
- values, as if the rpm is uncompressed. */
- str = find_attr("package", atts);
- if (str && (k = strtoull(str, 0, 10)) != 0)
- repodata_set_num(pd->data, handle, SOLVABLE_DOWNLOADSIZE, k);
- break;
- }
+ if ((str = find_attr("installed", atts)) != 0)
+ repodata_set_num(pd->data, handle, SOLVABLE_INSTALLSIZE, strtoull(str, 0, 10));
+ if ((str = find_attr("package", atts)) != 0)
+ repodata_set_num(pd->data, handle, SOLVABLE_DOWNLOADSIZE, strtoull(str, 0, 10));
+ break;
case STATE_HEADERRANGE:
{
unsigned int end;
KNOWNID(ARCH_ANY, "any"),
+KNOWNID(REPOSITORY_REPOMD_SIZE, "repository:repomd:size"),
+
KNOWNID(ID_NUM_INTERNAL, 0)
#ifdef KNOWNID_INITIALIZE