Skip to contentSkip to conversation

#11891 - Port bmaptools to Python 3

PATCH New Ed Bartosh 1 participant 4 messages Sep 6, 2017

lore
Share & tools
lore

Ed Bartosh

author
#0 lore raw

v2 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.

Changes in v2: Used commit id instead of release tag (thanks to Ross)
Fixed wrong bug spec in commit messages (thanks to Patchwork)

The following changes since commit 091b759dcec3068eb0b6bffdc5763fd6cc84d0a9:

wic: selftest: add test_wic_rm_ext test case (2017-09-06 13:02:02 +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
#2 lore raw

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

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 3f75fad44b4..7454f9db751 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
#3 lore raw

PATCH v2 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
author
#1 lore raw

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

In reply to Ed Bartosh

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} (84%)
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 84%
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..3f75fad44b4 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 = "9dad724104df265442226972a1e310813f9ffcba"
 
 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