summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorFarrell Wymore <farrell.wymore@windriver.com>2014-04-02 15:04:08 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-04-05 14:55:29 +0100
commit10297261219d4373843b31e8aaaed094fcbcf605 (patch)
tree49c52ac778e5a4c9bead6d48cc79a5b6bf39b718 /bitbake
parent9db433246fbab66a646ce9188d7f9b096df8552b (diff)
downloadpoky-10297261219d4373843b31e8aaaed094fcbcf605.tar.gz
bitbake: toaster: correct package count
The package count was incorrect because it was counting anonymous packages. the full path of the image files was shortened to just the filename. [YOCTO 6087] [YOCTO 6091] (Bitbake rev: 06b190b2c23799bd2c9749be28e11bf5d59ed4fc) Signed-off-by: Farrell Wymore <farrell.wymore@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/toastergui/templates/builddashboard.html2
-rw-r--r--bitbake/lib/toaster/toastergui/views.py73
2 files changed, 47 insertions, 28 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/builddashboard.html b/bitbake/lib/toaster/toastergui/templates/builddashboard.html
index 891d86078b..fa4b194eb9 100644
--- a/bitbake/lib/toaster/toastergui/templates/builddashboard.html
+++ b/bitbake/lib/toaster/toastergui/templates/builddashboard.html
@@ -155,7 +155,7 @@
155 <h4><a href="{% url 'recipes' build.pk %}">Recipes</a> & <a href="{% url 'packages' build.pk %}">Packages</a></h4> 155 <h4><a href="{% url 'recipes' build.pk %}">Recipes</a> & <a href="{% url 'packages' build.pk %}">Packages</a></h4>
156 <dl> 156 <dl>
157 <dt>Recipes built</dt><dd><a href="{% url 'recipes' build.pk %}">{{recipecount}}</a></dd> 157 <dt>Recipes built</dt><dd><a href="{% url 'recipes' build.pk %}">{{recipecount}}</a></dd>
158 <dt>Packages built</dt><dd><a href="{% url 'packages' build.pk %}">{{build.package_set.all.count}}</a></dd> 158 <dt>Packages built</dt><dd><a href="{% url 'packages' build.pk %}">{{packagecount}}</a></dd>
159 </dl> 159 </dl>
160 </div> 160 </div>
161</div> 161</div>
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index e346ac4cf1..2da81c1ede 100644
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -381,42 +381,60 @@ def builds(request):
381# Each build may contain multiple targets and each target 381# Each build may contain multiple targets and each target
382# may generate multiple image files. display them all. 382# may generate multiple image files. display them all.
383# 383#
384def builddashboard(request, build_id): 384def builddashboard( request, build_id ):
385 template = "builddashboard.html" 385 template = "builddashboard.html"
386 if Build.objects.filter(pk=build_id).count() == 0 : 386 if Build.objects.filter( pk=build_id ).count( ) == 0 :
387 return redirect(builds) 387 return redirect( builds )
388 build = Build.objects.filter(pk = build_id)[0]; 388 build = Build.objects.filter( pk = build_id )[ 0 ];
389 layerVersionId = Layer_Version.objects.filter( build = build_id ); 389 layerVersionId = Layer_Version.objects.filter( build = build_id );
390 recipeCount = Recipe.objects.filter( layer_version__id__in = layerVersionId ).count( ); 390 recipeCount = Recipe.objects.filter( layer_version__id__in = layerVersionId ).count( );
391 tgts = Target.objects.filter( build_id = build_id ).order_by( 'target' ); 391 tgts = Target.objects.filter( build_id = build_id ).order_by( 'target' );
392 392
393 ##
393 # set up custom target list with computed package and image data 394 # set up custom target list with computed package and image data
394 targets = [ ]; 395 #
395 ntargets = 0; 396
396 hasImages = False; 397 targets = [ ]
398 ntargets = 0
399 hasImages = False
397 for t in tgts: 400 for t in tgts:
398 elem = { }; 401 elem = { }
399 elem[ 'target' ] = t; 402 elem[ 'target' ] = t
400 if ( t.is_image ): 403 if ( t.is_image ):
401 hasImages = True; 404 hasImages = True
402 npkg = 0; 405 npkg = 0
403 pkgsz = 0; 406 pkgsz = 0
404 pid= 0; 407 pid= 0
405 tp = Target_Installed_Package.objects.filter( target_id = t.id ); 408 tp = Target_Installed_Package.objects.filter( target_id = t.id )
406 package = None; 409 package = None
407 for p in tp: 410 for p in tp:
408 pid = p.package_id; 411 pid = p.package_id
409 package = Package.objects.get( pk = p.package_id ) 412 package = Package.objects.get( pk = p.package_id )
410 pkgsz = pkgsz + package.size; 413 pkgsz = pkgsz + package.size
411 npkg = npkg + 1; 414 if ( package.installed_name ):
412 elem[ 'npkg' ] = npkg; 415 npkg = npkg + 1
413 elem[ 'pkgsz' ] = pkgsz; 416 elem[ 'npkg' ] = npkg
414 ti = Target_Image_File.objects.filter( target_id = t.id ); 417 elem[ 'pkgsz' ] = pkgsz
415 imageFiles = [ ]; 418 ti = Target_Image_File.objects.filter( target_id = t.id )
419 imageFiles = [ ]
416 for i in ti: 420 for i in ti:
417 imageFiles.append({ 'path': i.file_name, 'size' : i.file_size }); 421 ndx = i.file_name.rfind( '/' )
418 elem[ 'imageFiles' ] = imageFiles; 422 if ( ndx < 0 ):
419 targets.append( elem ); 423 ndx = 0;
424 f = i.file_name[ ndx + 1: ]
425 imageFiles.append({ 'path': f, 'size' : i.file_size })
426 elem[ 'imageFiles' ] = imageFiles
427 targets.append( elem )
428
429 ##
430 # how many packages in this build - ignore anonymous ones
431 #
432
433 packageCount = 0
434 packages = Package.objects.filter( build_id = build_id )
435 for p in packages:
436 if ( p.installed_name ):
437 packageCount = packageCount + 1
420 438
421 context = { 439 context = {
422 'build' : build, 440 'build' : build,
@@ -424,9 +442,10 @@ def builddashboard(request, build_id):
424 'ntargets' : ntargets, 442 'ntargets' : ntargets,
425 'targets' : targets, 443 'targets' : targets,
426 'recipecount' : recipeCount, 444 'recipecount' : recipeCount,
427 'logmessages' : LogMessage.objects.filter(build=build_id), 445 'packagecount' : packageCount,
446 'logmessages' : LogMessage.objects.filter( build = build_id ),
428 } 447 }
429 return render(request, template, context) 448 return render( request, template, context )
430 449
431 450
432def task(request, build_id, task_id): 451def task(request, build_id, task_id):