1
votes

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'
1
Variable is LIC_FILES_CHKSUMNayfe
Thanks for spotting that. Fixed the text. (not the cause of this problem)Rolf
You confirm your recipe contains LIC_FILES_CHKSUM and not LIC_FILE_CHKSUM ?Nayfe
You can try LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=987654..............." ?Nayfe
I tried to have a local License file but that defeats the md5 check to see wether the license has changed. I just now noticed that SRC_URL has an md5sum property, but the LIC_CHKSUM_FILES has an md5 property, this inconsistency may have bitten me. the file://${workdir} trick seems to have worked for this build.Rolf

1 Answers

1
votes

Thanks to @Nayfe my current build is now passing without errors. There were a few cached files which threw me off, and also there is a subtle difference between the way LIC_FILES_CHKSUM and SRC_URI work, althoug they look very similar. This is my working setup right now:

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"

Please note that:

  • LIC_FILES_CHKSUM has an md5 parameter, whereas SRC_URI uses md5sum for the same functionality
  • LIC_FILES_CHKSUM does not have the fetcher functionality SRC_URI has, meaning that you can't specify https:// or git:// in LIC_FILES_CHKSUM.