From 15cfe22b3c835e313a44ea44d07105ba9e3a0b2d Mon Sep 17 00:00:00 2001 From: Kayou Date: Wed, 3 Apr 2019 00:25:50 +0200 Subject: [PATCH 1/4] Add size of apps in backup_info result --- src/yunohost/backup.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/yunohost/backup.py b/src/yunohost/backup.py index 6f969327b..f10b112ac 100644 --- a/src/yunohost/backup.py +++ b/src/yunohost/backup.py @@ -2272,6 +2272,14 @@ def backup_info(name, with_details=False, human_readable=False): if "hooks" in info.keys(): system_key = "hooks" + + if "size_details" in info.keys(): + for name, key_info in info["apps"].items(): + if name in info["size_details"]["apps"].keys(): + key_info["size"] = info["size_details"]["apps"][name] + else: + key_info["size"] = 0 + result["apps"] = info["apps"] result["system"] = info[system_key] return result From 7de5251af697a726e8973f30cbd60b64715376c4 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 22 Apr 2019 15:40:47 +0200 Subject: [PATCH 2/4] Handle human size option for apps size as well --- src/yunohost/backup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/yunohost/backup.py b/src/yunohost/backup.py index f10b112ac..8c7d53b1c 100644 --- a/src/yunohost/backup.py +++ b/src/yunohost/backup.py @@ -2272,13 +2272,16 @@ def backup_info(name, with_details=False, human_readable=False): if "hooks" in info.keys(): system_key = "hooks" - if "size_details" in info.keys(): for name, key_info in info["apps"].items(): if name in info["size_details"]["apps"].keys(): key_info["size"] = info["size_details"]["apps"][name] + if human_readable: + key_info["size"] = binary_to_human(key_info["size"]) + 'B' else: key_info["size"] = 0 + if human_readable: + key_info["size"] = "?" result["apps"] = info["apps"] result["system"] = info[system_key] From 0b70ee84dd684f45442eac50bf96c78464043eb9 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 22 Apr 2019 15:41:27 +0200 Subject: [PATCH 3/4] Set size to -1 to me more explicit about the size not being available ? --- src/yunohost/backup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/yunohost/backup.py b/src/yunohost/backup.py index 8c7d53b1c..5db17a047 100644 --- a/src/yunohost/backup.py +++ b/src/yunohost/backup.py @@ -2279,7 +2279,7 @@ def backup_info(name, with_details=False, human_readable=False): if human_readable: key_info["size"] = binary_to_human(key_info["size"]) + 'B' else: - key_info["size"] = 0 + key_info["size"] = -1 if human_readable: key_info["size"] = "?" From 161c18831e8c0d009833dce39229c89abe091490 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 25 Apr 2019 01:04:59 +0200 Subject: [PATCH 4/4] Also get size info about system ? --- src/yunohost/backup.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/yunohost/backup.py b/src/yunohost/backup.py index 5db17a047..e5a21669c 100644 --- a/src/yunohost/backup.py +++ b/src/yunohost/backup.py @@ -2273,15 +2273,16 @@ def backup_info(name, with_details=False, human_readable=False): system_key = "hooks" if "size_details" in info.keys(): - for name, key_info in info["apps"].items(): - if name in info["size_details"]["apps"].keys(): - key_info["size"] = info["size_details"]["apps"][name] - if human_readable: - key_info["size"] = binary_to_human(key_info["size"]) + 'B' - else: - key_info["size"] = -1 - if human_readable: - key_info["size"] = "?" + for category in ["apps", "system"]: + for name, key_info in info[category].items(): + if name in info["size_details"][category].keys(): + key_info["size"] = info["size_details"][category][name] + if human_readable: + key_info["size"] = binary_to_human(key_info["size"]) + 'B' + else: + key_info["size"] = -1 + if human_readable: + key_info["size"] = "?" result["apps"] = info["apps"] result["system"] = info[system_key]