Skip to contentSkip to conversation

#11891 - Port bmaptools to Python 3

PATCH Superseded Ed Bartosh 3 participants 6 messages Sep 6, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Ed Bartosh

author
#0 lore raw

cover #11891 - Port bmaptools to Python 3

Hi,

This patchset switches bmap-tools to usage of native Python 3. As bmap-tools is the only recipe in oe-core that uses Python 2 this change should help to stop building native Python 2.

The following changes since commit 7a5d997dc264ca8913c5ea57a2c5120a2dc41528:

wic: selftest: add test_wic_rm_ext test case (2017-09-05 14:28:41 +0300)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib ed/wip
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/wip

Ed Bartosh (3):
bmap-tools: upgrade to v3.4
bmap-tools: switch to Python 3
wic: run bmaptool with native Python3

 .../bmap-tools/{bmap-tools_3.2.bb => bmap-tools_3.4.bb}          | 9 +++------
 scripts/lib/wic/plugins/imager/direct.py                         | 6 ++++--
 2 files changed, 7 insertions(+), 8 deletions(-)
 rename meta/recipes-support/bmap-tools/{bmap-tools_3.2.bb => bmap-tools_3.4.bb} (79%)

--
Regards,
Ed

author
#1 lore raw

PATCH 1/3 bmap-tools: upgrade to v3.4

Upgraded to the latest upstream release.

---
 .../bmap-tools/{bmap-tools_3.2.bb => bmap-tools_3.4.bb}               | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
 rename meta/recipes-support/bmap-tools/{bmap-tools_3.2.bb => bmap-tools_3.4.bb} (85%)
meta/recipes-support/bmap-tools/bmap-tools_3.4.bb renamed from meta/recipes-support/bmap-tools/bmap-tools_3.2.bb +2 -2
similarity index 85%
rename from meta/recipes-support/bmap-tools/bmap-tools_3.2.bb
rename to meta/recipes-support/bmap-tools/bmap-tools_3.4.bb
index b8ebe630815..9735707f85b 100644
@@ -10,7 +10,7 @@ LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
 
 SRC_URI = "git://github.com/01org/bmap-tools.git"
-SRCREV = "96702a869220ab20830db916ec4ac595e1d97f92"
+SRCREV = "v3.4"
 
 S = "${WORKDIR}/git"
 
@@ -21,5 +21,5 @@ inherit setuptools
 BBCLASSEXTEND = "native"
 
 do_install_append_class-native() {
-    sed -i -e 's|^#!.*/usr/bin/env python|#! /usr/bin/env nativepython|' ${D}${bindir}/bmaptool
+    sed -i -e 's|^#!.*/usr/bin/python-native/python|#! /usr/bin/env nativepython|' ${D}${bindir}/bmaptool
 }
Signature · 1 line
2.13.5
#2 lore raw

Re: [PATCH 1/3] bmap-tools: upgrade to v3.4

meta/recipes-support/bmap-tools/bmap-tools_3.4.bb LICENSE = "GPLv2" · line 13

Quoted 3 lines · Ed Bartosh
meta/recipes-support/bmap-tools/bmap-tools_3.4.bb renamed from meta/recipes-support/bmap-tools/bmap-tools_3.2.bb +1 -1
-SRCREV = "96702a869220ab20830db916ec4ac595e1d97f92"
+SRCREV = "v3.4"

Using a tag means a fetch to decide if we need to rebuild, and can change. Please just use the SHA of the tag, instead of the tag.

Ross

author
#3 lore raw

PATCH 2/3 bmap-tools: switch to Python 3

In reply to Ed Bartosh

bmap-tools is the only recipe in oe-core that still uses Python 2. Switching it to Python 3 should help to get rid of building native Python 2 and its dependencies.

[YOCTO: #11891]

---
 meta/recipes-support/bmap-tools/bmap-tools_3.4.bb | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
meta/recipes-support/bmap-tools/bmap-tools_3.4.bb +2 -5
index 9735707f85b..f52fa53b4f3 100644
@@ -16,10 +16,7 @@ S = "${WORKDIR}/git"
 
 RDEPENDS_${PN} = "python-core python-compression python-mmap"
 
-inherit setuptools
+inherit python3native
+inherit setuptools3
 
 BBCLASSEXTEND = "native"
-
-do_install_append_class-native() {
-    sed -i -e 's|^#!.*/usr/bin/python-native/python|#! /usr/bin/env nativepython|' ${D}${bindir}/bmaptool
-}
Signature · 1 line
2.13.5
author
#4 lore raw

PATCH 3/3 wic: run bmaptool with native Python3

In reply to Ed Bartosh

Modified wic code to run bmaptool using native Python3 from wic-tools native sysroot.

[YOCTO: #11891]

---
 scripts/lib/wic/plugins/imager/direct.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
scripts/lib/wic/plugins/imager/direct.py +4 -2
index 5765bbb527b..a6abc3d09ef 100644
@@ -213,8 +213,10 @@ class DirectPlugin(ImagerPlugin):
         # Generate .bmap
         if self.bmap:
             logger.debug("Generating bmap file for %s", disk_name)
-            exec_native_cmd("bmaptool create %s -o %s.bmap" % (full_path, full_path),
-                            self.native_sysroot)
+            python = os.path.join(self.native_sysroot, 'usr/bin/python3-native/python3')
+            bmaptool = os.path.join(self.native_sysroot, 'usr/bin/bmaptool')
+            exec_native_cmd("%s %s create %s -o %s.bmap" % \
+                            (python, bmaptool, full_path, full_path), self.native_sysroot)
         # Compress the image
         if self.compressor:
             logger.debug("Compressing disk %s with %s", disk_name, self.compressor)
Signature · 1 line
2.13.5
#5 lore raw

✗ patchtest: failure for #11891 - Port bmaptools to Python 3

In reply to Ed Bartosh

== Series Details ==

Series: #11891 - Port bmaptools to Python 3
Revision: 1
URL : https://patchwork.openembedded.org/series/8732/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

* Patch            [2/3] bmap-tools: switch to Python 3
 Issue             Yocto Project bugzilla tag is not correctly formatted [test_bugzilla_entry_format] 
  Suggested fix    Specify bugzilla ID in commit description with format: "[YOCTO #<bugzilla ID>]"

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

---

Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe