Bug 5263

Summary: buildhistory should always record PKG, PKGE, PKGV and PKGR
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Chen Qi <Qi.Chen>
Component: coreAssignee: Chen Qi <Qi.Chen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: bluelightning, jessica.zhang, liezhi.yang, mark.hatle, meta.mr.watcher, meta.watcher, sgw, yi.zhao
Version: 1.5   
Target Milestone: 1.5 M5   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Chen Qi 2013-09-25 01:50:53 UTC
Currently, if PKGV equals to PV, it will not be written to buildhistory.

pkgvars['PKGV'] = pkginfo.pkgv if pkginfo.pkgv != pkginfo.pv else ''

However, in buildhistory-diff, PKGV, instead of PV, is regarded as a monitored variable.

So buildhistory.bbclass always record PV instead of PKGV, but buildhistory-diff
treats PKGV as a monitored variable instead of PV. This results in the following unexpected behavior.

If a recipe's PV changes, for example, hello_1.0.bb is renamed to hello_2.0.bb.
Then buildhistory-diff cannot report changes in PV area. And actually, the PKGV is not recorded.

So I would like to suggest that in buildhistory.bbclass, we always record PKGV.
The same logic applies to PKG, PKGE and PKGR.

-        pkgvars['PKG'] = pkginfo.pkg if pkginfo.pkg != pkginfo.name else ''
-        pkgvars['PKGE'] = pkginfo.pkge if pkginfo.pkge != pkginfo.pe else ''
-        pkgvars['PKGV'] = pkginfo.pkgv if pkginfo.pkgv != pkginfo.pv else ''
-        pkgvars['PKGR'] = pkginfo.pkgr if pkginfo.pkgr != pkginfo.pr else ''
+        pkgvars['PKG'] = pkginfo.pkg
+        pkgvars['PKGE'] = pkginfo.pkge
+        pkgvars['PKGV'] = pkginfo.pkgv
+        pkgvars['PKGR'] = pkginfo.pkgr

//Chen Qi
Comment 1 Paul Eggleton 2013-09-30 15:25:49 UTC
I'm a bit confused as to what issue you're actually trying to solve here. buildhistory-diff is only supposed to report PKG, PKGE, PKGV and PKGR changing if the value has been set differently from the corresponding standard variable, so as far as I can tell it's working as designed.
Comment 2 Mark Hatle 2013-10-01 17:25:12 UTC
Chen Qi is on vacation for a few days, so I'm going to step in and attempt to answer the question from Paul.

I believe this change is requested because otherwise there is no way to detect a package upgrade/uprev when using buildhistory.  This type of upgrade can happy when comparing no-GPLv3 and GPLv3 builds -- or just simple software updates when a layer gets updated.

We want to use the buildhistory from one build to the next to look for changes that have occurred that may be unexpected.
Comment 3 Chen Qi 2013-10-08 02:03:21 UTC
Hi Paul,

In bitbake.conf, we have:
PKGV ?= "${PV}"

So if not set specially, when PV changes, PKGV changes as well; it's just that PKGV is not recorded and buildhistory-diff only catches changes of PKGV instead of PV.

Here's an example showing that when changing PV, PKGV actually changes.
chenqi@pek-qchen1-d1:~/poky/build$ bitbake useradd-example -e | grep ^PKGV
PKGV="1.0"
chenqi@pek-qchen1-d1:~/poky/build$ mv ../meta-skeleton/recipes-skeleton/useradd/useradd-example.bb ../meta-skeleton/recipes-skeleton/useradd/useradd-example_2.0.bb
chenqi@pek-qchen1-d1:~/poky/build$ bitbake useradd-example -e | grep ^PKGV
PKGV="2.0"

The problem I'm solving here is to make buildhistory catch PKGV changes correctly. For now, even if PKGV changes, buildhistory-diff cannot catch the change as PKGV equals to PV and is not recorded.

Best Regards,
Chen Qi
Comment 4 Paul Eggleton 2013-10-28 09:59:55 UTC
This has been fixed in a slightly different way in master:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=f995febd2ebd43774cb1cc5917f3f3c46a744519