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>
This commit is contained in:
parent
6fbceb0f12
commit
5634a251ce
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue