dnf: move the entire dnf/rpm4 stack to Python 3
PATCH v2 1/1 dnf: move the entire dnf/rpm4 stack to Python 3
[YOCTO #11180]
---
meta/classes/rootfs_rpm.bbclass | 4 +-
meta/conf/distro/include/security_flags.inc | 3 +-
.../createrepo-c/createrepo-c_git.bb | 4 +-
.../dnf/dnf/0028-Use-backports.lzma-not-lzma.patch | 30 --
.../dnf/0030-Run-python-scripts-using-env.patch | 6 +-
meta/recipes-devtools/dnf/dnf_git.bb | 15 +-
meta/recipes-devtools/libcomps/libcomps_git.bb | 6 +-
meta/recipes-devtools/libdnf/libdnf_git.bb | 17 +-
meta/recipes-devtools/librepo/librepo_git.bb | 4 +-
...-not-add-include-and-library-directories-.patch | 32 --
.../python-backports-lzma_git.bb | 21 -
.../0001-Add-python-3-compatibility.patch | 552 +++++++++++++++++++++
...hon-iniparse_0.4.bb => python3-iniparse_0.4.bb} | 8 +-
...ython-pygpgme_0.3.bb => python3-pygpgme_0.3.bb} | 6 +-
...N_ABI-when-searching-for-python-libraries.patch | 30 ++
meta/recipes-devtools/rpm/rpm_git.bb | 16 +-
16 files changed, 621 insertions(+), 133 deletions(-)
delete mode 100644 meta/recipes-devtools/dnf/dnf/0028-Use-backports.lzma-not-lzma.patch
delete mode 100644 meta/recipes-devtools/python-backports-lzma/python-backports-lzma/0001-setup.py-do-not-add-include-and-library-directories-.patch
delete mode 100644 meta/recipes-devtools/python-backports-lzma/python-backports-lzma_git.bb
create mode 100644 meta/recipes-devtools/python/python3-iniparse/0001-Add-python-3-compatibility.patch
rename meta/recipes-devtools/python/{python-iniparse_0.4.bb => python3-iniparse_0.4.bb} (75%)
rename meta/recipes-devtools/python/{python-pygpgme_0.3.bb => python3-pygpgme_0.3.bb} (86%)
create mode 100644 meta/recipes-devtools/rpm/files/0001-Add-PYTHON_ABI-when-searching-for-python-libraries.patchmeta/classes/rootfs_rpm.bbclass +2 -2
@@ -11,8 +11,8 @@ export STAGING_LIBDIR # Add 100Meg of extra space for dnf IMAGE_ROOTFS_EXTRA_SPACE_append = "${@bb.utils.contains("PACKAGE_INSTALL", "dnf", " + 102400", "" ,d)}" -# Dnf is python based, so be sure python-native is available to us. -EXTRANATIVEPATH += "python-native" +# Dnf is python based, so be sure python3-native is available to us. +EXTRANATIVEPATH += "python3-native" # opkg is needed for update-alternatives RPMROOTFSDEPENDS = "rpm-native:do_populate_sysroot \
meta/conf/distro/include/security_flags.inc +1 -2
@@ -72,12 +72,11 @@ SECURITY_CFLAGS_pn-openssl = "${SECURITY_NO_PIE_CFLAGS}" SECURITY_CFLAGS_pn-opensp = "${SECURITY_NO_PIE_CFLAGS}" SECURITY_CFLAGS_pn-ppp = "${SECURITY_NO_PIE_CFLAGS}" SECURITY_CFLAGS_pn-python = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-python-backports-lzma = "${SECURITY_NO_PIE_CFLAGS}" SECURITY_CFLAGS_pn-python-pycurl = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-python-pygpgme = "${SECURITY_NO_PIE_CFLAGS}" SECURITY_CFLAGS_pn-python-numpy = "${SECURITY_NO_PIE_CFLAGS}" SECURITY_CFLAGS_pn-python3-numpy = "${SECURITY_NO_PIE_CFLAGS}" SECURITY_CFLAGS_pn-python3-pycairo = "${SECURITY_NO_PIE_CFLAGS}" +SECURITY_CFLAGS_pn-python3-pygpgme = "${SECURITY_NO_PIE_CFLAGS}" SECURITY_CFLAGS_pn-python3 = "${SECURITY_NO_PIE_CFLAGS}" SECURITY_CFLAGS_pn-syslinux = "${SECURITY_NO_PIE_CFLAGS}" SECURITY_CFLAGS_pn-slang = "${SECURITY_NO_PIE_CFLAGS}"
meta/recipes-devtools/createrepo-c/createrepo-c_git.bb +2 -2
@@ -17,9 +17,9 @@ S = "${WORKDIR}/git" DEPENDS = "expat curl glib-2.0 libxml2 openssl bzip2 zlib file sqlite3 xz rpm" DEPENDS_append_class-native = " file-replacement-native" -inherit cmake pkgconfig bash-completion distutils-base +inherit cmake pkgconfig bash-completion distutils3-base -EXTRA_OECMAKE = " -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR}" +EXTRA_OECMAKE = " -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR} -DPYTHON_DESIRED=3" BBCLASSEXTEND = "native"
meta/recipes-devtools/dnf/dnf/0028-Use-backports.lzma-not-lzma.patch deleted +0 -30
@@ -1,30 +0,0 @@ -From 89af5c84d4b920d22ae882fcc5ab71ba09443cea Mon Sep 17 00:00:00 2001 -From: Alexander Kanavin <[email protected]> -Date: Fri, 30 Dec 2016 18:28:18 +0200 -Subject: [PATCH 28/30] Use backports.lzma, not lzma - -This is needed when using Python 2.x and should be dropped -after moving to Python 3.x - -Upstream-Status: Inappropriate [oe-core specific] -Signed-off-by: Alexander Kanavin <[email protected]> ---- - dnf/yum/misc.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/dnf/yum/misc.py b/dnf/yum/misc.py -index 441b0148..6b4aea0a 100644 ---- a/dnf/yum/misc.py -+++ b/dnf/yum/misc.py -@@ -37,7 +37,7 @@ import gpgme.editutil - import gzip - import hashlib - import io --import lzma -+import backports.lzma - import os - import os.path - import pwd --- -2.11.0 -
meta/recipes-devtools/dnf/dnf/0030-Run-python-scripts-using-env.patch +3 -3
@@ -19,7 +19,7 @@ index 5b06aa26..9f6f703e 100755 +++ b/bin/dnf-automatic.in @@ -1,4 +1,4 @@ -#!@PYTHON_EXECUTABLE@ -+#!/usr/bin/env python ++#!/usr/bin/env python3 # dnf-automatic executable. # # Copyright (C) 2014-2016 Red Hat, Inc.
@@ -29,7 +29,7 @@ index 645d0f06..ab141abd 100755 +++ b/bin/dnf.in @@ -1,4 +1,4 @@ -#!@PYTHON_EXECUTABLE@ -+#!/usr/bin/env python ++#!/usr/bin/env python3 # The dnf executable script. # # Copyright (C) 2012-2016 Red Hat, Inc.
@@ -39,7 +39,7 @@ index f1fee071..013dc8c5 100755 +++ b/bin/yum.in @@ -1,4 +1,4 @@ -#!@PYTHON_EXECUTABLE@ -+#!/usr/bin/env python ++#!/usr/bin/env python3 # The dnf executable script. # # Copyright (C) 2016 Red Hat, Inc.
meta/recipes-devtools/dnf/dnf_git.bb +6 -9
@@ -5,7 +5,6 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ " SRC_URI = "git://github.com/rpm-software-management/dnf.git \ - file://0028-Use-backports.lzma-not-lzma.patch \ file://0029-Do-not-set-PYTHON_INSTALL_DIR-by-running-python.patch \ file://0030-Run-python-scripts-using-env.patch \ file://0001-Do-not-prepend-installroot-to-logdir.patch \
@@ -18,24 +17,22 @@ SRCREV = "f0093d672d3069cfee8447973ae70ef615fd8886" S = "${WORKDIR}/git" -inherit cmake gettext bash-completion distutils-base systemd +inherit cmake gettext bash-completion distutils3-base systemd -DEPENDS += "libdnf librepo libcomps python-pygpgme python-iniparse" -# python 2.x only, drop when moving to python 3.x -DEPENDS += "python-backports-lzma" +DEPENDS += "libdnf librepo libcomps python3-pygpgme python3-iniparse" # manpages generation requires http://www.sphinx-doc.org/ -EXTRA_OECMAKE = " -DWITH_MAN=0 -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR}" +EXTRA_OECMAKE = " -DWITH_MAN=0 -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR} -DPYTHON_DESIRED=3" BBCLASSEXTEND = "native nativesdk" -RDEPENDS_${PN}_class-target += "python-core python-codecs python-netclient python-email python-threading python-distutils librepo python-shell python-subprocess libcomps libdnf python-sqlite3 python-compression python-pygpgme python-backports-lzma python-rpm python-iniparse python-json python-importlib python-curses python-argparse" +RDEPENDS_${PN}_class-target += "python3-core python3-codecs python3-netclient python3-email python3-threading python3-distutils librepo python3-shell python3-subprocess libcomps libdnf python3-sqlite3 python3-compression python3-pygpgme python3-rpm python3-iniparse python3-json python3-importlib python3-curses python3-argparse python3-misc" # Create a symlink called 'dnf' as 'make install' does not do it, but # .spec file in dnf source tree does (and then Fedora and dnf documentation # says that dnf binary is plain 'dnf'). do_install_append() { - ln -s -r ${D}/${bindir}/dnf-2 ${D}/${bindir}/dnf - ln -s -r ${D}/${bindir}/dnf-automatic-2 ${D}/${bindir}/dnf-automatic + ln -s -r ${D}/${bindir}/dnf-3 ${D}/${bindir}/dnf + ln -s -r ${D}/${bindir}/dnf-automatic-3 ${D}/${bindir}/dnf-automatic } # Direct dnf-native to read rpm configuration from our sysroot, not the one it was compiled in
meta/recipes-devtools/libcomps/libcomps_git.bb +3 -3
@@ -13,11 +13,11 @@ SRCREV = "01a4759894cccff64d2561614a58281adf5ce859" S = "${WORKDIR}/git" -inherit cmake distutils-base +inherit cmake distutils3-base -DEPENDS = "libxml2 expat libcheck" +DEPENDS += "libxml2 expat libcheck" -EXTRA_OECMAKE = " -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR}" +EXTRA_OECMAKE = " -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR} -DPYTHON_DESIRED=3" OECMAKE_SOURCEPATH = "${S}/libcomps" BBCLASSEXTEND = "native nativesdk"
meta/recipes-devtools/libdnf/libdnf_git.bb +3 -14
@@ -17,20 +17,9 @@ S = "${WORKDIR}/git" DEPENDS = "glib-2.0 libsolv libcheck librepo rpm gtk-doc" -inherit gtk-doc gobject-introspection cmake pkgconfig - -# We cannot inherit pythonnative (or descendant classes like distutils etc.) -# because that would conflict with inheriting python3native -# (which is done by inheriting gobject-introspection). -# But libdnf only needs the path to native Python 2.x binary -# so we simply set it explicitly here. -# -# These lines can be dropped when dnf stack is moved to python 3.x -EXTRANATIVEPATH += "python-native" -FILES_${PN} += " ${libdir}/python2.7/*" -DEPENDS += "python-native" - -EXTRA_OECMAKE = " -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR} -DWITH_MAN=OFF \ +inherit gtk-doc gobject-introspection cmake pkgconfig distutils3-base + +EXTRA_OECMAKE = " -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR} -DWITH_MAN=OFF -DPYTHON_DESIRED=3 \ ${@bb.utils.contains('GI_DATA_ENABLED', 'True', '-DWITH_GIR=ON', '-DWITH_GIR=OFF', d)} \ " EXTRA_OECMAKE_append_class-native = " -DWITH_GIR=OFF"
meta/recipes-devtools/librepo/librepo_git.bb +2 -2
@@ -16,9 +16,9 @@ S = "${WORKDIR}/git" DEPENDS = "curl expat glib-2.0 openssl attr libcheck gpgme" -inherit cmake distutils-base pkgconfig +inherit cmake distutils3-base pkgconfig -EXTRA_OECMAKE = " -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR}" +EXTRA_OECMAKE = " -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR} -DPYTHON_DESIRED=3" BBCLASSEXTEND = "native nativesdk"
meta/recipes-devtools/python-backports-lzma/python-backports-lzma/0001-setup.py-do-not-add-include-and-library-directories-.patch deleted +0 -32
@@ -1,32 +0,0 @@ -From e5e3196cf69172b625c8c6ccca991c02fd18137c Mon Sep 17 00:00:00 2001 -From: Alexander Kanavin <[email protected]> -Date: Fri, 30 Dec 2016 18:02:12 +0200 -Subject: [PATCH] setup.py: do not add include and library directories from the - host - -This avoids host contamination. - -Upstream-Status: Inappropriate [oe-core specific] -Signed-off-by: Alexander Kanavin <[email protected]> ---- - setup.py | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/setup.py b/setup.py -index 7886cf7..9a0356a 100644 ---- a/setup.py -+++ b/setup.py -@@ -31,9 +31,7 @@ packages = ["backports", "backports.lzma"] - home = os.path.expanduser("~") - extens = [Extension('backports/lzma/_lzma', - ['backports/lzma/_lzmamodule.c'], -- libraries = ['lzma'], -- include_dirs = [os.path.join(home, 'include'), '/opt/local/include', '/usr/local/include'], -- library_dirs = [os.path.join(home, 'lib'), '/opt/local/lib', '/usr/local/lib'] -+ libraries = ['lzma'] - )] - - descr = "Backport of Python 3.3's 'lzma' module for XZ/LZMA compressed files." --- -2.11.0 -
meta/recipes-devtools/python-backports-lzma/python-backports-lzma_git.bb deleted +0 -21
@@ -1,21 +0,0 @@ -HOMEPAGE = "https://github.com/peterjc/backports.lzma" -LICENSE = "BSD" -LIC_FILES_CHKSUM = "file://LICENSE;md5=846e05e7e9e1c886b2637c230cfcd5dd" - -SRC_URI = "git://github.com/peterjc/backports.lzma.git \ - file://0001-setup.py-do-not-add-include-and-library-directories-.patch \ - " - -PV = "0.0.6+git${SRCPV}" -SRCREV = "718b3316ae7aee8e03c02e7e110108779ce3aec8" - -S = "${WORKDIR}/git" - -inherit distutils - -DEPENDS_append = " xz" - -RDEPENDS_${PN} += "python-core python-io python-pkgutil" -RDEPENDS_${PN}_class-native += "python-core" - -BBCLASSEXTEND = "native nativesdk"
meta/recipes-devtools/python/python3-iniparse/0001-Add-python-3-compatibility.patch new file +552 -0
552 lines not on this page · raw message
meta/recipes-devtools/python/python3-iniparse_0.4.bb renamed from meta/recipes-devtools/python/python-iniparse_0.4.bb +5 -3
@@ -4,13 +4,15 @@ LICENSE = "MIT & PSF" LIC_FILES_CHKSUM = "file://LICENSE-PSF;md5=1c78a5bb3584b353496d5f6f34edb4b2 \ file://LICENSE;md5=52f28065af11d69382693b45b5a8eb54" -SRC_URI = "https://files.pythonhosted.org/packages/source/i/iniparse/iniparse-${PV}.tar.gz" +SRC_URI = "https://files.pythonhosted.org/packages/source/i/iniparse/iniparse-${PV}.tar.gz \ + file://0001-Add-python-3-compatibility.patch " SRC_URI[md5sum] = "5e573e9e9733d97623881ce9bbe5eca6" SRC_URI[sha256sum] = "abc1ee12d2cfb2506109072d6c21e40b6c75a3fe90a9c924327d80bc0d99c054" -inherit distutils +inherit distutils3 -RDEPENDS_${PN} += "python-core" +RDEPENDS_${PN} += "python3-core python3-six" +DEPENDS += "python3-six" BBCLASSEXTEND = "native nativesdk"
meta/recipes-devtools/python/python3-pygpgme_0.3.bb renamed from meta/recipes-devtools/python/python-pygpgme_0.3.bb +3 -3
@@ -9,10 +9,10 @@ SRC_URI[sha256sum] = "5fd887c407015296a8fd3f4b867fe0fcca3179de97ccde90449853a3df S = "${WORKDIR}/pygpgme-${PV}" -inherit distutils +inherit distutils3 -DEPENDS = "gpgme python" +DEPENDS = "gpgme python3" -RDEPENDS_${PN} += "python-core" +RDEPENDS_${PN} += "python3-core" BBCLASSEXTEND = "native nativesdk"
meta/recipes-devtools/rpm/files/0001-Add-PYTHON_ABI-when-searching-for-python-libraries.patch new file +30 -0
@@ -0,0 +1,30 @@ +From 36cf0ff26ece53e529e8b4f2d2f09acd8794b055 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin <[email protected]> +Date: Fri, 24 Mar 2017 15:35:47 +0200 +Subject: [PATCH] Add PYTHON_ABI when searching for python libraries. + +It has a value of 'm' when using Python3, and so without it +configure will not find the libraries. + +Upstream-Status: Inappropriate [oe-core specific] +Signed-off-by: Alexander Kanavin <[email protected]> +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 9c58467c1..a506ec819 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -642,7 +642,7 @@ AS_IF([test "$enable_python" = yes],[ + ]) + CPPFLAGS="$save_CPPFLAGS" + save_LIBS="$LIBS" +- AC_SEARCH_LIBS([Py_Main],[python${PYTHON_VERSION} python],[ ++ AC_SEARCH_LIBS([Py_Main],[python${PYTHON_VERSION}${PYTHON_ABI} python],[ + WITH_PYTHON_LIB="$ac_res" + ],[AC_MSG_ERROR([missing python library]) + ]) +-- +2.11.0 +
meta/recipes-devtools/rpm/rpm_git.bb +9 -7
@@ -13,8 +13,8 @@ simplify the process of creating graphical package managers or any \ other tools that need an intimate knowledge of RPM packages in order \ to function." -SUMMARY_python-rpm = "Python bindings for apps which will manupulate RPM packages" -DESCRIPTION_python-rpm = "The rpm-python package contains a module that permits applications \ +SUMMARY_python3-rpm = "Python bindings for apps which will manupulate RPM packages" +DESCRIPTION_python3-rpm = "The python3-rpm package contains a module that permits applications \ written in the Python programming language to use the interface \ supplied by the RPM Package Manager libraries."
@@ -34,6 +34,7 @@ SRC_URI = "git://github.com/rpm-software-management/rpm \ file://0001-Do-not-hardcode-lib-rpm-as-the-installation-path-for.patch \ file://0001-Fix-build-with-musl-C-library.patch \ file://0001-Add-a-color-setting-for-mips64_n32-binaries.patch \ + file://0001-Add-PYTHON_ABI-when-searching-for-python-libraries.patch \ " PV = "4.13.90+git${SRCPV}"
@@ -42,10 +43,11 @@ SRCREV = "a8e51b3bb05c6acb1d9b2e3d34f859ddda1677be" S = "${WORKDIR}/git" -DEPENDS = "nss libarchive db file popt xz dbus elfutils python" +DEPENDS = "nss libarchive db file popt xz dbus elfutils python3" DEPENDS_append_class-native = " file-replacement-native" -inherit autotools gettext pkgconfig pythonnative +inherit autotools gettext pkgconfig python3native +export PYTHON_ABI # OE-core patches autoreconf to additionally run gnu-configize, which fails with this recipe EXTRA_AUTORECONF_append = " --exclude=gnu-configize"
@@ -102,9 +104,9 @@ FILES_${PN} += "${libdir}/rpm-plugins/*.so \ FILES_${PN}-dev += "${libdir}/rpm-plugins/*.la \ " -PACKAGES += "python-rpm" -PROVIDES += "python-rpm" -FILES_python-rpm = "${PYTHON_SITEPACKAGES_DIR}/rpm/*" +PACKAGES += "python3-rpm" +PROVIDES += "python3-rpm" +FILES_python3-rpm = "${PYTHON_SITEPACKAGES_DIR}/rpm/*" # rpm 5.x was packaging the rpm build tools separately PROVIDES += "rpm-build"
Signature · 1 line
2.11.0
Quoted 1 line · Alexander Kanavin
[YOCTO #11180]
So close but:
https://autobuilder.yocto.io/builders/nightly-multilib/builds/226
https://autobuilder.yocto.io/builders/nightly-x32/builds/206
Cheers,
Richard
Quoted 6 lines · Richard Purdie
Quoted 1 line
[YOCTO #11180]
So close but:
https://autobuilder.yocto.io/builders/nightly-multilib/builds/226
https://autobuilder.yocto.io/builders/nightly-x32/builds/206
This is actually a bug in our target Python 3 installation. No idea how it went unnoticed - does no one use Python 3 on target with multilib or x32 at all?
Python 3.5.2 (default, Mar 27 2017, 11:43:41)
[GCC 6.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
import site
site.getsitepackages()
['/usr/lib/python3.5/site-packages']
^^^ !!!
Alex
Quoted 15 lines · Alexander Kanavin
Quoted 7 lines · Richard Purdie
Quoted 3 lines
[YOCTO #11180]
So close but:
https://autobuilder.yocto.io/builders/nightly-multilib/builds/226
https://autobuilder.yocto.io/builders/nightly-x32/builds/206This is actually a bug in our target Python 3 installation. No idea how
it went unnoticed - does no one use Python 3 on target with multilib or
x32 at all?
Quoted 8 lines
Python 3.5.2 (default, Mar 27 2017, 11:43:41) [GCC 6.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import site
>>>site.getsitepackages()['/usr/lib/python3.5/site-packages']
^^^ !!!
Highlights we need better testing, thanks for fixing it!
Cheers,
Richard