X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=scripts%2Fdebian%2Fdep11-basic-validate.py;h=6ee3042b11f096a88b6268e12c50a6ec69decaa1;hb=ccf6713b942fa54eafddcd035fd59c61ac1f3ecf;hp=6f46e14b08c526e4ac97ed42bb4fba9f64aec882;hpb=e2593d978b225881993196434b8a0bbe4802837b;p=dak.git diff --git a/scripts/debian/dep11-basic-validate.py b/scripts/debian/dep11-basic-validate.py index 6f46e14b..6ee3042b 100755 --- a/scripts/debian/dep11-basic-validate.py +++ b/scripts/debian/dep11-basic-validate.py @@ -19,6 +19,7 @@ import os import sys import yaml import gzip +import lzma from voluptuous import Schema, Required, All, Any, Length, Range, Match, Url from optparse import OptionParser @@ -27,8 +28,8 @@ schema_header = Schema({ Required('Origin'): All(str, Length(min=1)), Required('Version'): All(str, Match(r'(\d+\.?)+$'), msg="Must be a valid version number"), Required('MediaBaseUrl'): All(str, Url()), - 'Time': All(str, str), - 'Priority': All(str, int), + 'Time': All(str), + 'Priority': All(int), }) schema_translated = Schema({ @@ -154,6 +155,8 @@ def validate_file(fname): f = None if fname.endswith(".gz"): f = gzip.open(fname, 'r') + elif fname.endswith(".xz"): + f = lzma.open(fname, 'r') else: f = open(fname, 'r') @@ -166,9 +169,13 @@ def validate_dir(dirname): ret = True for root, subfolders, files in os.walk(dirname): for fname in files: - if fname.endswith(".yml.gz"): - if not validate_file(os.path.join(root, fname)): - ret = False + fpath = os.path.join(root, fname) + if os.path.islink(fpath): + add_issue("FATAL: Symlinks are not allowed") + return False + if fname.endswith(".yml.gz") or fname.endswith(".yml.xz"): + if not validate_file(fpath): + ret = False return ret @@ -184,6 +191,9 @@ def main(): if os.path.isdir(fname): ret = validate_dir(fname) + elif os.path.islink(fname): + add_issue("FATAL: Symlinks are not allowed") + ret = False else: ret = validate_file(fname) if ret: