Created attachment 4854 [details] Checksum Issue I want to dynamically update the md5sum and sha256sum as I have these values stored in a file that I would like to read it during the do_fetch. Parser Error: I do get a parser error if I don't mention the md5sum or sha256sum in the bb file. Hence I updated with a dummy value to fake the parser of the bb file. Do_fetch: I tried to update the Varflag of md5sum/sha256sum in the custom function of the do_fetch. The value aren't updated into the d instance of the bb file. Hence I am not able to dynamically/ programitically update the md5sum/sha256sum checksum. ython do_fetch() { bb.plain("Inside fetch") with open('/home/vrv1kor/Apricot/sources/meta-mbient/meta-apricot/recipes-apricot/tuxera/test.txt', 'r') as a: bb.plain('Inside file') print(a) while True: v = a.readline() bb.plain(v) if not v: break if 'md5' in v: (binz_md5, filename) = v.encode('ascii').strip().split() bb.plain(str(filename)) bb.plain(str(binz_md5)) else: binz_sha, filename = v.encode('ascii').strip().split() bb.plain(str(filename)) bb.plain(str(binz_md5)) d.setVarFlag('SRC_URI','md5sum', binz_md5) d.setVarFlag('SRC_URI','sha256sum', binz_sha) bb.plain('Value of md5 in do_fetch') bb.plain(str(d.getVarFlag('SRC_URI','md5sum'))) src_uri = (d.getVar('SRC_URI') or "").split() bb.plain(d.getVar('SRC_URI')) if len(src_uri) == 0: return try: fetcher = bb.fetch2.Fetch(src_uri, d) bb.plain("Before Download") fetcher.download() bb.plain("After Download") except bb.fetch2.BBFetchException as e: bb.fatal(str(e)) }
This isn't straightforward. We have a requirement that we compute the checksums of our tasks in advance of the build running. One of the things that has to go into that is the "value" of the source inputs, which includes the file checksums. You're asking to determine those hash values at build time which we simply don't support. We need to compute the task hashes in advance so we can query for sstate objects and accelerate the build if those checksums match. You could disable the checksums or set them to a dummy value. That has the issue that you don't know if one build output is equivalent to another unless there is some other way these are already uniquely identified to the build. If you do use a dummy value, there is the additional issue that the build then doesn't know when these inputs have changed and hence whether it has to rerun the build or not. We do support git "AUTOREV" where changes in a git repository would trigger new builds. There is specialist code to support that though and it is embedded into the recipe version information, do_fetch still isn't run in those cases.
As per Richard's comment.
This used to work: https://www.burtonini.com/blog/2017/06/13/dynamic-source-checksums/ However as the checksums are used for transfer validation, there's no real point in fetching checksums as that just means two files can be damaged in transfer instead of one. If the checksums change frequently and this is working around that, it's better to just turn off checksums with BB_STRICT_CHECKSUM = "ignore".