From b250c341fb513630d78baf7ca8cb37b1e000fd52 Mon Sep 17 00:00:00 2001 From: Konrad Weihmann Date: Wed, 5 May 2021 14:26:15 +0200 Subject: [PATCH] repos: strip dot from layer name when importing nested layer in combination with the top level layer like meta-security meta-security/meta-tpm one can use layers: .: meta-tpm: in the spec file to import the parent layer. This leads to the effect that . meta-tpm = "HEAD:" is shown in the build console and in /etc/build when using image-buildinfo.bbclass. To fix that just strip the trailing dot from each layer name. Add test to avoid future regressions Signed-off-by: Konrad Weihmann [Jan: use only a single rstrip call, fix style] Signed-off-by: Jan Kiszka --- kas/repos.py | 2 +- tests/test_layers.py | 7 +++++++ tests/test_layers/test.yml | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/kas/repos.py b/kas/repos.py index 598315a..edd46ee 100644 --- a/kas/repos.py +++ b/kas/repos.py @@ -52,7 +52,7 @@ class Repo: def __getattr__(self, item): if item == 'layers': - return [os.path.join(self.path, layer).rstrip(os.sep) + return [os.path.join(self.path, layer).rstrip(os.sep + '.') for layer in self._layers] elif item == 'qualified_name': url = urlparse(self.url) diff --git a/tests/test_layers.py b/tests/test_layers.py index 098e31c..6981abc 100644 --- a/tests/test_layers.py +++ b/tests/test_layers.py @@ -60,3 +60,10 @@ def test_layers_exclude(dokas): with open('build/conf/bblayers.conf', 'r') as f: for line in f: assert('test_layers/kas2' not in line) + + +def test_layers_strip_dot(dokas): + with open('build/conf/bblayers.conf', 'r') as f: + lines = f.readlines() + assert(any('test_layers/kas3 ' in x for x in lines)) + assert(any('test_layers/kas3/meta-bar' in x for x in lines)) diff --git a/tests/test_layers/test.yml b/tests/test_layers/test.yml index cb1b7eb..c8ea3d6 100644 --- a/tests/test_layers/test.yml +++ b/tests/test_layers/test.yml @@ -20,3 +20,10 @@ repos: refspec: master layers: .: excluded + + kas3: + url: https://github.com/siemens/kas.git + refspec: master + layers: + .: + meta-bar: