[yocto] Checksum of an external file

Anton Gerasimov anton at advancedtelematic.com
Mon Dec 11 05:19:32 PST 2017


Hi,

my recipe takes a path to a file on user's file system as an input,
processes it and stores on the device. Sometimes user wants to update
this file and I'd like the recipe to be rebuilt every time the file
itself changes, even if the file path didn't.

So I had an illusion to understand how sstate cache works and wrote the
following code:

    def calculate_file_sha256(bb, d):
        return bb.utils.sha256_file(d.getVar("PATH_TO_FILE"))

    PATH_TO_FILE[vardepvalue] = "${@calculate_file_sha256(bb, d)}"

Unfortunately this doesn't work as expected (the recipe doesn't get
rebuilt when the file changes, looks like calculate_file_sha256 doesn't
run unless PATH_TO_FILE has changed) and at the same time if I
'cleanall' the recipe and change the file before rebuilding I get a lot
of "metadata is not deterministic" errors.

Is there a proper way to do that with bitbake?

Thanks,
Anton Gerasimov






More information about the yocto mailing list