From 3d35d09ff2a9bb79f99ee45923fbe74c8fd6d0d7 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 6 Nov 2023 14:51:12 +0000 Subject: sstate: Ensure sstate searches update file mtime Commands like "bitbake XXX -S printdiff" search for sstate files but don't download them. This means that local files aren't touched as the download code would do, meaning the sstate cleanup scripts can delete them. This can then lead to obtuse build failures. Have the search code touch local files in the same way as the main code paths would to avoid these files disappearing. Move the function to a common touch() function in lib/oe instead of duplicating code. (From OE-Core rev: a27fc0bd5706ab5b9c68a0271fcf57377a678cdf) Signed-off-by: Richard Purdie --- meta/classes-global/sstate.bbclass | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'meta/classes-global/sstate.bbclass') diff --git a/meta/classes-global/sstate.bbclass b/meta/classes-global/sstate.bbclass index 2676f18e0a..5b27a1f0f9 100644 --- a/meta/classes-global/sstate.bbclass +++ b/meta/classes-global/sstate.bbclass @@ -937,6 +937,7 @@ def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True, sstatefile = d.expand("${SSTATE_DIR}/" + getsstatefile(tid, siginfo, d)) if os.path.exists(sstatefile): + oe.utils.touch(sstatefile) found.add(tid) bb.debug(2, "SState: Found valid sstate file %s" % sstatefile) else: @@ -1183,16 +1184,7 @@ python sstate_eventhandler() { if not os.path.exists(siginfo): bb.siggen.dump_this_task(siginfo, d) else: - try: - os.utime(siginfo, None) - except PermissionError: - pass - except OSError as e: - # Handle read-only file systems gracefully - import errno - if e.errno != errno.EROFS: - raise e - + oe.utils.touch(siginfo) } SSTATE_PRUNE_OBSOLETEWORKDIR ?= "1" -- cgit v1.2.3-54-g00ecf