includehandler: remove possible duplicates from the missing_repos list
I was observed that in some more evolved configurations the build stopped because kas wanted to clone a git repository multiple times concurrently. This failed. This patch should prevent these issues by removing all possible duplicates from the missing_repos list prior to returning it to the configuration. Signed-off-by: Claudius Heine <ch@denx.de>
This commit is contained in:
parent
9753b561d2
commit
4940d4d580
@ -26,7 +26,7 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import collections
|
from collections import OrderedDict, Mapping
|
||||||
import functools
|
import functools
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ class GlobalIncludes(IncludeHandler):
|
|||||||
missing_repos = []
|
missing_repos = []
|
||||||
configs = []
|
configs = []
|
||||||
current_config = load_config(filename)
|
current_config = load_config(filename)
|
||||||
if not isinstance(current_config, collections.Mapping):
|
if not isinstance(current_config, Mapping):
|
||||||
raise IncludeException('Configuration file does not contain a '
|
raise IncludeException('Configuration file does not contain a '
|
||||||
'dictionary as base type')
|
'dictionary as base type')
|
||||||
header = current_config.get('header', {})
|
header = current_config.get('header', {})
|
||||||
@ -195,7 +195,7 @@ class GlobalIncludes(IncludeHandler):
|
|||||||
(cfg, rep) = _internal_include_handler(includefile)
|
(cfg, rep) = _internal_include_handler(includefile)
|
||||||
configs.extend(cfg)
|
configs.extend(cfg)
|
||||||
missing_repos.extend(rep)
|
missing_repos.extend(rep)
|
||||||
elif isinstance(include, collections.Mapping):
|
elif isinstance(include, Mapping):
|
||||||
includerepo = include.get('repo', None)
|
includerepo = include.get('repo', None)
|
||||||
if includerepo is not None:
|
if includerepo is not None:
|
||||||
includedir = repos.get(includerepo, None)
|
includedir = repos.get(includerepo, None)
|
||||||
@ -220,6 +220,8 @@ class GlobalIncludes(IncludeHandler):
|
|||||||
else:
|
else:
|
||||||
missing_repos.append(includerepo)
|
missing_repos.append(includerepo)
|
||||||
configs.append((filename, current_config))
|
configs.append((filename, current_config))
|
||||||
|
# Remove all possible duplicates in missing_repos
|
||||||
|
missing_repos = list(OrderedDict.fromkeys(missing_repos))
|
||||||
return (configs, missing_repos)
|
return (configs, missing_repos)
|
||||||
|
|
||||||
def _internal_dict_merge(dest, upd, recursive_merge=True):
|
def _internal_dict_merge(dest, upd, recursive_merge=True):
|
||||||
@ -230,10 +232,10 @@ class GlobalIncludes(IncludeHandler):
|
|||||||
or fall back on a manual merge (helpful for non-dict types
|
or fall back on a manual merge (helpful for non-dict types
|
||||||
like FunctionWrapper)
|
like FunctionWrapper)
|
||||||
"""
|
"""
|
||||||
if (not isinstance(dest, collections.Mapping)) \
|
if (not isinstance(dest, Mapping)) \
|
||||||
or (not isinstance(upd, collections.Mapping)):
|
or (not isinstance(upd, Mapping)):
|
||||||
raise IncludeException('Cannot merge using non-dict')
|
raise IncludeException('Cannot merge using non-dict')
|
||||||
dest = collections.OrderedDict(dest)
|
dest = OrderedDict(dest)
|
||||||
updkeys = list(upd.keys())
|
updkeys = list(upd.keys())
|
||||||
if not set(list(dest.keys())) & set(updkeys):
|
if not set(list(dest.keys())) & set(updkeys):
|
||||||
recursive_merge = False
|
recursive_merge = False
|
||||||
@ -244,8 +246,8 @@ class GlobalIncludes(IncludeHandler):
|
|||||||
dest_subkey = dest.get(key, None)
|
dest_subkey = dest.get(key, None)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
dest_subkey = None
|
dest_subkey = None
|
||||||
if isinstance(dest_subkey, collections.Mapping) \
|
if isinstance(dest_subkey, Mapping) \
|
||||||
and isinstance(val, collections.Mapping):
|
and isinstance(val, Mapping):
|
||||||
ret = _internal_dict_merge(dest_subkey, val)
|
ret = _internal_dict_merge(dest_subkey, val)
|
||||||
dest[key] = ret
|
dest[key] = ret
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user