diff mbox series

[meta-swupdate] Allow empty variables in bitbake espansion

Message ID 20181127133825.28935-1-sbabic@denx.de
State Accepted
Headers show
Series [meta-swupdate] Allow empty variables in bitbake espansion | expand

Commit Message

Stefano Babic Nov. 27, 2018, 1:38 p.m. UTC
Even if the current check remind that a variable is maybe missing, there
are use cases where it is useful to replace an empty variable.

Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 classes/swupdate-common.bbclass | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/classes/swupdate-common.bbclass b/classes/swupdate-common.bbclass
index 75485bd..80a4ba8 100644
--- a/classes/swupdate-common.bbclass
+++ b/classes/swupdate-common.bbclass
@@ -38,10 +38,10 @@  def swupdate_expand_bitbake_variables(d, s):
             m = re.match(r"^(?P<before_placeholder>.+)@@(?P<bitbake_variable_name>\w+)@@(?P<after_placeholder>.+)$", line)
             if m:
                 bitbake_variable_value = d.getVar(m.group('bitbake_variable_name'), True)
-                if bitbake_variable_value:
-                    write_lines.append(m.group('before_placeholder') + bitbake_variable_value + m.group('after_placeholder') + "\n");
-                else:
-                    bb.fatal("BitBake variable %s not set" % (m.group('bitbake_variable_name')))
+                if bitbake_variable_value is None:
+                   bitbake_variable_value = ""
+                   bb.warn("BitBake variable %s not set" % (m.group('bitbake_variable_name')))
+                write_lines.append(m.group('before_placeholder') + bitbake_variable_value + m.group('after_placeholder') + "\n");
             else:
                 write_lines.append(line)