Re: [OE-core] [PATCH] buildhistory.bbclass: restore BUILDHISTORY_PRESERVE files

Richard Purdie
2025-06-23T20:48:31Z

On Wed, 2025-01-15 at 15:31 +0000, Pedro Ferreira via lists.openembedded.org wrote:
> From: Pedro Ferreira <Pedro.Silva.Ferreira@criticaltechworks.com>
>
> On each build using sstate-cache, buildhistory will move
> content to a temporary folder named `old`.
> When buildhistory looks for the main dir, it wont find it
> and ends up creating it.
> As a consequence how code is structured wont restore any
> preserved file.
>
> Code block moved to ensure if old dir exists, it will
> attempt to restore those files marked to preserve.
>
> Signed-off-by: Pedro Silva Ferreira <Pedro.Silva.Ferreira@criticaltechworks.com>
> ---
>  meta/classes/buildhistory.bbclass | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)

I spent a lot of time on Friday looking at this. The BUILDHISTORY_RESET
code path is horrible to understand and basically just hacked into na
don top of the rest of the system. BUILDHISTORY_PRESERVE was never
really intended as a end user API either.

After much consideration, I've sent a patch proposing we remove support
for BUILDHISTORY_RESET. I think the behaviour would be better coded
into the CI integration in different cases.

If we do want in tree support for this "reset" functionality, it needs
to be written in a way where the code can be understood and it needs to
have test cases. It would also need documentation as these code paths
are currently undocumented.

As Ross previously mentioned the interaction with an sstate cache is
also horrible and is another reason I think it is safer for the user to
do what they want/need CI side rather than in the class code. Sorry it
has taken as long to work all this out, the code really is hard to
unravel.

Cheers,

Richard