我正在尝试构建一个Yocto镜像,其中包含一个python服务(radicale),它需要来自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/recipes-devtools/python/python3_3.8.11.bbappend':中添加了一个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/
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 python3 --python python‘创建的,运行良好,我对它们进行了测试。
如果我尝试构建镜像,我会得到以下输出:
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和通过patch修改它的行为是不同的。
发布于 2021-08-23 18:16:43
经过进一步的谷歌搜索,我想我找到了我的问题的答案: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-misc‘而不是'python3-wsgiref’添加到python3- line _3.0.6.bb的RDEPENDS行中:
RDEPENDS_${PN} = "python3-defusedxml python3-passlib python3-vobject python3-python-dateutil python3-setuptools python3-fcntl python3-misc"现在它编译成功,可以将wsgiref模块导入到目标系统中。
然而,至于为什么打补丁和编辑清单之间有区别,我还没有找到答案。
https://stackoverflow.com/questions/68894345
复制相似问题