From 97f77ea3313b0d79ae4a6090672a2a9344282262 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Wed, 25 Nov 2015 10:30:30 +0100 Subject: buildhistory.bbclass: support extending the content of the build history The idea behind the implementation of Yocto #8138 was that an additional class can write additional files in the recipe directories, for example by hooking into the functions of buildhistory.bbclass or by implementing its own SSTATEPOSTINSTFUNCS function. However, when these additional files get created before buildhistory_emit_pkghistory(), they get removed again by that function because it contains code which removes everything it does not know about. The reason for that is that these unknown items are probably obsolete. This logic is the reason why the additional "kconfig" file from buildhistory-extra.bbclass never showed up in the final build history. To fix this, the hard-coded list of known files in buildhistory_emit_pkghistory() must be turned into a variable which derived classes can extend. Signed-off-by: Patrick Ohly Signed-off-by: Ross Burton --- meta/classes/buildhistory.bbclass | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'meta/classes/buildhistory.bbclass') diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass index 729dcd449d..6023e5d9a5 100644 --- a/meta/classes/buildhistory.bbclass +++ b/meta/classes/buildhistory.bbclass @@ -23,6 +23,16 @@ sstate_install[vardepsexclude] += "buildhistory_emit_pkghistory" # then the value added to SSTATEPOSTINSTFUNCS: SSTATEPOSTINSTFUNCS[vardepvalueexclude] .= "| buildhistory_emit_pkghistory" +# All items excepts those listed here will be removed from a recipe's +# build history directory by buildhistory_emit_pkghistory(). This is +# necessary because some of these items (package directories, files that +# we no longer emit) might be obsolete. +# +# When extending build history, derive your class from buildhistory.bbclass +# and extend this list here with the additional files created by the derived +# class. +BUILDHISTORY_PRESERVE = "latest latest_srcrev" + # # Write out metadata about this package for comparison when writing future packages # @@ -165,12 +175,13 @@ python buildhistory_emit_pkghistory() { raise packagelist = packages.split() + preserve = d.getVar('BUILDHISTORY_PRESERVE', True).split() if not os.path.exists(pkghistdir): bb.utils.mkdirhier(pkghistdir) else: # Remove files for packages that no longer exist for item in os.listdir(pkghistdir): - if item != "latest" and item != "latest_srcrev": + if item not in preserve: if item not in packagelist: itempath = os.path.join(pkghistdir, item) if os.path.isdir(itempath): -- cgit 1.2.3-korg