macros: Use new macro loop for repo setup

Divide the SetupRepos command into three parts: init, step and finish
Build a macro-based loop with the step part of the function.

Rewrite this in build.py and shell.py

Signed-off-by: Andreas Reichel <andreas.reichel.ext@siemens.com>
This commit is contained in:
Andreas Reichel
2018-09-05 11:13:01 +02:00
committed by Daniel Wagner
parent fc9ebf1104
commit 6349f7ab73
3 changed files with 71 additions and 29 deletions

View File

@@ -31,8 +31,10 @@ from .context import create_global_context
from .config import Config
from .libkas import find_program, run_cmd, kasplugin
from .libcmds import (Macro, Command, SetupDir, CleanupSSHAgent,
SetupSSHAgent, SetupEnviron, SetupRepos,
WriteBBConfig, SetupHome, ReposApplyPatches)
SetupSSHAgent, SetupEnviron,
WriteBBConfig, SetupHome, ReposApplyPatches,
Loop, InitSetupRepos, FinishSetupRepos,
SetupReposStep)
__license__ = 'MIT'
__copyright__ = 'Copyright (c) Siemens AG, 2017'
@@ -86,7 +88,14 @@ class Build:
if 'SSH_PRIVATE_KEY' in os.environ:
macro.add(SetupSSHAgent())
macro.add(SetupRepos())
macro.add(InitSetupRepos())
repo_loop = Loop('repo_setup_loop')
repo_loop.add(SetupReposStep())
macro.add(repo_loop)
macro.add(FinishSetupRepos())
macro.add(SetupEnviron())
macro.add(SetupHome())
macro.add(ReposApplyPatches())