summaryrefslogtreecommitdiffstats
path: root/meta/classes/toaster.bbclass
diff options
context:
space:
mode:
authorJoshua Lock <joshua.g.lock@intel.com>2016-04-12 15:40:44 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-04-13 10:12:52 +0100
commitf5033175ef51cf234ab5a85293a30bd9d7440d75 (patch)
treea033f2f73a1e5f38409dfeb9a30d09a19582cb77 /meta/classes/toaster.bbclass
parent88f41780cad47b4340a6589e4e6d86722ab67aaa (diff)
downloadpoky-f5033175ef51cf234ab5a85293a30bd9d7440d75.tar.gz
toaster.bbclass: improve package information collection
The PACKAGES variable doesn't include all packages potentially generated by a recipe, not least of all because it doesn't include dynamic packages created via do_split_packages() or similar. Instead of trying to guess which packages were generated, walk ${PKGDESTWORK}/runtime to find all package information that was written to disk. This allows us to read all information for the complete list of packages generated by the recipe. For example before this patch we get SinglePackageInfo events for 9 packages from ncurses. With the patch applied we get 20 events for all of the packages created during an ncurses build. As a bonus we also switch to using the same postfuncs for both do_packagedata and do_packagedata_setscene as they each result in a PKGDESTWORK with the relevant directories and files created. [YOCTO #9115] (From OE-Core rev: f1f012962a18d16b1cc22bde836cbb46fe9e6088) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/toaster.bbclass')
-rw-r--r--meta/classes/toaster.bbclass50
1 files changed, 15 insertions, 35 deletions
diff --git a/meta/classes/toaster.bbclass b/meta/classes/toaster.bbclass
index 004e068de7..1a70f14a92 100644
--- a/meta/classes/toaster.bbclass
+++ b/meta/classes/toaster.bbclass
@@ -112,45 +112,25 @@ def _toaster_load_pkgdatafile(dirpath, filepath):
112 pass # ignore lines without valid key: value pairs 112 pass # ignore lines without valid key: value pairs
113 return pkgdata 113 return pkgdata
114 114
115python toaster_package_dumpdata_setscene() {
116 """
117 Dumps the data created by package_setscene
118 """
119 # replicate variables from the package.bbclass
120 packages = d.getVar('PACKAGES', True)
121 pkgdatadir = d.getVar('PKGDATA_DIR', True)
122 # scan and send data for each package
123 lpkgdata = {}
124 for pkg in packages.split():
125 try:
126 lpkgdata = _toaster_load_pkgdatafile(pkgdatadir + "/runtime/", pkg)
127 except:
128 # these are typically foo-locale which actually point into foo-locale-<language> in runtime-rprovides
129 bb.note("toaster_package_dumpdata_setscene: failed to load pkg information for: %s:%s"%(pkg,sys.exc_info()[0]))
130 # Fire an event containing the pkg data
131 bb.event.fire(bb.event.MetadataEvent("SinglePackageInfo", lpkgdata), d)
132
133}
134
135
136python toaster_package_dumpdata() { 115python toaster_package_dumpdata() {
137 """ 116 """
138 Dumps the data created by emit_pkgdata 117 Dumps the data about the packages created by a recipe
139 """ 118 """
140 # replicate variables from the package.bbclass
141
142 packages = d.getVar('PACKAGES', True)
143 pkgdatadir = d.getVar('PKGDESTWORK', True)
144 119
145 # scan and send data for each package 120 # No need to try and dumpdata if the recipe isn't generating packages
121 if not d.getVar('PACKAGES', True):
122 return
146 123
124 pkgdatadir = d.getVar('PKGDESTWORK', True)
147 lpkgdata = {} 125 lpkgdata = {}
148 for pkg in packages.split(): 126 datadir = os.path.join(pkgdatadir, 'runtime')
149 127
150 lpkgdata = _toaster_load_pkgdatafile(pkgdatadir + "/runtime/", pkg) 128 # scan and send data for each generated package
151 129 for datafile in os.listdir(datadir):
152 # Fire an event containing the pkg data 130 if not datafile.endswith('.packaged'):
153 bb.event.fire(bb.event.MetadataEvent("SinglePackageInfo", lpkgdata), d) 131 lpkgdata = _toaster_load_pkgdatafile(datadir, datafile)
132 # Fire an event containing the pkg data
133 bb.event.fire(bb.event.MetadataEvent("SinglePackageInfo", lpkgdata), d)
154} 134}
155 135
156# 2. Dump output image files information 136# 2. Dump output image files information
@@ -401,8 +381,8 @@ toaster_collect_task_stats[eventmask] = "bb.event.BuildCompleted bb.build.TaskSu
401addhandler toaster_buildhistory_dump 381addhandler toaster_buildhistory_dump
402toaster_buildhistory_dump[eventmask] = "bb.event.BuildCompleted" 382toaster_buildhistory_dump[eventmask] = "bb.event.BuildCompleted"
403 383
404do_packagedata_setscene[postfuncs] += "toaster_package_dumpdata_setscene " 384do_packagedata_setscene[postfuncs] += "toaster_package_dumpdata "
405do_packagedata_setscene[vardepsexclude] += "toaster_package_dumpdata_setscene " 385do_packagedata_setscene[vardepsexclude] += "toaster_package_dumpdata "
406 386
407do_package[postfuncs] += "toaster_package_dumpdata " 387do_package[postfuncs] += "toaster_package_dumpdata "
408do_package[vardepsexclude] += "toaster_package_dumpdata " 388do_package[vardepsexclude] += "toaster_package_dumpdata "