mirror of
https://github.com/YunoHost/package_linter.git
synced 2024-09-03 20:06:12 +02:00
Add consistency check for dependencies
This commit is contained in:
parent
834ac35b96
commit
e3f689441e
1 changed files with 17 additions and 0 deletions
|
@ -257,6 +257,7 @@ def check_script(path, script_name, script_nbr):
|
||||||
check_set_usage(script_name, read_file(script_path))
|
check_set_usage(script_name, read_file(script_path))
|
||||||
check_helper_usage_dependencies(script_path)
|
check_helper_usage_dependencies(script_path)
|
||||||
check_helper_usage_unix(script_path)
|
check_helper_usage_unix(script_path)
|
||||||
|
check_helper_consistency(path, script_name, script_path)
|
||||||
#check_arg_retrieval(script.copy())
|
#check_arg_retrieval(script.copy())
|
||||||
|
|
||||||
|
|
||||||
|
@ -393,6 +394,22 @@ def check_helper_usage_unix(script_name):
|
||||||
if "sudo " in script:
|
if "sudo " in script:
|
||||||
print_warning("You should not have to use `sudo`, the script is run as root")
|
print_warning("You should not have to use `sudo`, the script is run as root")
|
||||||
|
|
||||||
|
def check_helper_consistency(path, script_name, script_path):
|
||||||
|
"""
|
||||||
|
check if ynh_install_app_dependencies is present in install/upgrade/restore
|
||||||
|
so dependencies are up to date after restoration or upgrade
|
||||||
|
"""
|
||||||
|
script = open(script_path).read()
|
||||||
|
|
||||||
|
if script_name == "install" and "ynh_install_app_dependencies" in script:
|
||||||
|
for name in ["upgrade", "restore"]:
|
||||||
|
try:
|
||||||
|
script2 = open(path + "/scripts/" + name).read()
|
||||||
|
if not "ynh_install_app_dependencies" in script2:
|
||||||
|
print_warning("ynh_install_app_dependencies should also be in %s script" % name)
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if len(sys.argv) != 2:
|
if len(sys.argv) != 2:
|
||||||
print("Give one app package path.")
|
print("Give one app package path.")
|
||||||
|
|
Loading…
Reference in a new issue