Checksum part of a licence file with beginline and endline
beginline and endline in LIC_FILES_CHKSUM checksum only part of a file, so a licence header in source code can be tracked, on Scarthgap 5.0.
Some projects carry the licence only as a comment at the top of a source file, and checksumming the whole file would break the recipe on every code change. LIC_FILES_CHKSUM accepts beginline and endline parameters, so BitBake hashes just those lines. This was written for Scarthgap 5.0 with BitBake 2.8.
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://src/main.c;beginline=1;endline=21;md5=0a1b2c3d4e5f60718293a4b5c6d7e8f9"ERROR: libfoo-1.0-r0 do_populate_lic: QA Issue: libfoo: The LIC_FILES_CHKSUM does not match for file://src/main.c;beginline=1;endline=21;md5=0a1b2c3d4e5f60718293a4b5c6d7e8f9
libfoo: The new md5 checksum is 9f8e7d6c5b4a39281706f5e4d3c2b1a0That error is what you see with a wrong or placeholder checksum, and it is also how you get the real value: copy the "new md5 checksum" into the recipe. Line numbers are one-based and inclusive. The check exists to catch a licence change on upgrade, so a header moved down by an added line will fail it, which is the point. The hash in the example is made up.