repos: Allow for layer-free repositories

While we support

  layers:
    .: excluded

this is effectively the same as leaving out the layers property: The
repository itself will always be added as layer to bblayers.conf. This
prevents using kas to checkout layer-free repositories as well, e.g.
bitbake in case oe-core is used.

Add support for that be converting a non-existing layers property into

  layers:
    .:

internally and removing the special case from Repo.layers which assumed
that layers=None meant the above.

Closes: #16
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Jan Kiszka 2020-07-02 07:42:23 +02:00
parent acdb774d67
commit f678b24611

View File

@ -51,9 +51,7 @@ class Repo:
def __getattr__(self, item):
if item == 'layers':
if not self._layers:
return [self.path]
return [self.path + '/' + layer for layer in self._layers]
return [os.path.join(self.path, layer) for layer in self._layers]
elif item == 'qualified_name':
url = urlparse(self.url)
return ('{url.netloc}{url.path}'
@ -84,7 +82,7 @@ class Repo:
"""
Returns a Repo instance depending on params.
"""
layers_dict = repo_config.get('layers', {})
layers_dict = repo_config.get('layers', {'': None})
layers = list(filter(lambda x, laydict=layers_dict:
str(laydict[x]).lower() not in
['disabled', 'excluded', 'n', 'no', '0', 'false'],