2016-01-25 12:52:18 +01:00
|
|
|
|
#!/usr/bin/env python3
|
2017-01-31 09:15:18 +01:00
|
|
|
|
# -*- coding: utf8 -*-
|
2016-01-25 12:52:18 +01:00
|
|
|
|
|
|
|
|
|
import sys
|
|
|
|
|
import os
|
2016-12-23 18:06:44 +01:00
|
|
|
|
import re
|
2016-01-25 12:52:18 +01:00
|
|
|
|
import json
|
|
|
|
|
|
2016-11-03 19:09:07 +01:00
|
|
|
|
|
2016-01-25 12:52:18 +01:00
|
|
|
|
class c:
|
2016-11-03 19:09:07 +01:00
|
|
|
|
HEADER = '\033[95m'
|
|
|
|
|
OKBLUE = '\033[94m'
|
|
|
|
|
OKGREEN = '\033[92m'
|
|
|
|
|
WARNING = '\033[93m'
|
|
|
|
|
FAIL = '\033[91m'
|
|
|
|
|
END = '\033[0m'
|
|
|
|
|
BOLD = '\033[1m'
|
|
|
|
|
UNDERLINE = '\033[4m'
|
|
|
|
|
|
2016-01-25 12:52:18 +01:00
|
|
|
|
|
|
|
|
|
def header(app_path):
|
2016-11-03 19:09:07 +01:00
|
|
|
|
print(c.UNDERLINE + c.HEADER + c.BOLD +
|
2016-12-19 07:09:32 +01:00
|
|
|
|
"YUNOHOST APP PACKAGE LINTER\n", c.END,
|
|
|
|
|
"App packaging documentation: https://yunohost.org/#/packaging_apps\n",
|
|
|
|
|
"App package example: https://github.com/YunoHost/example_ynh\n",
|
|
|
|
|
"Checking " + c.BOLD + app_path + c.END + " package\n")
|
2016-11-03 19:09:07 +01:00
|
|
|
|
|
2016-01-25 12:52:18 +01:00
|
|
|
|
|
|
|
|
|
def print_right(str):
|
2016-11-03 19:09:07 +01:00
|
|
|
|
print(c.OKGREEN + "✔", str, c.END)
|
|
|
|
|
|
2016-01-25 12:52:18 +01:00
|
|
|
|
|
|
|
|
|
def print_wrong(str):
|
2016-11-03 19:09:07 +01:00
|
|
|
|
print(c.FAIL + "✘", str, c.END)
|
|
|
|
|
|
2016-01-25 12:52:18 +01:00
|
|
|
|
|
|
|
|
|
def check_files_exist(app_path):
|
2016-11-03 19:09:07 +01:00
|
|
|
|
"""
|
|
|
|
|
Check files exist
|
2017-04-11 09:44:13 +02:00
|
|
|
|
'backup' and 'restore' scripts are mandatory
|
2016-11-03 19:09:07 +01:00
|
|
|
|
"""
|
2016-12-23 18:21:38 +01:00
|
|
|
|
return_code = 0
|
|
|
|
|
|
2017-04-11 10:10:29 +02:00
|
|
|
|
print(c.BOLD + c.HEADER + ">>>> MISSING FILES <<<<" + c.END)
|
2016-12-19 06:53:22 +01:00
|
|
|
|
fnames = ("manifest.json", "scripts/install", "scripts/remove",
|
2016-11-03 19:09:07 +01:00
|
|
|
|
"scripts/upgrade", "scripts/backup", "scripts/restore", "LICENSE", "README.md")
|
2016-12-18 02:37:07 +01:00
|
|
|
|
|
2017-04-11 09:44:13 +02:00
|
|
|
|
for nbr, fname in enumerate(fnames):
|
2016-12-19 06:53:22 +01:00
|
|
|
|
if check_file_exist(app_path + "/" + fname):
|
|
|
|
|
print_right(fname)
|
2016-11-03 19:09:07 +01:00
|
|
|
|
else:
|
2016-12-19 06:53:22 +01:00
|
|
|
|
print_wrong(fname)
|
2017-04-11 09:44:13 +02:00
|
|
|
|
if nbr != 4 and nbr != 5:
|
|
|
|
|
return_code = 1
|
2016-12-23 18:21:38 +01:00
|
|
|
|
|
|
|
|
|
return return_code
|
2016-11-03 19:09:07 +01:00
|
|
|
|
|
2016-01-25 12:52:18 +01:00
|
|
|
|
|
|
|
|
|
def check_file_exist(file_path):
|
2016-11-03 19:09:07 +01:00
|
|
|
|
return 1 if os.path.isfile(file_path) and os.stat(file_path).st_size > 0 else 0
|
|
|
|
|
|
2016-01-25 12:52:18 +01:00
|
|
|
|
|
|
|
|
|
def read_file(file_path):
|
2016-11-03 19:09:07 +01:00
|
|
|
|
with open(file_path) as f:
|
2016-12-23 18:06:44 +01:00
|
|
|
|
# remove every comments from the file content to avoid false positives
|
|
|
|
|
file = re.sub("#.*[^\n]", "", f.read()).splitlines()
|
2016-11-03 19:09:07 +01:00
|
|
|
|
return file
|
|
|
|
|
|
2016-01-25 12:52:18 +01:00
|
|
|
|
|
2017-02-04 08:48:57 +01:00
|
|
|
|
def check_source_management(app_path):
|
2017-04-11 10:10:29 +02:00
|
|
|
|
print(c.BOLD + c.HEADER + "\n>>>> SOURCES MANAGEMENT <<<<" + c.END)
|
2017-02-07 19:33:21 +01:00
|
|
|
|
DIR = os.path.join(app_path, "sources")
|
|
|
|
|
# Check if there is more than six files on 'sources' folder
|
2017-02-09 17:59:47 +01:00
|
|
|
|
if os.path.exists(os.path.join(app_path, "sources")) and \
|
|
|
|
|
len([name for name in os.listdir(DIR) if os.path.isfile(os.path.join(DIR, name))]) > 5:
|
2017-02-04 08:48:57 +01:00
|
|
|
|
print_wrong("Upstream app sources shouldn't be stored on this 'sources' folder of this git repository as a copy/paste.\n" +
|
|
|
|
|
"At installation, the package should download sources from upstream via 'wget', git submodule or git subtree.\n" +
|
|
|
|
|
"See https://dev.yunohost.org/issues/201#Conclusion-chart")
|
|
|
|
|
else:
|
|
|
|
|
print_right("Upstream app sources do not seems to be stored on the git repository as a copy/paste")
|
|
|
|
|
|
|
|
|
|
|
2016-01-25 12:52:18 +01:00
|
|
|
|
def check_manifest(manifest):
|
2017-04-11 10:10:29 +02:00
|
|
|
|
print(c.BOLD + c.HEADER + "\n>>>> MANIFEST <<<<" + c.END)
|
2016-11-03 19:09:07 +01:00
|
|
|
|
"""
|
2016-12-18 02:37:07 +01:00
|
|
|
|
Check if there is no comma syntax issue
|
|
|
|
|
"""
|
|
|
|
|
|
2016-12-23 18:21:38 +01:00
|
|
|
|
return_code = 0
|
|
|
|
|
|
2016-11-03 19:09:07 +01:00
|
|
|
|
try:
|
|
|
|
|
with open(manifest, encoding='utf-8') as data_file:
|
|
|
|
|
manifest = json.loads(data_file.read())
|
|
|
|
|
print_right("Manifest syntax is good.")
|
|
|
|
|
except:
|
|
|
|
|
print_wrong(
|
|
|
|
|
"Syntax (comma) or encoding issue with manifest.json. Can't check file.")
|
2016-12-23 18:21:38 +01:00
|
|
|
|
return 1
|
2016-12-18 02:37:07 +01:00
|
|
|
|
|
|
|
|
|
fields = ("name", "id", "packaging_format", "description", "url",
|
|
|
|
|
"license", "maintainer", "requirements", "multi_instance", "services", "arguments")
|
|
|
|
|
|
2016-12-19 06:53:22 +01:00
|
|
|
|
for field in fields:
|
|
|
|
|
if field in manifest:
|
|
|
|
|
print_right("\"" + field + "\" field is present")
|
2016-11-03 19:09:07 +01:00
|
|
|
|
else:
|
2016-12-19 06:53:22 +01:00
|
|
|
|
print_wrong("\"" + field + "\" field is missing")
|
2016-12-23 18:21:38 +01:00
|
|
|
|
return_code = 1
|
2016-12-18 02:37:07 +01:00
|
|
|
|
|
2016-11-03 19:09:07 +01:00
|
|
|
|
"""
|
2016-11-25 18:05:13 +01:00
|
|
|
|
Check values in keys
|
|
|
|
|
"""
|
2016-12-18 02:37:07 +01:00
|
|
|
|
|
2016-11-03 19:09:07 +01:00
|
|
|
|
pf = 1
|
2016-12-18 02:37:07 +01:00
|
|
|
|
|
2016-11-03 19:09:07 +01:00
|
|
|
|
if "packaging_format" not in manifest:
|
|
|
|
|
print_wrong("\"packaging_format\" key is missing")
|
2016-12-23 18:21:38 +01:00
|
|
|
|
return_code = 1
|
2016-11-03 19:09:07 +01:00
|
|
|
|
pf = 0
|
2016-12-18 02:37:07 +01:00
|
|
|
|
|
2016-11-03 19:09:07 +01:00
|
|
|
|
if pf == 1 and isinstance(manifest["packaging_format"], int) != 1:
|
|
|
|
|
print_wrong("\"packaging_format\": value isn't an integer type")
|
2016-12-23 18:21:38 +01:00
|
|
|
|
return_code = 1
|
2016-11-03 19:09:07 +01:00
|
|
|
|
pf = 0
|
2016-12-18 02:37:07 +01:00
|
|
|
|
|
2016-11-03 19:09:07 +01:00
|
|
|
|
if pf == 1 and manifest["packaging_format"] != 1:
|
|
|
|
|
print_wrong("\"packaging_format\" field: current format value is '1'")
|
2016-12-23 18:21:38 +01:00
|
|
|
|
return_code = 1
|
2016-11-03 19:09:07 +01:00
|
|
|
|
pf = 0
|
2016-12-18 02:37:07 +01:00
|
|
|
|
|
2016-11-03 19:09:07 +01:00
|
|
|
|
if pf == 1:
|
|
|
|
|
print_right("\"packaging_format\" field is good")
|
|
|
|
|
|
2017-01-27 22:11:54 +01:00
|
|
|
|
"""
|
2016-11-03 19:09:07 +01:00
|
|
|
|
if "license" in manifest and manifest["license"] != "free" and manifest["license"] != "non-free":
|
|
|
|
|
print_wrong(
|
|
|
|
|
"You should specify 'free' or 'non-free' software package in the license field.")
|
2016-12-23 18:21:38 +01:00
|
|
|
|
return_code = 1
|
2016-11-03 19:09:07 +01:00
|
|
|
|
elif "license" in manifest:
|
|
|
|
|
print_right("\"licence\" key value is good")
|
2017-01-27 22:11:54 +01:00
|
|
|
|
"""
|
2016-12-18 02:37:07 +01:00
|
|
|
|
|
2016-11-03 19:09:07 +01:00
|
|
|
|
if "multi_instance" in manifest and manifest["multi_instance"] != 1 and manifest["multi_instance"] != 0:
|
|
|
|
|
print_wrong(
|
|
|
|
|
"\"multi_instance\" field must be boolean type values 'true' or 'false' and not string type")
|
2016-12-23 18:21:38 +01:00
|
|
|
|
return_code = 1
|
2016-11-03 19:09:07 +01:00
|
|
|
|
elif "multi_instance" in manifest:
|
|
|
|
|
print_right("\"multi_instance\" field is good")
|
2016-12-18 02:37:07 +01:00
|
|
|
|
|
2016-11-03 19:09:07 +01:00
|
|
|
|
if "services" in manifest:
|
|
|
|
|
services = ("nginx", "php5-fpm", "mysql", "uwsgi", "metronome",
|
|
|
|
|
"postfix", "dovecot") # , "rspamd", "rmilter")
|
2016-12-18 02:37:07 +01:00
|
|
|
|
|
2016-12-19 06:53:22 +01:00
|
|
|
|
for service in manifest["services"]:
|
|
|
|
|
if service not in services:
|
|
|
|
|
print_wrong(service + " service doesn't exist")
|
2016-12-23 18:21:38 +01:00
|
|
|
|
return_code = 1
|
2016-12-18 02:37:07 +01:00
|
|
|
|
|
2016-11-03 19:09:07 +01:00
|
|
|
|
if "install" in manifest["arguments"]:
|
|
|
|
|
types = ("domain", "path", "password", "user", "admin")
|
2016-12-18 02:37:07 +01:00
|
|
|
|
|
2016-12-19 06:53:22 +01:00
|
|
|
|
for nbr, typ in enumerate(types):
|
|
|
|
|
for install_arg in manifest["arguments"]["install"]:
|
|
|
|
|
if typ == install_arg["name"]:
|
|
|
|
|
if "type" not in install_arg:
|
2016-11-03 19:09:07 +01:00
|
|
|
|
print("You should specify the type of the key with", end=" ")
|
2016-12-19 06:53:22 +01:00
|
|
|
|
print(types[nbr - 1]) if nbr == 4 else print(typ)
|
2016-12-23 18:21:38 +01:00
|
|
|
|
return_code = 1
|
|
|
|
|
|
|
|
|
|
return return_code
|
2016-11-03 19:09:07 +01:00
|
|
|
|
|
2016-01-25 12:52:18 +01:00
|
|
|
|
|
2017-01-28 10:47:09 +01:00
|
|
|
|
def check_script(path, script_name, script_nbr):
|
2016-12-23 18:21:38 +01:00
|
|
|
|
return_code = 0
|
|
|
|
|
|
2016-11-03 19:09:07 +01:00
|
|
|
|
script_path = path + "/scripts/" + script_name
|
2016-12-18 02:37:07 +01:00
|
|
|
|
|
2016-11-03 19:09:07 +01:00
|
|
|
|
if check_file_exist(script_path) == 0:
|
|
|
|
|
return
|
2016-12-18 02:37:07 +01:00
|
|
|
|
|
2017-04-11 10:10:29 +02:00
|
|
|
|
print(c.BOLD + c.HEADER + "\n>>>>",
|
2016-12-18 02:36:58 +01:00
|
|
|
|
script_name.upper(), "SCRIPT <<<<" + c.END)
|
|
|
|
|
|
2016-11-03 19:09:07 +01:00
|
|
|
|
script = read_file(script_path)
|
2016-12-18 02:37:07 +01:00
|
|
|
|
|
2016-12-23 18:21:38 +01:00
|
|
|
|
return_code = check_non_helpers_usage(script) or return_code
|
2017-01-28 10:47:09 +01:00
|
|
|
|
if script_nbr < 5:
|
2017-04-11 09:48:42 +02:00
|
|
|
|
check_verifications_done_before_modifying_system(script)
|
2017-01-28 11:52:22 +01:00
|
|
|
|
return_code = check_set_usage(script_name, script) or return_code
|
2017-04-06 17:19:26 +02:00
|
|
|
|
check_arg_retrieval(script)
|
2016-12-23 18:21:38 +01:00
|
|
|
|
|
|
|
|
|
return return_code
|
2016-11-03 19:09:07 +01:00
|
|
|
|
|
2016-01-25 12:52:18 +01:00
|
|
|
|
|
|
|
|
|
def check_verifications_done_before_modifying_system(script):
|
2016-11-03 19:09:07 +01:00
|
|
|
|
"""
|
|
|
|
|
Check if verifications are done before modifying the system
|
|
|
|
|
"""
|
2016-12-18 02:37:07 +01:00
|
|
|
|
ex = 0
|
2016-12-19 06:53:22 +01:00
|
|
|
|
for line_number, line in enumerate(script):
|
2017-03-31 17:43:29 +02:00
|
|
|
|
if "ynh_die" in line or "exit " in line:
|
2016-12-18 02:37:07 +01:00
|
|
|
|
ex = line_number
|
|
|
|
|
|
2016-12-19 06:53:22 +01:00
|
|
|
|
cmds = ("cp", "mkdir", "rm", "chown", "chmod", "apt-get", "apt", "service",
|
2016-11-03 19:09:07 +01:00
|
|
|
|
"find", "sed", "mysql", "swapon", "mount", "dd", "mkswap", "useradd") # "yunohost"
|
2016-12-18 02:37:07 +01:00
|
|
|
|
|
|
|
|
|
ok = True
|
|
|
|
|
|
2016-12-19 06:53:22 +01:00
|
|
|
|
for line_nbr, line in enumerate(script):
|
|
|
|
|
if line_nbr >= ex:
|
2016-11-03 19:09:07 +01:00
|
|
|
|
break
|
2016-12-18 02:37:07 +01:00
|
|
|
|
|
2016-12-19 06:53:22 +01:00
|
|
|
|
for cmd in cmds:
|
|
|
|
|
if cmd in line and line[0] != '#':
|
2016-12-18 02:37:07 +01:00
|
|
|
|
ok = False
|
|
|
|
|
|
|
|
|
|
if not ok:
|
2016-11-03 19:09:07 +01:00
|
|
|
|
print(c.FAIL + "✘ At line", ex + 1,
|
2016-12-19 07:09:32 +01:00
|
|
|
|
"'ynh_die' or 'exit' command is executed with system modification before.\n",
|
|
|
|
|
"This system modification is an issue if a verification exit the script.\n",
|
|
|
|
|
"You should move this verification before any system modification." + c.END)
|
2016-12-23 18:21:38 +01:00
|
|
|
|
return 1
|
2016-11-03 19:09:07 +01:00
|
|
|
|
else:
|
|
|
|
|
print_right(
|
2016-11-15 13:46:07 +01:00
|
|
|
|
"Verifications (with 'ynh_die' or 'exit' commands) are done before any system modification.")
|
2016-12-23 18:21:38 +01:00
|
|
|
|
return 0
|
2016-01-25 12:52:18 +01:00
|
|
|
|
|
2017-04-11 10:10:29 +02:00
|
|
|
|
|
2016-11-25 16:14:49 +01:00
|
|
|
|
def check_non_helpers_usage(script):
|
|
|
|
|
"""
|
|
|
|
|
check if deprecated commands are used and propose helpers:
|
|
|
|
|
- 'yunohost app setting' –> ynh_app_setting_(set,get,delete)
|
|
|
|
|
- 'exit' –> 'ynh_die'
|
|
|
|
|
"""
|
2016-12-23 18:21:38 +01:00
|
|
|
|
return_code = 0
|
|
|
|
|
|
2016-12-18 02:37:07 +01:00
|
|
|
|
ok = True
|
|
|
|
|
|
2016-12-19 06:53:22 +01:00
|
|
|
|
for line_nbr, line in enumerate(script):
|
|
|
|
|
if "yunohost app setting" in line:
|
|
|
|
|
print_wrong("Line {}: 'yunohost app setting' command is deprecated, please use helpers ynh_app_setting_(set,get,delete).".format(line_nbr + 1))
|
2016-12-18 02:37:07 +01:00
|
|
|
|
ok = False
|
|
|
|
|
|
|
|
|
|
if ok:
|
2016-11-25 16:14:49 +01:00
|
|
|
|
print_right("Only helpers are used")
|
|
|
|
|
else:
|
|
|
|
|
print_wrong("Helpers documentation: https://yunohost.org/#/packaging_apps_helpers\ncode: https://github.com/YunoHost/yunohost/…helpers")
|
2016-12-23 18:21:38 +01:00
|
|
|
|
return_code = 1
|
2016-11-25 16:14:49 +01:00
|
|
|
|
|
2016-12-18 02:37:07 +01:00
|
|
|
|
ok = True
|
|
|
|
|
|
2016-12-19 06:53:22 +01:00
|
|
|
|
for line_nbr, line in enumerate(script):
|
2017-03-31 17:43:29 +02:00
|
|
|
|
if "exit " in line:
|
2016-12-19 06:53:22 +01:00
|
|
|
|
print_wrong("Line {}: 'exit' command shouldn't be used. Use 'ynh_die' helper instead.".format(line_nbr + 1))
|
2016-12-18 02:37:07 +01:00
|
|
|
|
ok = False
|
|
|
|
|
|
|
|
|
|
if ok:
|
2016-11-25 16:14:49 +01:00
|
|
|
|
print_right("no 'exit' command found: 'ynh_die' helper is possibly used")
|
2016-12-23 18:21:38 +01:00
|
|
|
|
else:
|
|
|
|
|
return_code = 1
|
|
|
|
|
|
|
|
|
|
return return_code
|
2016-11-25 16:14:49 +01:00
|
|
|
|
|
2017-01-28 11:52:22 +01:00
|
|
|
|
|
|
|
|
|
def check_set_usage(script_name, script):
|
|
|
|
|
return_code = 0
|
|
|
|
|
present = False
|
|
|
|
|
set_val = "set -u" if script_name == "remove" else "set -eu"
|
|
|
|
|
|
2017-01-28 12:01:49 +01:00
|
|
|
|
for line_nbr, line in enumerate(script):
|
2017-01-28 11:52:22 +01:00
|
|
|
|
if set_val in line:
|
|
|
|
|
present = True
|
|
|
|
|
break
|
2017-01-28 12:01:49 +01:00
|
|
|
|
if line_nbr > 5:
|
|
|
|
|
break
|
2017-01-28 11:52:22 +01:00
|
|
|
|
if present:
|
2017-01-28 12:01:49 +01:00
|
|
|
|
print_right(set_val + " is present at beginning of file")
|
2017-01-28 11:52:22 +01:00
|
|
|
|
else:
|
2017-01-28 12:01:49 +01:00
|
|
|
|
print_wrong(set_val + " is missing at beginning of file. For details, look at https://dev.yunohost.org/issues/419")
|
2017-01-28 11:52:22 +01:00
|
|
|
|
return_code = 1
|
|
|
|
|
|
|
|
|
|
return return_code
|
|
|
|
|
|
2017-03-07 13:59:37 +01:00
|
|
|
|
|
|
|
|
|
def check_arg_retrieval(script):
|
|
|
|
|
"""
|
|
|
|
|
Check arguments retrival from manifest is done with env var $YNH_APP_ARG_* and not with arg $1
|
|
|
|
|
env var was found till line ~30 on scripts. Stop file checking at L30: This could avoid wrong positives
|
|
|
|
|
Check only from '$1' to '$10' as 10 arg retrieval is already a lot.
|
|
|
|
|
"""
|
|
|
|
|
return_code = 0
|
|
|
|
|
present = False
|
|
|
|
|
exitFlag = False
|
|
|
|
|
|
|
|
|
|
for line_nbr, line in enumerate(script):
|
|
|
|
|
for i in range(1, 10):
|
|
|
|
|
if "$" + str(i) in line:
|
|
|
|
|
print_wrong("At line {}: \"{}\"".format(line_nbr, line))
|
|
|
|
|
present = True
|
|
|
|
|
if line_nbr > 30:
|
|
|
|
|
exitFlag = True
|
|
|
|
|
break
|
2017-04-11 10:10:29 +02:00
|
|
|
|
if exitFlag is True:
|
2017-03-07 13:59:37 +01:00
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
if present:
|
|
|
|
|
print_wrong("Argument retrieval from manifest with $1 is deprecated. You may use $YNH_APP_ARG_*")
|
|
|
|
|
print_wrong("For more details see: https://yunohost.org/#/packaging_apps_arguments_management_en")
|
|
|
|
|
return_code = 1
|
|
|
|
|
else:
|
|
|
|
|
print_right("Argument retrieval from manifest seems to be done with environement variables")
|
|
|
|
|
|
|
|
|
|
return return_code
|
|
|
|
|
|
2016-01-25 12:52:18 +01:00
|
|
|
|
if __name__ == '__main__':
|
2016-11-03 19:09:07 +01:00
|
|
|
|
os.system("clear")
|
2016-12-18 02:37:07 +01:00
|
|
|
|
|
2016-12-23 18:21:38 +01:00
|
|
|
|
return_code = 0
|
|
|
|
|
|
2016-11-03 19:09:07 +01:00
|
|
|
|
if len(sys.argv) != 2:
|
|
|
|
|
print("Give one app package path.")
|
|
|
|
|
exit()
|
2016-12-18 02:37:07 +01:00
|
|
|
|
|
2016-12-23 18:21:38 +01:00
|
|
|
|
# "or" trick to always be 1 if 1 is present:
|
|
|
|
|
# 1 or 0 = 1
|
|
|
|
|
# 1 or 1 = 1
|
|
|
|
|
# 0 or 1 = 1
|
|
|
|
|
# 0 or 0 = 0
|
|
|
|
|
|
2016-11-03 19:09:07 +01:00
|
|
|
|
app_path = sys.argv[1]
|
|
|
|
|
header(app_path)
|
2016-12-23 18:21:38 +01:00
|
|
|
|
return_code = check_files_exist(app_path) or return_code
|
2017-02-04 08:48:57 +01:00
|
|
|
|
return_code = check_source_management(app_path) or return_code
|
2016-12-23 18:21:38 +01:00
|
|
|
|
return_code = check_manifest(app_path + "/manifest.json") or return_code
|
2016-12-18 02:37:07 +01:00
|
|
|
|
|
|
|
|
|
scripts = ["install", "remove", "upgrade", "backup", "restore"]
|
2016-11-03 19:42:00 +01:00
|
|
|
|
for (dirpath, dirnames, filenames) in os.walk(os.path.join(app_path, "scripts")):
|
|
|
|
|
for filename in filenames:
|
2016-11-05 20:09:10 +01:00
|
|
|
|
if filename not in scripts and filename[-4:] != ".swp":
|
2016-11-03 19:42:00 +01:00
|
|
|
|
scripts.append(filename)
|
2016-12-18 02:37:07 +01:00
|
|
|
|
|
2017-01-28 10:47:09 +01:00
|
|
|
|
for script_nbr, script in enumerate(scripts):
|
|
|
|
|
return_code = check_script(app_path, script, script_nbr) or return_code
|
2016-12-23 18:21:38 +01:00
|
|
|
|
|
|
|
|
|
sys.exit(return_code)
|