apps: fix a bug where YunoHost would complain that 'it needs X RAM but only Y left' with Y > X because some apps have a higher runtime RAM requirement than build time ...

This commit is contained in:
Alexandre Aubin 2023-07-10 17:34:21 +02:00
parent 7924bb2b28
commit 4152cb0dd1

View file

@ -2782,10 +2782,18 @@ def _check_manifest_requirements(
ram_requirement["runtime"]
)
# Some apps have a higher runtime value than build ...
if ram_requirement["build"] != "?" and ram_requirement["runtime"] != "?":
max_build_runtime = (ram_requirement["build"]
if human_to_binary(ram_requirement["build"]) > human_to_binary(ram_requirement["runtime"])
else ram_requirement["runtime"])
else:
max_build_runtime = ram_requirement["build"]
yield (
"ram",
can_build and can_run,
{"current": binary_to_human(ram), "required": ram_requirement["build"]},
{"current": binary_to_human(ram), "required": max_build_runtime},
"app_not_enough_ram", # i18n: app_not_enough_ram
)