Skip to contentSkip to conversation

Fix bitbake-layerindex to checkout the requested branch

PATCH New [email protected] 1 participant 1 message Feb 14, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix bitbake-layerindex to checkout the requested branch

From: Jan-Simon Moeller <[email protected]>

Bitbake-layerindex would not respect the branch given with -b . This fixes the clone command.

---
 lib/bblayers/layerindex.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
lib/bblayers/layerindex.py +5 -5
index 57cd9027..093434ac 100644
@@ -24,7 +24,7 @@ class LayerIndexPlugin(ActionPlugin):
     This class inherits ActionPlugin to get do_add_layer.
     """
 
-    def get_fetch_layer(self, fetchdir, url, subdir, fetch_layer):
+    def get_fetch_layer(self, fetchdir, url, subdir, fetch_layer, branch):
         layername = self.get_layer_name(url)
         if os.path.splitext(layername)[1] == '.git':
             layername = os.path.splitext(layername)[0]
@@ -32,7 +32,7 @@ class LayerIndexPlugin(ActionPlugin):
         layerdir = os.path.join(repodir, subdir)
         if not os.path.exists(repodir):
             if fetch_layer:
-                result = subprocess.call(['git', 'clone', url, repodir])
+                result = subprocess.call(['git', 'clone', '-b', branch, url, repodir])
                 if result:
                     logger.error("Failed to download %s" % url)
                     return None, None, None
@@ -70,9 +70,9 @@ class LayerIndexPlugin(ActionPlugin):
 
         # Set the default...
         if args.branch:
-            branches = [args.branch]
+            branch = [args.branch]
         else:
-            branches = (self.tinfoil.config_data.getVar('LAYERSERIES_CORENAMES') or 'master').split()
+            branch = (self.tinfoil.config_data.getVar('LAYERSERIES_CORENAMES') or 'master').split()
         logger.debug(1, 'Trying branches: %s' % branches)
 
         ignore_layers = []
@@ -171,7 +171,7 @@ class LayerIndexPlugin(ActionPlugin):
                 subdir, name, layerdir = self.get_fetch_layer(fetchdir,
                                                       layerBranch.layer.vcs_url,
                                                       layerBranch.vcs_subdir,
-                                                      not args.show_only)
+                                                      not args.show_only, branch)
                 if not name:
                     # Error already shown
                     return 1

--
2.11.0