- adapt the attributes to support the new rpmmd spec better
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Tue, 18 Nov 2008 18:06:53 +0000 (18:06 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Tue, 18 Nov 2008 18:06:53 +0000 (18:06 +0000)
  so we get the API at least
- backup, interfaces in ZYpp tomorrow

src/knownid.h
tools/repo_repomdxml.c

index 548bda4..84ca845 100644 (file)
@@ -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 */
index 3636364..8d4345d 100644 (file)
@@ -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;