You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.5 KiB
36 lines
1.5 KiB
2 years ago
|
From 18bbb5b21d4da8120fb9f3193248dd6faa915222 Mon Sep 17 00:00:00 2001
|
||
|
From: Tomas Kopecek <tkopecek@redhat.com>
|
||
|
Date: Oct 17 2022 12:39:48 +0000
|
||
|
Subject: fix include path
|
||
|
|
||
|
|
||
|
Related: https://pagure.io/koji/issue/3553
|
||
|
|
||
|
---
|
||
|
|
||
|
diff --git a/plugins/builder/kiwi.py b/plugins/builder/kiwi.py
|
||
|
index 42aa707..abb5511 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'):
|
||
|
|