[yocto] [[yocto-autobuilder][PATCHv2] 01/15] lib/buildsteps.py: Add BitbakeShellCommand class

Aníbal Limón anibal.limon at linux.intel.com
Tue Jun 21 16:07:38 PDT 2016


The BitbakeShellCommand is a new class for store common methods when
is aim to run bitbake inside an step.

Also don't call directly the ShellCommand constructur use super to be
able for call the parent constructor no matter what is this enables
to call BitbakeShellCommand constructor.

Signed-off-by: Aníbal Limón <anibal.limon at linux.intel.com>
---
 lib/python2.7/site-packages/autobuilder/buildsteps/BuildImages.py  | 7 +++++--
 .../site-packages/autobuilder/buildsteps/BuildToolchainImages.py   | 7 +++++--
 .../site-packages/autobuilder/buildsteps/GetBitbakeVersion.py      | 6 ++++--
 .../site-packages/autobuilder/buildsteps/RunESDKSanityTests.py     | 6 ++++--
 .../site-packages/autobuilder/buildsteps/RunSDKSanityTests.py      | 6 ++++--
 .../site-packages/autobuilder/buildsteps/RunSanityTests.py         | 6 ++++--
 lib/python2.7/site-packages/autobuilder/lib/buildsteps.py          | 5 +++++
 7 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/lib/python2.7/site-packages/autobuilder/buildsteps/BuildImages.py b/lib/python2.7/site-packages/autobuilder/buildsteps/BuildImages.py
index 0cdd2ef..7ef8aab 100644
--- a/lib/python2.7/site-packages/autobuilder/buildsteps/BuildImages.py
+++ b/lib/python2.7/site-packages/autobuilder/buildsteps/BuildImages.py
@@ -17,7 +17,9 @@ from distutils.version import StrictVersion
 from buildbot.status.results import SUCCESS, SKIPPED
 import os
 
-class BuildImages(ShellCommand):
+from lib.buildsteps import BitbakeShellCommand
+
+class BuildImages(BitbakeShellCommand):
     haltOnFailure = False
     flunkOnFailure = True
     name = "BuildImages"
@@ -32,7 +34,8 @@ class BuildImages(ShellCommand):
         # Timeout needs to be passed to LoggingBuildStep as a kwarg
         self.timeout = 100000
         kwargs['timeout']=self.timeout
-        ShellCommand.__init__(self, **kwargs)
+        super(BuildImages, self).__init__(factory, argdict=None,
+                **kwargs)
 
     def start(self):
         self.localconf = self.getProperty("LOCALCONF")
diff --git a/lib/python2.7/site-packages/autobuilder/buildsteps/BuildToolchainImages.py b/lib/python2.7/site-packages/autobuilder/buildsteps/BuildToolchainImages.py
index 89402cd..5a540bf 100644
--- a/lib/python2.7/site-packages/autobuilder/buildsteps/BuildToolchainImages.py
+++ b/lib/python2.7/site-packages/autobuilder/buildsteps/BuildToolchainImages.py
@@ -15,7 +15,9 @@ from buildbot.steps.shell import ShellCommand
 from buildbot.process.buildstep import LogLineObserver
 import os
 
-class BuildToolchainImages(ShellCommand):
+from lib.buildsteps import BitbakeShellCommand
+
+class BuildToolchainImages(BitbakeShellCommand):
     haltOnFailure = False
     flunkOnFailure = True
     name = "Building Toolchain Images"
@@ -29,7 +31,8 @@ class BuildToolchainImages(ShellCommand):
         # Timeout needs to be passed to LoggingBuildStep as a kwarg
         self.timeout = 100000
         kwargs['timeout']=self.timeout
-        ShellCommand.__init__(self, **kwargs)
+        super(BuildToolchainImages, self).__init__(factory, argdict=None,
+                **kwargs)
 
     def start(self):
         layerversion = self.getProperty("layerversion_core")
diff --git a/lib/python2.7/site-packages/autobuilder/buildsteps/GetBitbakeVersion.py b/lib/python2.7/site-packages/autobuilder/buildsteps/GetBitbakeVersion.py
index 6eb1e21..6123343 100644
--- a/lib/python2.7/site-packages/autobuilder/buildsteps/GetBitbakeVersion.py
+++ b/lib/python2.7/site-packages/autobuilder/buildsteps/GetBitbakeVersion.py
@@ -16,7 +16,9 @@ from buildbot.process.properties import WithProperties
 from twisted.python import log
 from autobuilder.config import *
 
-class GetBitbakeVersion(ShellCommand):
+from lib.buildsteps import BitbakeShellCommand
+
+class GetBitbakeVersion(BitbakeShellCommand):
     haltOnFailure = False
     flunkOnFailure = False
     name = "GetBitbakeVersion"
@@ -27,7 +29,7 @@ class GetBitbakeVersion(ShellCommand):
         self.workerworkdir=os.path.join(os.path.join(YOCTO_ABBASE, "yocto-worker"))
         for k, v in argdict.iteritems():
             setattr(self, k, v)
-        ShellCommand.__init__(self, **kwargs)
+        super(GetBitbakeVersion, self).__init__(factory, argdict=None, **kwargs)
 
     def start(self):
         buildername=self.getProperty("buildername")
diff --git a/lib/python2.7/site-packages/autobuilder/buildsteps/RunESDKSanityTests.py b/lib/python2.7/site-packages/autobuilder/buildsteps/RunESDKSanityTests.py
index f0bddeb..7471d3d 100644
--- a/lib/python2.7/site-packages/autobuilder/buildsteps/RunESDKSanityTests.py
+++ b/lib/python2.7/site-packages/autobuilder/buildsteps/RunESDKSanityTests.py
@@ -16,7 +16,9 @@ from buildbot.status.results import SUCCESS, FAILURE
 from twisted.python import log as tlog
 import os, re
 
-class RunESDKSanityTests(ShellCommand):
+from lib.buildsteps import BitbakeShellCommand
+
+class RunESDKSanityTests(BitbakeShellCommand):
 
     haltOnFailure = False
     flunkOnFailure = True
@@ -39,7 +41,7 @@ class RunESDKSanityTests(ShellCommand):
             setattr(self, k, v)
         self.description = "Running SDK Sanity Tests"
         kwargs['timeout']=self.timeout
-        ShellCommand.__init__(self, **kwargs)
+        super(RunESDKSanityTests, self).__init__(factory, argdict=None, **kwargs)
 
     def start(self):
         layerversion = self.getProperty("layerversion_core")
diff --git a/lib/python2.7/site-packages/autobuilder/buildsteps/RunSDKSanityTests.py b/lib/python2.7/site-packages/autobuilder/buildsteps/RunSDKSanityTests.py
index 344dfd4..9b6eb5b 100644
--- a/lib/python2.7/site-packages/autobuilder/buildsteps/RunSDKSanityTests.py
+++ b/lib/python2.7/site-packages/autobuilder/buildsteps/RunSDKSanityTests.py
@@ -16,7 +16,9 @@ from buildbot.status.results import SUCCESS, FAILURE
 from twisted.python import log as tlog
 import os, re
 
-class RunSDKSanityTests(ShellCommand):
+from lib.buildsteps import BitbakeShellCommand
+
+class RunSDKSanityTests(BitbakeShellCommand):
 
     haltOnFailure = False
     flunkOnFailure = True
@@ -39,7 +41,7 @@ class RunSDKSanityTests(ShellCommand):
             setattr(self, k, v)
         self.description = "Running SDK Sanity Tests"
         kwargs['timeout']=self.timeout
-        ShellCommand.__init__(self, **kwargs)
+        super(RunSDKSanityTests, self).__init__(factory, argdict=None, **kwargs)
 
     def start(self):
         layerversion = self.getProperty("layerversion_core")
diff --git a/lib/python2.7/site-packages/autobuilder/buildsteps/RunSanityTests.py b/lib/python2.7/site-packages/autobuilder/buildsteps/RunSanityTests.py
index aeb02b1..4fa6dac 100644
--- a/lib/python2.7/site-packages/autobuilder/buildsteps/RunSanityTests.py
+++ b/lib/python2.7/site-packages/autobuilder/buildsteps/RunSanityTests.py
@@ -16,7 +16,9 @@ from buildbot.status.results import SUCCESS, FAILURE
 from twisted.python import log as tlog
 import os, re
 
-class RunSanityTests(ShellCommand):
+from lib.buildsteps import BitbakeShellCommand
+
+class RunSanityTests(BitbakeShellCommand):
 
     haltOnFailure = False
     flunkOnFailure = True
@@ -39,7 +41,7 @@ class RunSanityTests(ShellCommand):
             setattr(self, k, v)
         self.description = "Running Sanity Tests"
         kwargs['timeout']=self.timeout
-        ShellCommand.__init__(self, **kwargs)
+        super(RunSanityTests, self).__init__(factory, argdict=None, **kwargs)
 
     def start(self):
         layerversion = self.getProperty("layerversion_core")
diff --git a/lib/python2.7/site-packages/autobuilder/lib/buildsteps.py b/lib/python2.7/site-packages/autobuilder/lib/buildsteps.py
index 3693a7a..4f15dcf 100644
--- a/lib/python2.7/site-packages/autobuilder/lib/buildsteps.py
+++ b/lib/python2.7/site-packages/autobuilder/lib/buildsteps.py
@@ -11,6 +11,7 @@ __email__ = "anibal.limon at linux.intel.com"
 '''
 
 import os
+
 from buildbot.steps.shell import ShellCommand
 
 DEFAULT_SHELL = 'bash'
@@ -40,3 +41,7 @@ class ShellCommandCleanEnv(ShellCommand):
             pe_cmd += "%s=\"$%s\" " % (pe, pe)
 
         return "env -i %s %s -c " % (pe_cmd, shell)
+
+class BitbakeShellCommand(ShellCommand):
+    def __init__(self, factory, argdict=None, **kwargs):
+        super(BitbakeShellCommand, self).__init__(**kwargs)
-- 
2.1.4




More information about the yocto mailing list