如何在 Yocto 中为 SRC_URI 中的 https 下载配置 LIC_FILE_CHECKSUM
How to configure LIC_FILE_CHECKSUM for https downloads in SRC_URI in Yocto
我有一个 Yocto 食谱,它下载了一些文件,包括一个许可证文件。在我的 recipe.bb 中,我在 SRC_URI 变量中列出了这些:
SRC_URI="https://example.com/a_source_file;md5=12345 \
https://example.com/LICENSE;md5=987654"
Bitbake 需要 LIC_FILE_CHKSUM,所以我添加了以下行,希望在下载后检查许可证文件:
LIC_FILE_CHKSUM="file://LICENSE;md5=987654"
使用此设置,bitbake 失败并显示消息:
ERROR: <recipe> do_populate_lic: QA Issue: <recipe>: LIC_FILES_CHKSUM points to an invalid file: /home/rolf/.yocto/tmp/work/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/<recipe>/<version>/<recipe>-<version>/LICENSE [license-checksum]
我尝试配置 LIC_FILE_CHECKSUM 使其指向 https:// 位置,但许可证获取器不支持获取远程许可证文件。
我还尝试在目录中创建许可证文件的本地副本,但 bitbake 仍然抱怨位置不正确,我怀疑 wget 提取器弄乱了本地工作目录路径。这也是我不想拥有的结构,因为本地静态副本违背了许可证文件检查的目的。
我还尝试在我的 .bb 配方文件中添加一个空的 do_populate_lic
函数,但不知何故不会覆盖 yocto 的 license.bbclass
.
定义的函数
总结:我想在 SRC_URI 中下载几个文件,其中一个是许可证文件,并让许可证文件检查工作(或禁用,因为 md5 检查已经完成)在 SRC_URI 中完成)。我怎样才能做到这一点?
编辑:
实施 Nayfe 的建议:项目中的校验和行 copy/pasted 现在是:LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5sum=650b869bd8ff2aed59c62bad2a22a821"
这给出了不同的行为,我现在看到以下错误:
NOTE: recipe <recipe>-0.2.0-RC.3-r0: task do_populate_lic: Started
WARNING: <recipe>-0.2.0-RC.3-r0 do_populate_lic: <recipe>: No generic license file exists for: commercial in any provider
NOTE: recipe <recipe>-0.2.0-RC.3-r0: task do_populate_lic: Failed
ERROR: <recipe>-0.2.0-RC.3-r0 do_populate_lic: QA Issue: <recipe>: LIC_FILES_CHKSUM is not specified for file:///home/teamcity/.yocto/tmp/work/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/<recipe>/0.2.0-RC.3-r0/LICENSE;md5sum=650b869bd8ff2aed59c62bad2a22a821
<recipe>: The md5 checksum is 650b869bd8ff2aed59c62bad2a22a821 [license-checksum]
ERROR: <recipe>-0.2.0-RC.3-r0 do_populate_lic: Fatal QA errors found, failing task.
ERROR: <recipe>-0.2.0-RC.3-r0 do_populate_lic: Function failed: populate_lic_qa_checksum
ERROR: Logfile of failure stored in: /home/teamcity/.yocto/tmp/work/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/<recipe>/0.2.0-RC.3-r0/temp/log.do_populate_lic.15429
ERROR: Task (/opt/TeamCity/work/7b9b2cdef27c03cf/src/layers/meta-pi3-ostree/recipes-electron/<recipe>/<recipe>.bb:do_populate_lic) failed with exit code '1'
感谢@Nayfe,我当前的构建现在可以顺利通过了。有一些缓存文件让我失望,LIC_FILES_CHKSUM 和 SRC_URI 的工作方式也有细微差别,尽管它们看起来非常相似。这是我现在的工作设置:
LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=d7bfc32a4337317666d20f2c8c6a8ae1"
SRC_URI="https://internal/artifact/repo/some.executable;md5sum=c46c37e358a12280abbee6948e3c5c39 \
https://internal/artifact/repo/LICENSE;md5sum=d7bfc32a4337317666d20f2c8c6a8ae1"
请注意:
LIC_FILES_CHKSUM
有一个 md5
参数,而 SRC_URI
使用 md5sum
相同的功能
LIC_FILES_CHKSUM
没有 SRC_URI
具有的提取器功能,这意味着您不能在 LIC_FILES_CHKSUM
中指定 https://
或 git://
。
我有一个 Yocto 食谱,它下载了一些文件,包括一个许可证文件。在我的 recipe.bb 中,我在 SRC_URI 变量中列出了这些:
SRC_URI="https://example.com/a_source_file;md5=12345 \
https://example.com/LICENSE;md5=987654"
Bitbake 需要 LIC_FILE_CHKSUM,所以我添加了以下行,希望在下载后检查许可证文件:
LIC_FILE_CHKSUM="file://LICENSE;md5=987654"
使用此设置,bitbake 失败并显示消息:
ERROR: <recipe> do_populate_lic: QA Issue: <recipe>: LIC_FILES_CHKSUM points to an invalid file: /home/rolf/.yocto/tmp/work/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/<recipe>/<version>/<recipe>-<version>/LICENSE [license-checksum]
我尝试配置 LIC_FILE_CHECKSUM 使其指向 https:// 位置,但许可证获取器不支持获取远程许可证文件。
我还尝试在目录中创建许可证文件的本地副本,但 bitbake 仍然抱怨位置不正确,我怀疑 wget 提取器弄乱了本地工作目录路径。这也是我不想拥有的结构,因为本地静态副本违背了许可证文件检查的目的。
我还尝试在我的 .bb 配方文件中添加一个空的 do_populate_lic
函数,但不知何故不会覆盖 yocto 的 license.bbclass
.
总结:我想在 SRC_URI 中下载几个文件,其中一个是许可证文件,并让许可证文件检查工作(或禁用,因为 md5 检查已经完成)在 SRC_URI 中完成)。我怎样才能做到这一点?
编辑:
实施 Nayfe 的建议:项目中的校验和行 copy/pasted 现在是:LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5sum=650b869bd8ff2aed59c62bad2a22a821"
这给出了不同的行为,我现在看到以下错误:
NOTE: recipe <recipe>-0.2.0-RC.3-r0: task do_populate_lic: Started
WARNING: <recipe>-0.2.0-RC.3-r0 do_populate_lic: <recipe>: No generic license file exists for: commercial in any provider
NOTE: recipe <recipe>-0.2.0-RC.3-r0: task do_populate_lic: Failed
ERROR: <recipe>-0.2.0-RC.3-r0 do_populate_lic: QA Issue: <recipe>: LIC_FILES_CHKSUM is not specified for file:///home/teamcity/.yocto/tmp/work/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/<recipe>/0.2.0-RC.3-r0/LICENSE;md5sum=650b869bd8ff2aed59c62bad2a22a821
<recipe>: The md5 checksum is 650b869bd8ff2aed59c62bad2a22a821 [license-checksum]
ERROR: <recipe>-0.2.0-RC.3-r0 do_populate_lic: Fatal QA errors found, failing task.
ERROR: <recipe>-0.2.0-RC.3-r0 do_populate_lic: Function failed: populate_lic_qa_checksum
ERROR: Logfile of failure stored in: /home/teamcity/.yocto/tmp/work/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/<recipe>/0.2.0-RC.3-r0/temp/log.do_populate_lic.15429
ERROR: Task (/opt/TeamCity/work/7b9b2cdef27c03cf/src/layers/meta-pi3-ostree/recipes-electron/<recipe>/<recipe>.bb:do_populate_lic) failed with exit code '1'
感谢@Nayfe,我当前的构建现在可以顺利通过了。有一些缓存文件让我失望,LIC_FILES_CHKSUM 和 SRC_URI 的工作方式也有细微差别,尽管它们看起来非常相似。这是我现在的工作设置:
LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=d7bfc32a4337317666d20f2c8c6a8ae1"
SRC_URI="https://internal/artifact/repo/some.executable;md5sum=c46c37e358a12280abbee6948e3c5c39 \
https://internal/artifact/repo/LICENSE;md5sum=d7bfc32a4337317666d20f2c8c6a8ae1"
请注意:
LIC_FILES_CHKSUM
有一个md5
参数,而SRC_URI
使用md5sum
相同的功能LIC_FILES_CHKSUM
没有SRC_URI
具有的提取器功能,这意味着您不能在LIC_FILES_CHKSUM
中指定https://
或git://
。