From fb03ee7f759d0a1b6b430ae5367d470d6f4506df Mon Sep 17 00:00:00 2001 From: no92 Date: Wed, 9 Aug 2023 14:45:53 +0200 Subject: [PATCH] schema: catch invalid configurations --- xbstrap/schema.yml | 88 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/xbstrap/schema.yml b/xbstrap/schema.yml index 7b02c6c..38599a5 100644 --- a/xbstrap/schema.yml +++ b/xbstrap/schema.yml @@ -101,6 +101,50 @@ definitions: 'sources_required': { $ref: '#/definitions/source_deps' } 'tools_required': { $ref: '#/definitions/tool_deps' } + # keep this in sync with the `sources` definition, as this apparently can't be $ref'ed + dependencies: + # when `git` is used, disallow `svn`, `hg` and `url` + git: + not: + anyOf: + - required: + - hg + - required: + - svn + - required: + - url + + # when `tag` is used, disallow `branch` and `commit` + tag: + not: + anyOf: + - required: + - branch + - required: + - commit + + branch: + # require any of `commit` or `rolling_version` to be present + anyOf: + - required: + - commit + - required: + - rolling_version + # when branch is used, disallow `tag` + not: + required: + - tag + + # when commit is used, branch is required + commit: + required: + - branch + + # when rolling_version is used, branch is required + rolling_version: + required: + - branch + 'nested_task': type: object additionalProperties: false @@ -253,6 +297,50 @@ properties: 'regenerate': { $ref: '#/definitions/build_steps' } 'sources_required': { $ref: '#/definitions/source_deps' } 'tools_required': { $ref: '#/definitions/tool_deps' } + + # keep this in sync with the `nested_sources` definition, as this apparently can't be $ref'ed + dependencies: + # when `git` is used, disallow `svn`, `hg` and `url` + git: + not: + anyOf: + - required: + - hg + - required: + - svn + - required: + - url + + # when `tag` is used, disallow `branch` and `commit` + tag: + not: + anyOf: + - required: + - branch + - required: + - commit + + branch: + # require any of `commit` or `rolling_version` to be present + anyOf: + - required: + - commit + - required: + - rolling_version + # when branch is used, disallow `tag` + not: + required: + - tag + + # when commit is used, branch is required + commit: + required: + - branch + + # when rolling_version is used, branch is required + rolling_version: + required: + - branch 'tools': type: array items: