diff options
author | Michael Wood <michael.g.wood@intel.com> | 2016-01-29 14:43:25 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-10 13:29:21 +0000 |
commit | 5634a251ce6b25beb948976433ba0a6443be4e09 (patch) | |
tree | 1c67af185bfac080582d5047c96f2187238e85c5 /bitbake/lib/toaster | |
parent | 6fbceb0f121d760f84cabeb9e610b3480acd75d2 (diff) | |
download | poky-5634a251ce6b25beb948976433ba0a6443be4e09.tar.gz |
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 <michael.g.wood@intel.com>
Signed-off-by: brian avery <avery.brian@gmail.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 | 14 |
1 files 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: | |||
2527 | "not found" % package_id} | 2527 | "not found" % package_id} |
2528 | 2528 | ||
2529 | if request.method == 'GET': | 2529 | if request.method == 'GET': |
2530 | # If no package_id then list the current packages | ||
2530 | if not package_id: | 2531 | if not package_id: |
2532 | total_size = 0 | ||
2531 | packages = recipe.get_all_packages().values("id", | 2533 | packages = recipe.get_all_packages().values("id", |
2532 | "name", | 2534 | "name", |
2533 | "version") | 2535 | "version", |
2536 | "size") | ||
2537 | for package in packages: | ||
2538 | package['size_formatted'] = \ | ||
2539 | filtered_filesizeformat(package['size']) | ||
2540 | total_size += package['size'] | ||
2534 | 2541 | ||
2535 | return {"error": "ok", | 2542 | return {"error": "ok", |
2536 | "packages" : list(packages), | 2543 | "packages" : list(packages), |
2537 | "total" : len(packages) | 2544 | "total" : len(packages), |
2545 | "total_size" : total_size, | ||
2546 | "total_size_formatted" : | ||
2547 | filtered_filesizeformat(total_size) | ||
2538 | } | 2548 | } |
2539 | else: | 2549 | else: |
2540 | all_current_packages = recipe.get_all_packages() | 2550 | all_current_packages = recipe.get_all_packages() |