如何修改 yocto 配方以从本地文件夹而不是官方 GitHub 存储库获取源文件?

问题描述 投票:0回答:1

在 yocto linux 发行版中的 Pillow 上安装

我已经在基于 yocto 的发行版中安装了 Pillow Python 库。我使用了以下食谱:

meta-openembedded/meta-python/recipes-devtools/python/python3-pillow_6.2.1.bb

以下说明已添加到

my_image_recipe.bb

IMAGE_INSTALL += "python3-pillow"

正确的图像编译后,Pillow 现在已安装在我的 Linux 发行版中。

修改SRC_URI以从本地目录获取源

我需要的是创建一个

.bbappend
文件来修改 Pillow 配方的
SRC_URI
变量的值。在原始配方中,该变量的值为:

SRC_URI = "git://github.com/python-pillow/Pillow.git;branch=6.2.x \
           file://0001-support-cross-compiling.patch \
           file://0001-explicitly-set-compile-options.patch \
"

有了这个值

SRC_URI
,当我执行命令时:

> bitbake python3-pillow

Pillow 的源代码树是从分配给 SRC_URI 的 URI 值指向的

GitHub 存储库
下载的,该值是:
git://github.com/python-pillow/Pillow.git;branch=6.2.x

通过获取过程,源文件将保存在我的本地文件夹中,名为
downloads
。该文件夹是映像构建过程执行的所有下载的目标。

创建图像后

downloads
在以下子文件夹中包含Pillow源树:

downloads/git2/github.com.python-pillow.Pillow.git/

我的问题

我想将下载的源树复制到路径

downloads/git2/github.com.python-pillow.Pillow.git/
中名为
my-downloads
的不同文件夹中,并按如下方式修改
SRC_URI
变量:

SRC_URI = "file:///path/to/my-downloads/... \  # <---??? What do I have to write in this assignment exactly???
           file://0001-support-cross-compiling.patch \
           file://0001-explicitly-set-compile-options.patch \
"

这样,当我下次编译 Pillow 时,

bitbake
将从
my-downloads
而不是从 GitHub 获取 Pillow 源代码树。

我到底需要为

SRC_URI
分配什么才能让
bitbake
在我的本地文件夹
my-downloads
中找到 Pillow 源?


我已经尝试过here提出的解决方案,但它在我的上下文中不起作用,可能是因为我没有从本地 git 存储库获取源代码,而是直接从文件系统获取源代码。

git yocto yocto-recipe
1个回答
0
投票

要从文件系统而不是 GitHub 站点获取 Pillow 的源代码,我必须定义文件

python3-pillow_%.bbappend
,并进行以下分配:

SRC_URI = "git:///file:///path/to/my-downloads/github.com.python-pillow.Pillow.git;branch=6.2.x;protocol=file \
           file://0001-support-cross-compiling.patch \
           file://0001-explicitly-set-compile-options.patch \
"

GIT Fetcher 的参数
protocol
branch

正如here所解释的那样,为了解决问题中显示的问题,需要了解的最重要的概念是:

  • 通过
    GIT Fetcher
     设置 
    git://
  • 设置参数
    protocol=file
    GIT Fetcher
  • 设置参数
    branch=6.2.x
    GIT Fetcher

通过这种方式,代码是通过文件系统获取的,而不是从 GitHub 站点获取的。

注意

这篇文章是正确的,但对于我的问题,它缺少参数

branch
,所以在测试时它并没有完美回答我的问题。

© www.soinside.com 2019 - 2024. All rights reserved.