From 5634a251ce6b25beb948976433ba0a6443be4e09 Mon Sep 17 00:00:00 2001 From: Michael Wood Date: Fri, 29 Jan 2016 14:43:25 +0000 Subject: [PATCH] bitbake: toaster: views CustomRecipe API add size information to the package lists Add the file size of the packages and the total to the JSON response. (Bitbake rev: bbbd304c49b0940a695d15273934edff95d70836) Signed-off-by: Michael Wood Signed-off-by: brian avery Signed-off-by: Richard Purdie --- bitbake/lib/toaster/toastergui/views.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index da73d43c4f..65b38d0645 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py @@ -2527,14 +2527,24 @@ if True: "not found" % package_id} if request.method == 'GET': + # If no package_id then list the current packages if not package_id: + total_size = 0 packages = recipe.get_all_packages().values("id", "name", - "version") + "version", + "size") + for package in packages: + package['size_formatted'] = \ + filtered_filesizeformat(package['size']) + total_size += package['size'] return {"error": "ok", "packages" : list(packages), - "total" : len(packages) + "total" : len(packages), + "total_size" : total_size, + "total_size_formatted" : + filtered_filesizeformat(total_size) } else: all_current_packages = recipe.get_all_packages()