variants: Allow multiple explicit optional variants
When a variant has optional, it is possible to explictly list it in the XML file and add extra groups. However, the original DTD did not allow multiple variants with `id="optional"` as `id` attribute has to be globally unique. This patch changes its type to `CDATA`, which has less restrictions. This also means we can no longer define `<ref>` as `IDREF` and instead check the existence of referenced variant in parser. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
912f81ca16
commit
6fede3f395
@ -150,7 +150,11 @@ class VariantsXmlParser(object):
|
|||||||
self.add_child(optional, variant)
|
self.add_child(optional, variant)
|
||||||
|
|
||||||
for ref in variant_node.xpath("variants/ref/@id"):
|
for ref in variant_node.xpath("variants/ref/@id"):
|
||||||
|
try:
|
||||||
child_variant = self.parse_variant_node(self.addons[ref], variant)
|
child_variant = self.parse_variant_node(self.addons[ref], variant)
|
||||||
|
except KeyError:
|
||||||
|
raise RuntimeError("Variant %s references non-existing variant %s"
|
||||||
|
% (variant.uid, ref))
|
||||||
self.add_child(child_variant, variant)
|
self.add_child(child_variant, variant)
|
||||||
|
|
||||||
# XXX: top-level optional
|
# XXX: top-level optional
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<!ELEMENT variant (release?,arches,groups?,environments*,variants*,buildinstallpackages?)?>
|
<!ELEMENT variant (release?,arches,groups?,environments*,variants*,buildinstallpackages?)?>
|
||||||
<!ATTLIST variant
|
<!ATTLIST variant
|
||||||
id ID #REQUIRED
|
id CDATA #REQUIRED
|
||||||
name CDATA #REQUIRED
|
name CDATA #REQUIRED
|
||||||
type (variant|addon|optional|layered-product) #REQUIRED
|
type (variant|addon|optional|layered-product) #REQUIRED
|
||||||
has_optional (true|false) #IMPLIED
|
has_optional (true|false) #IMPLIED
|
||||||
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
<!ELEMENT ref EMPTY>
|
<!ELEMENT ref EMPTY>
|
||||||
<!ATTLIST ref
|
<!ATTLIST ref
|
||||||
id IDREF #REQUIRED
|
id CDATA #REQUIRED
|
||||||
>
|
>
|
||||||
|
|
||||||
<!ELEMENT buildinstallpackages (package)+>
|
<!ELEMENT buildinstallpackages (package)+>
|
||||||
|
Loading…
Reference in New Issue
Block a user