Skip to contentSkip to conversation

GetBitbakeVersion.py: add buildstep to get the version of bitbake

PATCH In review [email protected] 2 participants 3 messages Jan 21, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 GetBitbakeVersion.py: add buildstep to get the version of bitbake

From: Brendan Le Foll <[email protected]>

This step allows people to use the property 'bitbakeversion' in their buildsteps which is useful before running bitbake to check what flags will be supported.

---
 docs/YoctoAutobuilderDevelopersDocument.html       | 11 +++++
 .../autobuilder/buildsteps/GetBitbakeVersion.py    | 49 ++++++++++++++++++++++
 2 files changed, 60 insertions(+)
 create mode 100644 lib/python2.7/site-packages/autobuilder/buildsteps/GetBitbakeVersion.py
docs/YoctoAutobuilderDevelopersDocument.html +11 -0
index 8a2747b..e583dea 100644
@@ -1500,6 +1500,17 @@
                 </tr>
                 <tr class="c3">
                     <td class="c24" colspan="1" rowspan="1">
+                        <p class="c0"><span class="c9">GetBitbakeVersion</span></p>
+                    </td>
+                    <td class="c5" colspan="1" rowspan="1">
+                        <p class="c0"><span class="c9">Gets the version of bitbake being used. This is used by BuildImages.</span></p>
+                    </td>
+                    <td class="c21" colspan="1" rowspan="1">
+                        <p class="c0"><span class="c9">&quot;bitbakeversion&quot;: string</span></p>
+                    </td>
+                </tr>
+                <tr class="c3">
+                    <td class="c24" colspan="1" rowspan="1">
                         <p class="c0"><span class="c9">GetDistroVersion</span></p>
                     </td>
                     <td class="c5" colspan="1" rowspan="1">
lib/python2.7/site-packages/autobuilder/buildsteps/GetBitbakeVersion.py new file +49 -0

49 lines not on this page · raw message

Signature · 1 line
2.2.1
#1 lore raw

PATCH 2/2 BuildImages.py: Make -w flag depend on bitbake version check

From: Brendan Le Foll <[email protected]>

Because bitbake -w flag does not exist in verisons of bitbake prior to 1.25 BuildImages.py is broken for anything older like daisy, adding this check means that -w will only be applied if the GetBitbakeVersion step has been run.

---
 lib/python2.7/site-packages/autobuilder/buildsteps/BuildImages.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
lib/python2.7/site-packages/autobuilder/buildsteps/BuildImages.py +6 -1
index 31a29a8..bf1ac5e 100644
@@ -13,6 +13,7 @@ __email__ = "[email protected]"
 
 from buildbot.steps.shell import ShellCommand
 from buildbot.process.buildstep import LogLineObserver
+from distutils.version import StrictVersion
 import os
 
 class BuildImages(ShellCommand):
@@ -47,7 +48,11 @@ class BuildImages(ShellCommand):
         if self.layerversion_yoctobsp is not None and int(self.layerversion_yoctobsp) < 2 and self.machine is not None and self.machine == "genericx86-64":
             self.command = "echo 'Skipping Step.'"
         else:
-            self.command = ". ./oe-init-build-env; bitbake -w -k " + self.images
+            bitbakeflags = "-k "
+            # -w only exists in bitbake 1.25 and newer, use distroversion string and make sure we're on poky >1.7
+            if self.getProperty('bitbakeversion') and StrictVersion(self.getProperty('bitbakeversion')) >= StrictVersion("1.25"):
+                bitbakeflags += "-w "
+            self.command = ". ./oe-init-build-env; bitbake " + bitbakeflags + self.images
             self.description = ["Building " + str(self.images)]
         ShellCommand.start(self)
 
Signature · 1 line
2.2.1
#2 lore raw

Re: [autobuilder][PATCH 2/2] BuildImages.py: Make -w flag depend on bitbake version check

Brendan,

Just a heads up, these AB patches will be reviewed when Beth comes back in just over 3 weeks, you should be able to fix your local AB instance for now.

Thanks for your patience

Sau!

Quoted 37 lines · On 01/21/2015 03:08 AM, [email protected] wrote:

From: Brendan Le Foll <[email protected]>

Because bitbake -w flag does not exist in verisons of bitbake prior to 1.25 BuildImages.py is broken for anything older like daisy, adding this check means that -w will only be applied if the GetBitbakeVersion step has been run.

---
  lib/python2.7/site-packages/autobuilder/buildsteps/BuildImages.py | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
lib/python2.7/site-packages/autobuilder/buildsteps/BuildImages.py +6 -1
index 31a29a8..bf1ac5e 100644
@@ -13,6 +13,7 @@ __email__ = "[email protected]"
 
  from buildbot.steps.shell import ShellCommand
  from buildbot.process.buildstep import LogLineObserver
+from distutils.version import StrictVersion
  import os
 
  class BuildImages(ShellCommand):
@@ -47,7 +48,11 @@ class BuildImages(ShellCommand):
          if self.layerversion_yoctobsp is not None and int(self.layerversion_yoctobsp) < 2 and self.machine is not None and self.machine == "genericx86-64":
              self.command = "echo 'Skipping Step.'"
          else:
-            self.command = ". ./oe-init-build-env; bitbake -w -k " + self.images
+            bitbakeflags = "-k "
+            # -w only exists in bitbake 1.25 and newer, use distroversion string and make sure we're on poky >1.7
+            if self.getProperty('bitbakeversion') and StrictVersion(self.getProperty('bitbakeversion')) >= StrictVersion("1.25"):
+                bitbakeflags += "-w "
+            self.command = ". ./oe-init-build-env; bitbake " + bitbakeflags + self.images
              self.description = ["Building " + str(self.images)]
          ShellCommand.start(self)