From: Duncan Mac-Vicar P Date: Tue, 18 Nov 2008 18:06:53 +0000 (+0000) Subject: - adapt the attributes to support the new rpmmd spec better X-Git-Tag: BASE-SuSE-Code-12_1-Branch~373 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=038f3817bc4c3efb8792c260bdbb63bb9847251b;p=platform%2Fupstream%2Flibsolv.git - adapt the attributes to support the new rpmmd spec better so we get the API at least - backup, interfaces in ZYpp tomorrow --- diff --git a/src/knownid.h b/src/knownid.h index 548bda4..84ca845 100644 --- a/src/knownid.h +++ b/src/knownid.h @@ -166,6 +166,7 @@ KNOWNID(PRODUCT_URL, "product:url"), KNOWNID(PRODUCT_URL_TYPE, "product:url:type"), KNOWNID(PRODUCT_FLAGS, "product:flags"), KNOWNID(PRODUCT_PRODUCTLINE, "product:productline"), +/* this has to be obsoleted */ KNOWNID(PRODUCT_UPDATEREPOKEY, "product:updaterepokey"), KNOWNID(PRODUCT_REGISTER_TARGET, "product:regtarget"), KNOWNID(PRODUCT_REGISTER_RELEASE, "product:regrelease"), @@ -178,10 +179,17 @@ KNOWNID(REPOSITORY_TIMESTAMP, "repository:timestamp"), /* hint when the metadata could be outdated w/respect to generated timestamp */ KNOWNID(REPOSITORY_EXPIRE, "repository:expire"), -/* which things does this repo provides updates for, if it does */ + +/* which things does this repo provides updates for, if it does (array) */ KNOWNID(REPOSITORY_UPDATES, "repository:updates"), -/* which products this repository is supposed to be for */ +KNOWNID(REPOSITORY_UPDATE_LABEL, "repository:update:label"), +KNOWNID(REPOSITORY_UPDATE_CPEID, "repository:update:cpeid"), + +/* which products this repository is supposed to be for (array) */ KNOWNID(REPOSITORY_PRODUCTS, "repository:products"), +KNOWNID(REPOSITORY_PRODUCT_LABEL, "repository:product:label"), +KNOWNID(REPOSITORY_PRODUCT_CPEID, "repository:product:cpeid"), + /* keyword (tags) for this repository */ KNOWNID(REPOSITORY_KEYWORDS, "repository:keywords"), /* revision of the repository. arbitrary string */ diff --git a/tools/repo_repomdxml.c b/tools/repo_repomdxml.c index 3636364..8d4345d 100644 --- a/tools/repo_repomdxml.c +++ b/tools/repo_repomdxml.c @@ -160,6 +160,12 @@ struct parsedata { struct stateswitch *swtab[NUMSTATES]; enum state sbtab[NUMSTATES]; int timestamp; + /* handles for collection + structures */ + /* repo updates */ + Id ruhandle; + /* repo products */ + Id rphandle; }; /* @@ -249,7 +255,18 @@ startElement(void *userData, const char *name, const char **atts) case STATE_KEYWORD: break; case STATE_CONTENT: break; case STATE_REVISION: break; - case STATE_DISTRO: break; + case STATE_DISTRO: + { + /* this is extra metadata about the product this repository + was designed for */ + const char *cpeid = find_attr("cpeid", atts); + pd->rphandle = repodata_new_handle(pd->data); + /* set the cpeid for the product + the label is set in the content of the tag */ + if (cpeid) + repodata_set_poolstr(pd->data, pd->rphandle, REPOSITORY_PRODUCT_CPEID, cpeid); + break; + } case STATE_DATA: break; case STATE_LOCATION: break; case STATE_CHECKSUM: break; @@ -325,7 +342,13 @@ endElement(void *userData, const char *name) if (pd->content) repodata_add_poolstr_array(pd->data, SOLVID_META, REPOSITORY_REVISION, pd->content); break; - case STATE_DISTRO: break; + case STATE_DISTRO: + /* distro tag is used in repomd.xml to say the product this repo is + made for */ + if (pd->content) + repodata_set_str(pd->data, pd->rphandle, REPOSITORY_PRODUCT_LABEL, pd->content); + repodata_add_flexarray(pd->data, SOLVID_META, REPOSITORY_PRODUCTS, pd->rphandle); + break; case STATE_SUSEINFO: break; case STATE_PRODUCTS: break; case STATE_KEYWORDS: break;