Bug 14893 - Non-deterministic Metadata for SDK build
Summary: Non-deterministic Metadata for SDK build
Status: RESOLVED WORKSFORME
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 3.1.14
Hardware: All Multiple
: Medium+ normal
Target Milestone: 4.2 M1
Assignee: Sakib Sajal
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2022-08-17 12:09 UTC by Frieder Schrempf
Modified: 2022-12-22 16:44 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frieder Schrempf 2022-08-17 12:09:20 UTC
Doing the following:

```
bitbake -c cleansstate meta-environment-<machine>
bitbake -c populate_sdk core-image-minimal
```

results in:

```
ERROR: When reparsing /yocto-ktn/build-sp5/../layers/poky/meta/recipes-core/meta/meta-environment.bb:do_generate_content, the basehash value changed from f8e0d4bacfb2940c49542bf6b72b81fa06f96746fa1f4acb58a56c4b28a766da to 2bd1f3bb9789d9d2330e546d0678ae875882376905b00de4d4661ec2c935eb27. The metadata is not deterministic and this needs to be fixed.
ERROR: The following commands may help:
ERROR: $ bitbake meta-environment-imx8mm-sp5 -cdo_generate_content -Snone
ERROR: Then:
ERROR: $ bitbake meta-environment-imx8mm-sp5 -cdo_generate_content -Sprintdiff
```

Debugging leads to the variable METADATA_REVISION in meta/classes/toolchain-scripts-base.bbclass changing from the git commit hash of the poky repo to <unknown>.

The following change seems to fix the issue, but I'm not sure if it's a valid fix. Maybe some other fix is needed to avoid having METADATA_REVISION change in the first place!?


```diff
--- a/meta/classes/toolchain-scripts-base.bbclass
+++ b/meta/classes/toolchain-scripts-base.bbclass
@@ -8,4 +8,4 @@ toolchain_create_sdk_version () {
        echo 'Metadata Revision: ${METADATA_REVISION}' >> $versionfile
        echo 'Timestamp: ${DATETIME}' >> $versionfile
 }
-toolchain_create_sdk_version[vardepsexclude] = "DATETIME"
+toolchain_create_sdk_version[vardepsexclude] = "DATETIME METADATA_REVISION"
```
Comment 1 Randy MacLeod 2022-08-18 14:50:11 UTC
Sakib, Check if this is reproducible.
If it's not (as we suspect), we'll need more info about how to reproduce the issue.

YP Triage
Comment 2 Sakib Sajal 2022-08-18 18:04:13 UTC
I was unable to reproduce the issue, steps provided below.
using poky at:
    commit 7e10918724646a86afd4739ea136dac63d22def3 (HEAD -> master, origin/master, origin/HEAD)
    Author: Khem Raj <raj.khem@gmail.com>
    Date:   Tue Aug 16 09:58:56 2022 -0700

Steps:
# setup build dir
bitbake core-image-minimal
bitbake -c cleansstate meta-environment-qemux86-64
bitbake -c populate_sdk core-image-minimal

All the above steps completed without warnings/errors.

Am I missing something?
Comment 3 Frieder Schrempf 2022-08-24 08:13:02 UTC
Ok, I did some more tests and so far I can only reproduce it on 3.1.14 which is outdated. On the recent Dunfell HEAD (3.1.19) I didn't see the issue anymore, so I assume it was fixed somewhere.

I guess you can safely close this report and sorry for the noise!
Comment 4 Randy MacLeod 2022-12-22 16:44:24 UTC
Works on supported branches.