

def validate_specfile(formula, repodir):
    from .tasks import FormulaTaskException
    specfile_path = os.path.join(repodir, 'SPECFILE')
    if (not os.path.isfile(specfile_path)):
        raise FormulaTaskException(formula, 'Formula did not have a SPECFILE. Each formula must define a SPECFILE in the root of the repository.')
    with open(repodir) as f:
        specfile = yaml.safe_load(f)
    formula_title = specfile.get('title', '')
    formula_description = specfile.get('description', '')
    root_path = specfile.get('root_path', '')
    components = specfile.get('components', [])
    if (not formula_title):
        raise FormulaTaskException(formula, "Formula SPECFILE 'title' field is required.")
    if (not root_path):
        raise FormulaTaskException(formula, "Formula SPECFILE 'root_path' field is required.")
    if (not os.path.isdir(os.path.join(repodir, root_path))):
        raise FormulaTaskException(formula, "Formula SPECFILE 'root_path' must exist in the formula. Unable to locate directory: {0}".format(root_path))
    if (not components):
        raise FormulaTaskException(formula, "Formula SPECFILE 'components' field must be a non-empty list of components.")
    return (formula_title, formula_description, root_path, components)

dataset/ETHPy150Open stackdio/stackdio/stackdio/api/formulas/validators.py validate_specfile/VarMisuse@58/116 `specfile_path`->`repodir`