[elbe-devel] [PATCH] finetuning: generate an error if artifact doesnt exist

Christian Teklenborg chris at linutronix.de
Fri Aug 7 15:09:44 CEST 2020


If a file specified via <artifact> does not exist, no error is generated. It
just silently does not produce an artifact. Check whether the file exist or not
and throw an error if it does not exist.

This patch fixes the issue #244

Signed-off-by: Christian Teklenborg <chris at linutronix.de>
---
 elbepack/finetuning.py | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/elbepack/finetuning.py b/elbepack/finetuning.py
index 00bb5c15..853723e4 100644
--- a/elbepack/finetuning.py
+++ b/elbepack/finetuning.py
@@ -508,11 +508,19 @@ class ArtifactAction(FinetuningAction):
     def __init__(self, node):
         FinetuningAction.__init__(self, node)
 
-    def execute(self, _buildenv, target):
-        target.images.append('target' + self.node.et.text)
+    def execute(self, buildenv, target):
+        if os.path.isfile("../target/" + self.node.et.text):
+            target.images.append('target' + self.node.et.text)
+        else:
+            logging.error("The specified artifact: '%s' doesn't exist" %
+                           self.node.et.text)
 
-    def execute_prj(self, _buildenv, target, _builddir):
-        target.images.append(self.node.et.text)
+    def execute_prj(self, buildenv, target, builddir):
+        if os.path.isfile("../" + self.node.et.text):
+            target.images.append(self.node.et.text)
+        else:
+            logging.error("The specified artifact: '%s' doesn't exist" %
+                           self.node.et.text)
 
 
 @FinetuningAction.register('rm_artifact')
-- 
2.20.1



More information about the elbe-devel mailing list