From f0aecf6744816751d9511c4f6e9347c6c7eaeb26 Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Thu, 2 Jun 2016 06:43:27 -0400 Subject: [PATCH] Add support for top-level variant IDs with dashes. This is for layered products that have a variant mapped to multiple variants in a base product, for example: * Foo-Tools (id: FooTools, uid: Foo-Tools, name: Tools) * Bar-Tools (id: BarTools, uid: Bar-Tools, name: Tools) Requires productmd >= 1.2. Signed-off-by: Daniel Mach --- pungi/metadata.py | 6 ++++-- pungi/wrappers/variants.py | 2 -- tests/data/dummy-variants.xml | 25 +++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/pungi/metadata.py b/pungi/metadata.py index b853e1f4..bffe1255 100644 --- a/pungi/metadata.py +++ b/pungi/metadata.py @@ -94,7 +94,8 @@ def compose_to_composeinfo(compose): return None # variant details - var.id = variant.id + # remove dashes from variant ID, rely on productmd verification + var.id = variant.id.replace("-", "") var.uid = variant.uid var.name = variant.name var.type = variant.type @@ -230,7 +231,8 @@ def write_tree_info(compose, arch, variant, timestamp=None): var.name = variant.parent.name var.type = "variant" else: - var.id = variant.id + # remove dashes from variant ID, rely on productmd verification + var.id = variant.id.replace("-", "") var.uid = variant.uid var.name = variant.name var.type = variant.type diff --git a/pungi/wrappers/variants.py b/pungi/wrappers/variants.py index 38edabaf..1c3949d3 100755 --- a/pungi/wrappers/variants.py +++ b/pungi/wrappers/variants.py @@ -198,8 +198,6 @@ class VariantsXmlParser(object): class Variant(object): def __init__(self, id, name, type, arches, groups, environments=None, buildinstallpackages=None, is_empty=False, parent=None): - if not id.isalnum(): - raise ValueError("Variant ID must contain only alphanumeric characters: %s" % id) environments = environments or [] buildinstallpackages = buildinstallpackages or [] diff --git a/tests/data/dummy-variants.xml b/tests/data/dummy-variants.xml index 23591d77..e43446fc 100644 --- a/tests/data/dummy-variants.xml +++ b/tests/data/dummy-variants.xml @@ -73,4 +73,29 @@ + + + + x86_64 + + + core + + + minimal + + + + + + x86_64 + + + core + + + minimal + + +