Skip to content

Conversation

@markyang92
Copy link

@markyang92 markyang92 commented Sep 30, 2025

Since TOPDIR is appended to the LAYERDIR path contained in this variable, building from a different directory reduces the sstate-cache hit rate for recipes that use QCOM_COMMON_LICENSE_DIR.

TOPDIR1/tmp/sstate-diff/1759133466/qcs6490-rb3gen2-vision-kit/<TRIPLE>/time-genoff $ bitbake-diffsigs ./15.0.do_package.sigdata.28f71c835e5ca367eadc9011ae70403e8cb2bf33b8ae20fa040df5d69dfb6cfe \
TOPDIR2/tmp/sstate-diff/1759133333/qcs6490-rb3gen2-vision-kit/<TRIPLE>/time-genoff/15.0.do_package.sigdata.9eabc9947518db7de3427e8da226b6650ad4b3dad7b6659cbb21245a28460a32
NOTE: Starting bitbake server...
basehash changed from 9990fb107900393658bf819b17528ee4810cefe6d09660e6320eccc4e119dac0 to 327c12e7c95192e2d172d7022c2bdbadd292b5a687b0acc1ab939f19c2f7d216
Variable QCOM_COMMON_LICENSE_DIR value changed from '${@os.path.normpath("TOPDIR1/meta-qcom/meta-qcom-hwe")+'/files/common-licenses/'}' to '${@os.path.normpath("TOPDIR2/meta-qcom/meta-qcom-hwe")+'/files/common-licenses/'}'

@ricardosalveti
Copy link
Contributor

Thanks for the PR, will raise the issue internally (since this branch is not yet accepting changes directly via github).

conf/layer.conf Outdated
"

QCOM_COMMON_LICENSE_DIR = "${@os.path.normpath("${LAYERDIR}")+'/files/common-licenses/'}"
BB_BASEHASH_IGNORE_VARS += "QCOM_COMMON_LICENSE_DIR"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Full ignore the QCOM_COMMON_LICENSE_DIR can be problematic, we should just ignore what is not relevant in this case.

Can you please try this patch:

diff --git a/conf/layer.conf b/conf/layer.conf
index c1f1d1a5..320b3885 100644
--- a/conf/layer.conf
+++ b/conf/layer.conf
@@ -32,7 +32,8 @@ BBFILES_DYNAMIC += " \
     virtualization-layer:${LAYERDIR}/dynamic-layers/virtualization-layer/*/*/*.bbappend \
 "
 
-QCOM_COMMON_LICENSE_DIR = "${@os.path.normpath("${LAYERDIR}")+'/files/common-licenses/'}"
+QCOM_COMMON_LICENSE_DIR = "${QCOMHWEBASE}/files/common-licenses/"
+QCOM_COMMON_LICENSE_DIR[vardepsexclude] += "QCOMHWEBASE"
 
 # Set a variable to get to the top of this metalayer
 QCOMHWEBASE = '${@os.path.normpath("${LAYERDIR}")}'

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TOPDIR2/tmp/sstate-diff/1759282003/qcs6490-rb3gen2-vision-kit/<TRIPLE>/time-genoff $ bitbake-diffsigs ./15.0.do_package.sigdata.d7e8c5594f92c6e626d52a106c39a7b2fac6dc4d3e351170ebfb4e72222b000b \
> TOPDIR1/tmp/sstate-diff/1759282001/qcs6490-rb3gen2-vision-kit/<TRIPLE>/time-genoff/15.0.do_package.sigdata.d7e8c5594f92c6e626d52a106c39a7b2fac6dc4d3e351170ebfb4e72222b000b
NOTE: Starting bitbake server...

@markyang92 markyang92 force-pushed the scarthgap branch 4 times, most recently from ba6b11d to 73a508c Compare October 1, 2025 06:50
…LIC_FILES_CHKSUM

Since TOPDIR is appended to the LAYERDIR path contained in this variable,
building from a different directory reduces the sstate-cache hit rate for recipes that use QCOM_COMMON_LICENSE_DIR.

```
TOPDIR1/tmp/sstate-diff/1759133466/qcs6490-rb3gen2-vision-kit/<TRIPLE>/time-genoff $ bitbake-diffsigs ./15.0.do_package.sigdata.28f71c835e5ca367eadc9011ae70403e8cb2bf33b8ae20fa040df5d69dfb6cfe \
TOPDIR2/tmp/sstate-diff/1759133333/qcs6490-rb3gen2-vision-kit/<TRIPLE>/time-genoff/15.0.do_package.sigdata.9eabc9947518db7de3427e8da226b6650ad4b3dad7b6659cbb21245a28460a32
NOTE: Starting bitbake server...
basehash changed from 9990fb107900393658bf819b17528ee4810cefe6d09660e6320eccc4e119dac0 to 327c12e7c95192e2d172d7022c2bdbadd292b5a687b0acc1ab939f19c2f7d216
Variable QCOM_COMMON_LICENSE_DIR value changed from '${@os.path.normpath("TOPDIR1/meta-qcom/meta-qcom-hwe")+'/files/common-licenses/'}' to '${@os.path.normpath("TOPDIR2/meta-qcom/meta-qcom-hwe")+'/files/common-licenses/'}'
```

```
List of dependencies for variable LIC_FILES_CHKSUM is ['LICENSE', 'QCOM_COMMON_LICENSE_DIR']
List of dependencies for variable QCOM_COMMON_LICENSE_DIR is []
Variable LIC_FILES_CHKSUM value is file://${QCOM_COMMON_LICENSE_DIR}${LICENSE};md5=58d50a3d36f27f1a1e6089308a49b403
Variable QCOM_COMMON_LICENSE_DIR value is ${@os.path.normpath("TOPDIR1/meta-qcom/meta-qcom-hwe")+'/files/common-licenses/'}
```
The recipe directly depends on `LIC_FILES_CHKSUM`, and `LIC_FILES_CHKSUM` references `QCOM_COMMON_DIR`.

Therefore, excluding `QCOM_COMMON_LICENSE_DIR` from the hash value calculation in `LIC_FILES_CHKSUM` would ideally work.

```
TOPDIR2/tmp/sstate-diff/1759299422/qcs6490-rb3gen2-vision-kit/<TRIPLE>/time-genoff $ bitbake-dumpsig ./15.0.do_package.sigdata.763beb6ace3413d57a0a8e15a00d6ec3baf541ebfb050ebae2b627b3f03cecca | grep QCOM_COMMON_LICENSE_DIR
Variable LIC_FILES_CHKSUM value is file://${QCOM_COMMON_LICENSE_DIR}${LICENSE};md5=58d50a3d36f27f1a1e6089308a49b403
TOPDIR2/tmp/sstate-diff/1759299422/qcs6490-rb3gen2-vision-kit/<TRIPLE>/time-genoff $ bitbake-diffsigs ./15.0.do_package.sigdata.763beb6ace3413d57a0a8e15a00d6ec3baf541ebfb050ebae2b627b3f03cecca \
TOPDIR1/tmp/sstate-diff/1759299416/qcs6490-rb3gen2-vision-kit/<TRIPLE>/time-genoff/15.0.do_package.sigdata.763beb6ace3413d57a0a8e15a00d6ec3baf541ebfb050ebae2b627b3f03cecca
```

Signed-off-by: mark.yang <[email protected]>
@markyang92
Copy link
Author

Adding LIC_FILES_CHKSUM[vardepsexclude] += "QCOM_COMMON_LICENSE_DIR" looks more explicit. What do you think?

@quaresmajose
Copy link
Contributor

Adding just the QCOMHWEBASE is what we need given that it is what can vary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

3 participants