diff --git a/build-tests/x86/rawhide/test-image-live-disk/appliance.kiwi b/build-tests/x86/rawhide/test-image-live-disk/appliance.kiwi
index 8615ae3f..e9039c72 100644
--- a/build-tests/x86/rawhide/test-image-live-disk/appliance.kiwi
+++ b/build-tests/x86/rawhide/test-image-live-disk/appliance.kiwi
@@ -52,7 +52,7 @@
-
+
diff --git a/doc/source/image_description/elements.rst b/doc/source/image_description/elements.rst
index 2e94fedd..db1bdff6 100644
--- a/doc/source/image_description/elements.rst
+++ b/doc/source/image_description/elements.rst
@@ -1208,7 +1208,7 @@ Setup software sources for the image.
.. code:: xml
-
+
diff --git a/kiwi/schema/kiwi.rnc b/kiwi/schema/kiwi.rnc
index f56ddf6f..5963c676 100644
--- a/kiwi/schema/kiwi.rnc
+++ b/kiwi/schema/kiwi.rnc
@@ -1051,6 +1051,7 @@ div {
]
]
k.repository.profiles.attribute = k.profiles.attribute
+ k.repository.arch.attribute = k.arch.attribute
k.repository.type.attribute =
## Type of repository
attribute type {
@@ -1143,6 +1144,7 @@ div {
k.repository.attlist =
k.repository.type.attribute? &
k.repository.profiles.attribute? &
+ k.repository.arch.attribute? &
k.repository.alias.attribute? &
k.repository.sourcetype.attribute? &
k.repository.components.attribute? &
diff --git a/kiwi/schema/kiwi.rng b/kiwi/schema/kiwi.rng
index 50f81d86..cc05ffe8 100644
--- a/kiwi/schema/kiwi.rng
+++ b/kiwi/schema/kiwi.rng
@@ -1589,6 +1589,9 @@ definition can be composed by other existing profiles.
+
+
+ Type of repository
@@ -1725,6 +1728,9 @@ last one is picked.
+
+
+
diff --git a/kiwi/xml_parse.py b/kiwi/xml_parse.py
index a2245f6c..430b63f4 100644
--- a/kiwi/xml_parse.py
+++ b/kiwi/xml_parse.py
@@ -3,7 +3,7 @@
#
# Generated by generateDS.py version 2.29.24.
-# Python 3.11.5 (main, Sep 06 2023, 11:21:05) [GCC]
+# Python 3.11.8 (main, Feb 29 2024, 12:19:47) [GCC]
#
# Command line options:
# ('-f', '')
@@ -2412,11 +2412,12 @@ class repository(k_source):
"""The Name of the Repository"""
subclass = None
superclass = k_source
- def __init__(self, source=None, type_=None, profiles=None, alias=None, sourcetype=None, components=None, distribution=None, imageinclude=None, imageonly=None, repository_gpgcheck=None, customize=None, package_gpgcheck=None, priority=None, password=None, username=None, use_for_bootstrap=None):
+ def __init__(self, source=None, type_=None, profiles=None, arch=None, alias=None, sourcetype=None, components=None, distribution=None, imageinclude=None, imageonly=None, repository_gpgcheck=None, customize=None, package_gpgcheck=None, priority=None, password=None, username=None, use_for_bootstrap=None):
self.original_tagname_ = None
super(repository, self).__init__(source, )
self.type_ = _cast(None, type_)
self.profiles = _cast(None, profiles)
+ self.arch = _cast(None, arch)
self.alias = _cast(None, alias)
self.sourcetype = _cast(None, sourcetype)
self.components = _cast(None, components)
@@ -2445,6 +2446,8 @@ class repository(k_source):
def set_type(self, type_): self.type_ = type_
def get_profiles(self): return self.profiles
def set_profiles(self, profiles): self.profiles = profiles
+ def get_arch(self): return self.arch
+ def set_arch(self, arch): self.arch = arch
def get_alias(self): return self.alias
def set_alias(self, alias): self.alias = alias
def get_sourcetype(self): return self.sourcetype
@@ -2471,6 +2474,13 @@ class repository(k_source):
def set_username(self, username): self.username = username
def get_use_for_bootstrap(self): return self.use_for_bootstrap
def set_use_for_bootstrap(self, use_for_bootstrap): self.use_for_bootstrap = use_for_bootstrap
+ def validate_arch_name(self, value):
+ # Validate type arch-name, a restriction on xs:token.
+ if value is not None and Validate_simpletypes_:
+ if not self.gds_validate_simple_patterns(
+ self.validate_arch_name_patterns_, value):
+ warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_arch_name_patterns_, ))
+ validate_arch_name_patterns_ = [['^.*$']]
def validate_safe_posix_name(self, value):
# Validate type safe-posix-name, a restriction on xs:token.
if value is not None and Validate_simpletypes_:
@@ -2514,6 +2524,9 @@ class repository(k_source):
if self.profiles is not None and 'profiles' not in already_processed:
already_processed.add('profiles')
outfile.write(' profiles=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.profiles), input_name='profiles')), ))
+ if self.arch is not None and 'arch' not in already_processed:
+ already_processed.add('arch')
+ outfile.write(' arch=%s' % (quote_attrib(self.arch), ))
if self.alias is not None and 'alias' not in already_processed:
already_processed.add('alias')
outfile.write(' alias=%s' % (quote_attrib(self.alias), ))
@@ -2572,6 +2585,12 @@ class repository(k_source):
if value is not None and 'profiles' not in already_processed:
already_processed.add('profiles')
self.profiles = value
+ value = find_attr_value_('arch', node)
+ if value is not None and 'arch' not in already_processed:
+ already_processed.add('arch')
+ self.arch = value
+ self.arch = ' '.join(self.arch.split())
+ self.validate_arch_name(self.arch) # validate type arch-name
value = find_attr_value_('alias', node)
if value is not None and 'alias' not in already_processed:
already_processed.add('alias')
diff --git a/kiwi/xml_state.py b/kiwi/xml_state.py
index c4c0fb87..b810196a 100644
--- a/kiwi/xml_state.py
+++ b/kiwi/xml_state.py
@@ -407,6 +407,22 @@ class XMLState:
"""
return self._section_matches_host_architecture(preferences)
+ def repository_matches_host_architecture(self, repository: Any) -> bool:
+ """
+ Tests if the given repository section is applicable for the
+ current host architecture. If no architecture is specified within
+ the section it is considered as a match returning True.
+
+ Note: The XML section pointer must provide an arch attribute
+
+ :param section: XML section object
+
+ :return: True or False
+
+ :rtype: bool
+ """
+ return self._section_matches_host_architecture(repository)
+
def get_package_sections(
self, packages_sections: List
) -> List[package_type]:
@@ -1897,15 +1913,18 @@ class XMLState:
def get_repository_sections(self) -> List:
"""
- List of all repository sections matching configured profiles
+ List of all repository sections for the selected profiles that
+ matches the host architecture
:return: section reference(s)
:rtype: list
"""
- return self._profiled(
- self.xml_data.get_repository()
- )
+ repository_list = []
+ for repository in self._profiled(self.xml_data.get_repository()):
+ if self.repository_matches_host_architecture(repository):
+ repository_list.append(repository)
+ return repository_list
def get_repository_sections_used_for_build(self) -> List:
"""