[meta-xilinx] [meta-xilinx-tools][RFC] xsctyaml.bbclass: Fix failure while handling empty YAML configuration

Manjukumar Matha manjukumar.harthikote-matha at xilinx.com
Fri Dec 8 11:52:10 PST 2017


dtgen.tcl will fail when YAML configurations are empty. This patch fixes
this issue by not creating the yaml file when YAML configurations are
empty

Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha at xilinx.com>
---
 classes/xsctyaml.bbclass | 9 +++++----
 scripts/dtgen.tcl        | 6 +++++-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/classes/xsctyaml.bbclass b/classes/xsctyaml.bbclass
index 7f31798..5682320 100644
--- a/classes/xsctyaml.bbclass
+++ b/classes/xsctyaml.bbclass
@@ -74,10 +74,11 @@ python do_create_yaml() {
         configflags = d.getVarFlags("YAML_BSP_CONFIG") or {}
         yaml_dict = patch_yaml(bspconfig, configflags, 'bsp', yaml_dict, d)
 
-    fp = d.getVar("YAML_FILE_PATH", True)
-    if fp :
-        yamlfile = open(fp, 'w')
-        yamlfile.write(yaml.dump(yaml_dict, default_flow_style=True, width=2000))
+    if len(yaml_dict) != 0:
+        fp = d.getVar("YAML_FILE_PATH", True)
+        if fp :
+            yamlfile = open(fp, 'w')
+            yamlfile.write(yaml.dump(yaml_dict, default_flow_style=True, width=2000))
 }
 
 addtask create_yaml before do_configure
diff --git a/scripts/dtgen.tcl b/scripts/dtgen.tcl
index 56ba2aa..01b497c 100644
--- a/scripts/dtgen.tcl
+++ b/scripts/dtgen.tcl
@@ -29,7 +29,11 @@ if {[catch {hsi create_sw_design $params(app) \
 		-os device_tree -proc $params(processor)} res] } {
 	error "create_sw_design failed for $params(app)"
 }
-set_properties $params(yamlconf)
+
+if {[file exists $params(yamlconf)]} {
+	set_properties $params(yamlconf)
+}
+
 if {[catch {hsi generate_target -dir $project} res]} {
 	error "generate_target failed"
 }
-- 
2.7.4




More information about the meta-xilinx mailing list