diff options
-rw-r--r-- | bitbake/lib/bblayers/layerindex.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/bitbake/lib/bblayers/layerindex.py b/bitbake/lib/bblayers/layerindex.py index 57cd9027f6..aa3b682d16 100644 --- a/bitbake/lib/bblayers/layerindex.py +++ b/bitbake/lib/bblayers/layerindex.py | |||
@@ -24,7 +24,7 @@ class LayerIndexPlugin(ActionPlugin): | |||
24 | This class inherits ActionPlugin to get do_add_layer. | 24 | This class inherits ActionPlugin to get do_add_layer. |
25 | """ | 25 | """ |
26 | 26 | ||
27 | def get_fetch_layer(self, fetchdir, url, subdir, fetch_layer): | 27 | def get_fetch_layer(self, fetchdir, url, subdir, fetch_layer, branch): |
28 | layername = self.get_layer_name(url) | 28 | layername = self.get_layer_name(url) |
29 | if os.path.splitext(layername)[1] == '.git': | 29 | if os.path.splitext(layername)[1] == '.git': |
30 | layername = os.path.splitext(layername)[0] | 30 | layername = os.path.splitext(layername)[0] |
@@ -32,9 +32,13 @@ class LayerIndexPlugin(ActionPlugin): | |||
32 | layerdir = os.path.join(repodir, subdir) | 32 | layerdir = os.path.join(repodir, subdir) |
33 | if not os.path.exists(repodir): | 33 | if not os.path.exists(repodir): |
34 | if fetch_layer: | 34 | if fetch_layer: |
35 | result = subprocess.call(['git', 'clone', url, repodir]) | 35 | cmd = ['git', 'clone', '-b' , branch, url, repodir] |
36 | if not branch: | ||
37 | # Branch really shouldn't be empty, but use the repo default if it is | ||
38 | cmd = ['git', 'clone', url, repodir] | ||
39 | result = subprocess.call(cmd) | ||
36 | if result: | 40 | if result: |
37 | logger.error("Failed to download %s" % url) | 41 | logger.error("Failed to download %s (%s)" % (url, branch)) |
38 | return None, None, None | 42 | return None, None, None |
39 | else: | 43 | else: |
40 | return subdir, layername, layerdir | 44 | return subdir, layername, layerdir |
@@ -171,7 +175,8 @@ class LayerIndexPlugin(ActionPlugin): | |||
171 | subdir, name, layerdir = self.get_fetch_layer(fetchdir, | 175 | subdir, name, layerdir = self.get_fetch_layer(fetchdir, |
172 | layerBranch.layer.vcs_url, | 176 | layerBranch.layer.vcs_url, |
173 | layerBranch.vcs_subdir, | 177 | layerBranch.vcs_subdir, |
174 | not args.show_only) | 178 | not args.show_only, |
179 | layerBranch.actual_branch) | ||
175 | if not name: | 180 | if not name: |
176 | # Error already shown | 181 | # Error already shown |
177 | return 1 | 182 | return 1 |