From 3a4286be435f6e734c528ab3a649cfd7d44e1338 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Mon, 17 Oct 2022 12:26:55 +0200 Subject: [PATCH 5/6] fix include path Related: https://pagure.io/koji/issue/3553 (cherry picked from commit b8b52884b5208dc7ea25881108b7da5eb3d9fc86) --- plugins/builder/kiwi.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/builder/kiwi.py b/plugins/builder/kiwi.py index b70a13a3..4033b520 100644 --- a/plugins/builder/kiwi.py +++ b/plugins/builder/kiwi.py @@ -197,16 +197,17 @@ class KiwiCreateImageTask(BaseBuildTask): for inc_node in image.getElementsByTagName('include'): path = inc_node.getAttribute('from') if path.startswith('this://'): - path = koji.util.joinpath(desc_path, path[7:]) + path = koji.util.joinpath(os.path.dirname(desc_path), path[7:]) else: # we want to reject other protocols, e.g. file://, https:// # reachingoutside of repo raise koji.GenericError(f"Unhandled include protocol in include path: {path}.") inc = xml.dom.minidom.parse(path) # nosec # every included xml has image root element again - for node in inc.getElementsByTagName('image').childNodes: + for node in list(inc.getElementsByTagName('image')[0].childNodes): if node.nodeName != 'repository': image.appendChild(node) + image.removeChild(inc_node) # remove remaining old repos for old_repo in image.getElementsByTagName('repository'): -- 2.38.1