]> git.e2factory.org Git - e2factory.git/commitdiff
result: modify build_mode() and drop the getter/setter style
authorTobias Ulmer <tu@emlix.com>
Thu, 8 Sep 2016 14:47:12 +0000 (16:47 +0200)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 14:41:18 +0000 (15:41 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
local/result.lua

index 39a399debc706ea25ff7773dfd55335f5cf331dd..6013e5c5084a578626e69790c12e1af7b8a72bc5 100644 (file)
@@ -179,19 +179,17 @@ function result.basic_result:buildconfig()
     return strict.readonly(bc)
 end
 
---- Set build_mode table for result:
--- @param build_mode Build mode table
-function result.basic_result:set_build_mode(build_mode)
-    assertIsTable(build_mode)
-    assertIsNil(self.build_mode)
-    self._build_mode = build_mode
-end
-
-function result.basic_result:get_build_mode()
-    assertIsTable(self._build_mode)
-    assertIsNil(self.build_mode)
+--- Get/set build_mode table for result. Needs to be set before certain
+-- operations, for example anything calculating the buildid.
+-- @param bm Optional build mode table to set a new one.
+function result.basic_result:build_mode(bm)
+    if bm then
+        assertIsTable(bm)
+        self._build_mode = bm
+    else
+        assertIsTable(self._build_mode)
+    end
 
-    -- XXX: comments for buildconfig() apply
     return self._build_mode
 end
 
@@ -451,7 +449,7 @@ end
 -- @return Error object on failure.
 function result.result_class:buildid()
     local e, rc, re, info, hc, id, build_mode
-    build_mode = self:get_build_mode()
+    build_mode = self:build_mode()
 
     if self._buildid then
         return build_mode.buildid(self._buildid)