summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-10-11 10:11:47 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-10-29 07:35:28 +0000
commit0c0c524691e3d2ffd9953a106fcc06262cbde910 (patch)
tree147b0e049269c13d02bd4fd5a82fff0c51ad67c7
parent4e0da1ef4a58a7ba4b92d4e07ef79cf7bd90abf0 (diff)
downloadbitbake-0c0c524691e3d2ffd9953a106fcc06262cbde910.tar.gz
command: Add getSetVariable command
There are some use cases where we want to read a variable but also set the variable to the value read, effectively locking in any expansion of it. This adds such a command. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/command.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/bb/command.py b/lib/bb/command.py
index 398c1d6a6..74106d143 100644
--- a/lib/bb/command.py
+++ b/lib/bb/command.py
@@ -181,6 +181,16 @@ class CommandsSync:
value = str(params[1])
command.cooker.data.setVar(varname, value)
+ def getSetVariable(self, command, params):
+ """
+ Read the value of a variable from data and set it into the datastore
+ which effectively expands and locks the value.
+ """
+ varname = params[0]
+ result = self.getVariable(command, params)
+ command.cooker.data.setVar(varname, result)
+ return result
+
def setConfig(self, command, params):
"""
Set the value of variable in configuration