【问题标题】:Unable to build python3-wsgiref in yocto 3.1.10无法在 yocto 3.1.10 中构建 python3-wsgiref
【发布时间】:2021-10-23 21:46:07
【问题描述】:

我正在尝试构建一个包含 python 服务 (radicale) 的 Yocto 图像,这需要来自 Python3 的 wsgiref。 Wsgiref 是 Python3 的一部分,然而,在 poky 中,没有提供 python3-wsgiref 的默认配方。为了构建它,必须对 poky/meta/recipes-devtools/python/python3/python3-manifest.json 进行以下更改:

-- a/python3-manifest.json
+++ b/python3-manifest.json
@@ -812,6 +812,7 @@
             "unittest",
             "unixadmin",
             "venv",
+            "wsgiref",
             "xml",
             "xmlrpc"
         ],
@@ -1196,6 +1197,37 @@
         ],
         "cached": []
     },
+    "wsgiref": {
+        "summary": "Web Server Gateway Interface Reference Implementation",
+        "rdepends": [
+            "core",
+            "crypt",
+            "datetime",
+            "email",
+            "html",
+            "io",
+            "math",
+            "mime",
+            "netclient",
+            "netserver",
+            "stringold"
+        ],
+        "files": [
+            "${libdir}/python${PYTHON_MAJMIN}/wsgiref/handlers.py",
+            "${libdir}/python${PYTHON_MAJMIN}/wsgiref/headers.py",
+            "${libdir}/python${PYTHON_MAJMIN}/wsgiref/simple_server.py",
+            "${libdir}/python${PYTHON_MAJMIN}/wsgiref/util.py",
+            "${libdir}/python${PYTHON_MAJMIN}/wsgiref/validate.py"
+        ],
+        "cached": [
+            "${libdir}/python${PYTHON_MAJMIN}/wsgiref/__pycache__",
+            "${libdir}/python${PYTHON_MAJMIN}/wsgiref/__pycache__/handlers.*.pyc",
+            "${libdir}/python${PYTHON_MAJMIN}/wsgiref/__pycache__/headers.*.pyc",
+            "${libdir}/python${PYTHON_MAJMIN}/wsgiref/__pycache__/simple_server.*.pyc",
+            "${libdir}/python${PYTHON_MAJMIN}/wsgiref/__pycache__/util.*.pyc",
+            "${libdir}/python${PYTHON_MAJMIN}/wsgiref/__pycache__/validate.*.pyc"
+        ]
+    },
     "xml": {
         "summary": "Python basic XML support",
         "rdepends": [

通过此更改,它将作为 python3 配方的一部分提供。

这是激进的秘诀:

SUMMARY = "CalDAV and CardDAV Server"
HOMEPAGE = "https://radicale.org/"
AUTHOR = "Guillaume Ayoub <guillaume.ayoub@kozea.fr>"
LICENSE = "GPLv3"
LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"

SRC_URI = "https://files.pythonhosted.org/packages/20/d2/0761fe39ac049b1e39790b051302008eafdc7b399a39268aa2204a0b9613/Radicale-3.0.6.tar.gz"
SRC_URI[md5sum] = "fa0879b70bdcd26477759eee347ea91f"
SRC_URI[sha256sum] = "a9433d3df97135d9c02cec8dde4199444daf1b73ad161ded398d67b8e629fdc6"

S = "${WORKDIR}/Radicale-3.0.6"

RDEPENDS_${PN} = "python3-defusedxml python3-passlib python3-vobject python3-python-dateutil python3-setuptools python3-fcntl python3-wsgiref"

inherit setuptools3

如您所见,python3-wsgiref 被附加到 RDEPENDS_${PN} 后,当我构建整个映像时,一切正常,服务能够在系统上启动。

但是,我想将对 python3-manifest.json 的更改放入补丁中,并将补丁应用到 bbappend 文件中。为此,我在我的自定义“meta-radicale”层中添加了一个 bbappend,“meta-radicale/recipes-devtools/python/python3_3.8.11.bbappend”:

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI_append = " file://build-wsgiref.patch;patchdir=${WORKDIR} "

上面显示的补丁被放入'meta-radicale/recipes-devtools/python/python3/build-wsgiref.patch'。

这是元根目录的整个文件树:

meta-radicale/
meta-radicale/recipes-radicale
meta-radicale/recipes-radicale/python
meta-radicale/recipes-radicale/python/python3-versions.inc
meta-radicale/recipes-radicale/python/python3-passlib_1.7.4.bb
meta-radicale/recipes-radicale/python/python3-six_1.16.0.bb
meta-radicale/recipes-radicale/python/python3-vobject_0.9.6.1.bb
meta-radicale/recipes-radicale/python/python3-python-dateutil_2.8.2.bb
meta-radicale/recipes-radicale/python/python3-radicale_3.0.6.bb
meta-radicale/recipes-radicale/python/python3-defusedxml_0.7.1.bb
meta-radicale/recipes-devtools
meta-radicale/recipes-devtools/python
meta-radicale/recipes-devtools/python/python3
meta-radicale/recipes-devtools/python/python3/build-wsgiref.patch
meta-radicale/recipes-devtools/python/python3_3.8.11.bbappend
meta-radicale/conf
meta-radicale/conf/layer.conf

“meta-radicale/recipes-radicale/python/”下的食谱是由“pipoe -p Radicale --python python3”创建的,并且工作正常,我对它们进行了测试。

如果我尝试构建映像,我会得到以下输出:

RROR: smokylinux-image-1.0-r0 do_rootfs: Could not invoke dnf. Command '/home/imanoid/workspace/smoky-pi/build/smoky-qemuarm64/tmp/work/qemuarm64-poky-linux/smokylinux-image/1.0-r0/recipe-sysroot-native/usr/bin/dnf -v --rpmverbosity=info -y -c /home/imanoid/workspace/smoky-pi/build/smoky-qemuarm64/tmp/work/qemuarm64-poky-linux/smokylinux-image/1.0-r0/rootfs/etc/dnf/dnf.conf --setopt=reposdir=/home/imanoid/workspace/smoky-pi/build/smoky-qemuarm64/tmp/work/qemuarm64-poky-linux/smokylinux-image/1.0-r0/rootfs/etc/yum.repos.d --installroot=/home/imanoid/workspace/smoky-pi/build/smoky-qemuarm64/tmp/work/qemuarm64-poky-linux/smokylinux-image/1.0-r0/rootfs --setopt=logdir=/home/imanoid/workspace/smoky-pi/build/smoky-qemuarm64/tmp/work/qemuarm64-poky-linux/smokylinux-image/1.0-r0/temp --repofrompath=oe-repo,/home/imanoid/workspace/smoky-pi/build/smoky-qemuarm64/tmp/work/qemuarm64-poky-linux/smokylinux-image/1.0-r0/oe-rootfs-repo --nogpgcheck install gerbera imanoid openssh openssh-sftp-server packagegroup-core-boot python3-radicale run-postinsts sudo vim' returned 1:
DNF version: 4.2.2
cachedir: /home/imanoid/workspace/smoky-pi/build/smoky-qemuarm64/tmp/work/qemuarm64-poky-linux/smokylinux-image/1.0-r0/rootfs/var/cache/dnf
Added oe-repo repo from /home/imanoid/workspace/smoky-pi/build/smoky-qemuarm64/tmp/work/qemuarm64-poky-linux/smokylinux-image/1.0-r0/oe-rootfs-repo
repo: using cache for: oe-repo
not found other for: 
not found modules for: 
not found deltainfo for: 
not found updateinfo for: 
oe-repo: using metadata from Mon 23 Aug 2021 01:56:26 PM UTC.
No module defaults found
--> Starting dependency resolution
--> Finished dependency resolution
Error: 
 Problem: conflicting requests
  - nothing provides python3-wsgiref needed by python3-radicale-3.0.6-r0.aarch64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

ERROR: Logfile of failure stored in: /home/imanoid/workspace/smoky-pi/build/smoky-qemuarm64/tmp/work/qemuarm64-poky-linux/smokylinux-image/1.0-r0/temp/log.do_rootfs.4376
ERROR: Task (/home/imanoid/workspace/smoky-pi/yocto/meta-smokylinux/recipes-smokylinux/images/smokylinux-image.bb:do_rootfs) failed with exit code '1'

我不明白为什么直接修改 python3-manifest.json 与通过补丁修改它时行为不同。

【问题讨论】:

  • 你确定补丁被应用了吗?我的意思是当你运行 bitbake python3 -c patch 并检查它是否在 python3 的 ${WORKDIR} 中应用时
  • @BelHadjSalemTALEL 感谢您的回复。是的。我执行了此检查,并且 /tmp/work/aarch64-poky-linux/python3/3.8.11-r0/python3-manifest.json 中的文件已修补。

标签: python-3.x yocto wsgiref


【解决方案1】:

经过一番谷歌搜索,我想我找到了问题的答案:https://hub.mender.io/t/how-to-work-with-python-applications-and-modules-in-yocto-project/1135

“您可以通过阅读此文件获得这些单独包的列表:

cat ../sources/poky/meta/recipes-devtools/python/python3/python3-manifest.json

如果标准库模块未在上述文件中列出,则它是 python3-misc 包的一部分。"

显然,默认的 python3 配方将所有不属于清单的标准 python 模块自动放入名为“python3-misc”的包中。所以我唯一需要做的就是在 python3-radicale_3.0.6.bb 的 RDEPENDS 行中添加“python3-misc”而不是“python3-wsgiref”:

RDEPENDS_${PN} = "python3-defusedxml python3-passlib python3-vobject python3-python-dateutil python3-setuptools python3-fcntl python3-misc"

现在编译成功,可以在目标系统中导入wsgiref模块了。

但是,至于为什么打补丁和编辑清单有区别,我还没有发现。

【讨论】:

    猜你喜欢
    • 2020-07-28
    • 2016-03-16
    • 2020-12-07
    • 2021-10-27
    • 1970-01-01
    • 2023-03-19
    • 1970-01-01
    • 2020-01-11
    • 2021-05-21
    相关资源
    最近更新 更多