如何在Yocto中为SRC_URI中的https下载配置LIC_FILE_CHECKSUM



我有一个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函数,但这不知何故不会覆盖 yoctolicense.bbclass定义的函数。

总结:我想下载几个SRC_URI文件,其中一个是许可证文件,并让许可证文件检查工作(或禁用,因为 md5 检查是在SRC_URI中完成的)。我怎样才能做到这一点?

编辑: 实施 Nayfe 的建议:从项目复制/粘贴的校验和行现在是: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_URImd5sum用于相同的功能
  • LIC_FILES_CHKSUM没有SRC_URI具有的提取器功能,这意味着您无法在LIC_FILES_CHKSUM中指定https://git://

相关内容

最新更新