kas/config: Make 'get_repo_dict' private
Since 'get_repo_dict' does much more than just querying available repositories, this patch makes it private. The same data is now available via the 'repo_dict' property. This also means that 'get_repos' is now faster, because it accesses cached data, instead of calling 'get_repo_dict' that generates this data. This patch also allows 'get_repos' and 'repo_dict' to be used even in the 'Repo' class. 'get_repo_dict' creates new 'Repo' instances and thus invalidates the current instance. This patch is in preparation of the 'patch support'-feature, that depends on this patch. Signed-off-by: Claudius Heine <ch@denx.de>
This commit is contained in:
parent
5b85fba0df
commit
6afd92eabc
@ -74,6 +74,7 @@ class Config:
|
||||
self.handler.get_config(repos=repo_paths)
|
||||
|
||||
self.environ.update(self.get_proxy_config())
|
||||
self.repo_dict = self._get_repo_dict()
|
||||
|
||||
while missing_repo_names:
|
||||
if missing_repo_names == missing_repo_names_old:
|
||||
@ -83,22 +84,24 @@ class Config:
|
||||
logging.debug('Missing repos for complete config:\n%s',
|
||||
pprint.pformat(missing_repo_names))
|
||||
|
||||
repo_dict = self.get_repo_dict()
|
||||
missing_repos = [repo_dict[repo_name]
|
||||
self.repo_dict = self._get_repo_dict()
|
||||
missing_repos = [self.repo_dict[repo_name]
|
||||
for repo_name in missing_repo_names
|
||||
if repo_name in repo_dict]
|
||||
if repo_name in self.repo_dict]
|
||||
|
||||
repos_fetch(self, missing_repos)
|
||||
|
||||
for repo in missing_repos:
|
||||
repo.checkout(self)
|
||||
|
||||
repo_paths = {r: repo_dict[r].path for r in repo_dict}
|
||||
repo_paths = {r: self.repo_dict[r].path for r in self.repo_dict}
|
||||
|
||||
missing_repo_names_old = missing_repo_names
|
||||
(self._config, missing_repo_names) = \
|
||||
self.handler.get_config(repos=repo_paths)
|
||||
|
||||
self.repo_dict = self._get_repo_dict()
|
||||
|
||||
logging.debug('Configuration from config file:\n%s',
|
||||
pprint.pformat(self._config))
|
||||
|
||||
@ -166,9 +169,9 @@ class Config:
|
||||
"""
|
||||
# pylint: disable=no-self-use
|
||||
|
||||
return list(self.get_repo_dict().values())
|
||||
return list(self.repo_dict.values())
|
||||
|
||||
def get_repo_dict(self):
|
||||
def _get_repo_dict(self):
|
||||
"""
|
||||
Returns a dictionary containing the repositories with
|
||||
their name (as it is defined in the config file) as key
|
||||
|
Loading…
Reference in New Issue
Block a user