]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
command: Add getSetVariable command
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 11 Oct 2015 09:11:47 +0000 (10:11 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 29 Oct 2015 07:35:28 +0000 (07:35 +0000)
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>
lib/bb/command.py

index 398c1d6a6ec51a6511ad39e25404de96cbc853e5..74106d14344251ffe7b75627f710c08a3840f8f7 100644 (file)
@@ -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