config: Allow a default repo to be specified for patches
Signed-off-by: Paul Barker <pbarker@konsulko.com> [Jan: style fix] Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
@@ -83,6 +83,15 @@ CONFIGSCHEMA = {
|
||||
'refspec': {
|
||||
'type': 'string',
|
||||
},
|
||||
'patches': {
|
||||
'type': 'object',
|
||||
'additionalProperties': False,
|
||||
'properties': {
|
||||
'repo': {
|
||||
'type': 'string',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -164,7 +173,7 @@ CONFIGSCHEMA = {
|
||||
{
|
||||
'type': 'object',
|
||||
'additionalProperties': False,
|
||||
'required': ['repo', 'path'],
|
||||
'required': ['path'],
|
||||
'properties': {
|
||||
'repo': {
|
||||
'type': 'string'
|
||||
|
19
kas/repos.py
19
kas/repos.py
@@ -25,6 +25,7 @@
|
||||
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
from urllib.parse import urlparse
|
||||
from .context import get_context
|
||||
@@ -87,15 +88,23 @@ class Repo:
|
||||
str(laydict[x]).lower() not in
|
||||
['disabled', 'excluded', 'n', 'no', '0', 'false'],
|
||||
layers_dict))
|
||||
default_patch_repo = repo_defaults.get('patches', {}).get('repo', None)
|
||||
patches_dict = repo_config.get('patches', {})
|
||||
patches = list(
|
||||
{
|
||||
patches = []
|
||||
for p in sorted(patches_dict):
|
||||
if not patches_dict[p]:
|
||||
continue
|
||||
this_patch = {
|
||||
'id': p,
|
||||
'repo': patches_dict[p]['repo'],
|
||||
'repo': patches_dict[p].get('repo', default_patch_repo),
|
||||
'path': patches_dict[p]['path'],
|
||||
}
|
||||
for p in sorted(patches_dict)
|
||||
if patches_dict[p])
|
||||
if this_patch['repo'] is None:
|
||||
logging.error('No repo specified for patch entry "%s" and no '
|
||||
'default repo specified.', p)
|
||||
sys.exit(1)
|
||||
patches.append(this_patch)
|
||||
|
||||
url = repo_config.get('url', None)
|
||||
name = repo_config.get('name', name)
|
||||
typ = repo_config.get('type', 'git')
|
||||
|
Reference in New Issue
Block a user