I have a Yocto recipe which downloads a few files, including a license file. In my recipe.bb, I have these listed in the SRC_URI variable:
SRC_URI="https://example.com/a_source_file;md5=12345 \
https://example.com/LICENSE;md5=987654"
Bitbake requires a LIC_FILE_CHKSUM, so I added the following line, expecting the license file to be checked after download:
LIC_FILE_CHKSUM="file://LICENSE;md5=987654"
With this setup, bitbake fails with the message:
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]
I tried to configure LIC_FILE_CHECKSUM so that it points to the https:// location but the license fetcher does not support fetching remote license files.
I also tried to have a local copy of the license file in a directory but bitbake still complains about an incorrect location, I suspect the wget fetcher messes with the local work directory paths. It is also a construction I'd rather not have because a local static copy defeats the purpose of the license file check.
I also tried to add an empty do_populate_lic
function to my .bb recipe file but that somehow does not override the function defined by yocto's license.bbclass
.
In summary: I'd like to download a couple of files in SRC_URI, one of which is the license file, and have the license file check work (or disabled, as the md5 check is alread done in the SRC_URI). How can I make that work?
Edit:
Implementing the suggestions from Nayfe: The checksum line copy/pasted from the project is now: LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5sum=650b869bd8ff2aed59c62bad2a22a821"
This gives different behavior, I now see the following error:
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'
LIC_FILES_CHKSUM
– NayfeLIC_FILES_CHKSUM
and notLIC_FILE_CHKSUM
? – NayfeLIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=987654..............."
? – NayfeSRC_URL
has anmd5sum
property, but theLIC_CHKSUM_FILES
has anmd5
property, this inconsistency may have bitten me. the file://${workdir} trick seems to have worked for this build. – Rolf