diff options
| author | David Reyna <David.Reyna@windriver.com> | 2017-06-27 13:44:31 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-06-28 16:02:15 +0100 |
| commit | eea5cb317137d71ad0cab954d2c9ad2069580b6f (patch) | |
| tree | 7a87db941eb376585520bf799a1270bf53d1b179 /bitbake/lib/toaster | |
| parent | 4f2baebf362d71351db044c0646f9bc6e8a39c49 (diff) | |
| download | poky-eea5cb317137d71ad0cab954d2c9ad2069580b6f.tar.gz | |
bitbake: toaster: large package set breaks sqlite query
If you build a project with a large package set, you will get a crash
in "views.py" when the dashboard attempts to fetch the package set to
calculate the package count and size. This is a sqlite limitation, and
it fails with as few as 1220 packages.
[YOCTO #11717]
(Bitbake rev: 02cb2b7f7ff594de75a404396f39a2428750c798)
Signed-off-by: David Reyna <David.Reyna@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster')
| -rwxr-xr-x | bitbake/lib/toaster/toastergui/views.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 75c5911036..5720b9d5e4 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py | |||
| @@ -457,10 +457,15 @@ def builddashboard( request, build_id ): | |||
| 457 | npkg = 0 | 457 | npkg = 0 |
| 458 | pkgsz = 0 | 458 | pkgsz = 0 |
| 459 | package = None | 459 | package = None |
| 460 | for package in Package.objects.filter(id__in = [x.package_id for x in t.target_installed_package_set.all()]): | 460 | # Chunk the query to avoid "too many SQL variables" error |
| 461 | pkgsz = pkgsz + package.size | 461 | package_set = t.target_installed_package_set.all() |
| 462 | if package.installed_name: | 462 | package_set_len = len(package_set) |
| 463 | npkg = npkg + 1 | 463 | for ps_start in range(0,package_set_len,500): |
| 464 | ps_stop = min(ps_start+500,package_set_len) | ||
| 465 | for package in Package.objects.filter(id__in = [x.package_id for x in package_set[ps_start:ps_stop]]): | ||
| 466 | pkgsz = pkgsz + package.size | ||
| 467 | if package.installed_name: | ||
| 468 | npkg = npkg + 1 | ||
| 464 | elem['npkg'] = npkg | 469 | elem['npkg'] = npkg |
| 465 | elem['pkgsz'] = pkgsz | 470 | elem['pkgsz'] = pkgsz |
| 466 | ti = Target_Image_File.objects.filter(target_id = t.id) | 471 | ti = Target_Image_File.objects.filter(target_id = t.id) |
