libcmds: Only checkout "missing" repositories in SetupReposStep
There is a subtle bug in SetupReposStep that occurs when: * One or more repositories are reported as "missing" in InitSetupRepos. * SetupReposStep checks out the missing repositories. * SetupReposStep updates the repo_dict with all repositories in the configuration, some of which may only be partially defined and/or not checked out. * SetupReposStep passes this new, incorrect list of checked out repositories to the include handler in the next pass. * The include handler attempts to include a file from a partially defined repository, likely resulting in a "File not found" error because it is assumed to be a local repository. To fix this, keep track of the repositories that have been checked out by only adding repositories that have been reported as "missing" to ctx.config.repo_dict Now that ctx.config.repo_dict only contains checked out repositories, it is necessary to check missing repo names against the config dict instead. Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
parent
958b0ab2f8
commit
34983c13ee
@ -370,21 +370,20 @@ class SetupReposStep(Command):
|
||||
logging.debug('Missing repos for complete config:\n%s',
|
||||
pprint.pformat(ctx.missing_repo_names))
|
||||
|
||||
ctx.config.repo_dict = ctx.config._get_repo_dict()
|
||||
|
||||
ctx.missing_repos = []
|
||||
for repo_name in ctx.missing_repo_names:
|
||||
if repo_name not in ctx.config.repo_dict:
|
||||
if repo_name not in ctx.config.get_repos_config():
|
||||
logging.error('Include references unknown repo: %s', repo_name)
|
||||
sys.exit(1)
|
||||
ctx.missing_repos.append(ctx.config.repo_dict[repo_name])
|
||||
ctx.missing_repos.append(ctx.config.get_repo(repo_name))
|
||||
|
||||
repos_fetch(ctx.missing_repos)
|
||||
|
||||
for repo in ctx.missing_repos:
|
||||
repo.checkout()
|
||||
|
||||
ctx.config.repo_dict = ctx.config._get_repo_dict()
|
||||
ctx.config.repo_dict.update(
|
||||
{repo.name: repo for repo in ctx.missing_repos})
|
||||
|
||||
repo_paths = {r: ctx.config.repo_dict[r].path for r
|
||||
in ctx.config.repo_dict}
|
||||
|
Loading…
Reference in New Issue
Block a user