{"type", (getter)get_str, (setter)set_str, NULL, OFFSET(type)},
{"location_real", (getter)get_str, (setter)set_str, NULL, OFFSET(location_real)},
{"location_href", (getter)get_str, (setter)set_str, NULL, OFFSET(location_href)},
+ {"location_base", (getter)get_str, (setter)set_str, NULL, OFFSET(location_base)},
{"checksum", (getter)get_str, (setter)set_str, NULL, OFFSET(checksum)},
{"checksum_type", (getter)get_str, (setter)set_str, NULL, OFFSET(checksum_type)},
{"checksum_open", (getter)get_str, (setter)set_str, NULL, OFFSET(checksum_open)},
orig->location_real);
rec->location_href = cr_safe_string_chunk_insert(rec->chunk,
orig->location_href);
+ rec->location_base = cr_safe_string_chunk_insert(rec->chunk,
+ orig->location_base);
rec->checksum = cr_safe_string_chunk_insert(rec->chunk,
orig->checksum);
rec->checksum_type = cr_safe_string_chunk_insert(rec->chunk,
node = xmlNewChild(data, NULL, BAD_CAST "location", NULL);
xmlNewProp(node, BAD_CAST "href", BAD_CAST md->location_href);
+ if (md->location_base)
+ xmlNewProp(node, BAD_CAST "xml:base", BAD_CAST md->location_base);
g_snprintf(str_buffer, STR_BUFFER_SIZE, "%ld", md->timestamp);
xmlNewChild(data, NULL, BAD_CAST "timestamp", BAD_CAST str_buffer);
char *type; /*!< type of record */
char *location_real; /*!< real path to the file */
char *location_href; /*!< location of the file (in repomd.xml) */
+ char *location_base; /*!< base location of the file */
char *checksum; /*!< checksum of file */
char *checksum_type; /*!< checksum type */
char *checksum_open; /*!< checksum of uncompressed file */
cr_xml_parser_warning(pd, CR_XML_WARNING_MISSINGATTR,
"Missing attribute \"href\" of a location element");
-// val = cr_find_attr("base", attr);
-// if (val)
-// pd->repomdrecord->location_base = g_string_chunk_insert(
-// pd->repodmrecord->chunk,
-// val);
+ val = cr_find_attr("xml:base", attr);
+ if (val)
+ pd->repomdrecord->location_base = g_string_chunk_insert(
+ pd->repomdrecord->chunk,
+ val);
break;
rec = cr.RepomdRecord("primary", self.path00)
rec.fill(cr.SHA256)
rec.timestamp = 1
+ rec.location_base = "http://foo/"
md.set_record(rec)
self.assertEqual(len(md.records), 1)
<data type="primary">
<checksum type="sha256">dabe2ce5481d23de1f4f52bdcfee0f9af98316c9e0de2ce8123adeefa0dd08b9</checksum>
<open-checksum type="sha256">e1e2ffd2fb1ee76f87b70750d00ca5677a252b397ab6c2389137a0c33e7b359f</open-checksum>
- <location href="repodata/primary.xml.gz"/>
+ <location href="repodata/primary.xml.gz" xml:base="http://foo/"/>
<timestamp>1</timestamp>
<size>134</size>
<open-size>167</open-size>
self.assertEqual(rec.location_real, self.path00)
self.assertEqual(rec.location_href, "repodata/primary.xml.gz")
+ self.assertEqual(rec.location_base, None)
self.assertEqual(rec.checksum, None)
self.assertEqual(rec.checksum_type, None)
self.assertEqual(rec.checksum_open, None)
self.assertEqual(rec.location_real, self.path00)
self.assertEqual(rec.location_href, "repodata/primary.xml.gz")
+ self.assertEqual(rec.location_base, None)
self.assertEqual(rec.checksum, "dabe2ce5481d23de1f4f52bdcfee0f9af98316c9e0de2ce8123adeefa0dd08b9")
self.assertEqual(rec.checksum_type, "sha256")
self.assertEqual(rec.checksum_open, "e1e2ffd2fb1ee76f87b70750d00ca5677a252b397ab6c2389137a0c33e7b359f")