summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bblayers/layerindex.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bblayers/layerindex.py')
-rw-r--r--bitbake/lib/bblayers/layerindex.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/bitbake/lib/bblayers/layerindex.py b/bitbake/lib/bblayers/layerindex.py
index aa3b682d16..95b67a6621 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, branch): 27 def get_fetch_layer(self, fetchdir, url, subdir, fetch_layer, branch, shallow=False):
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,10 +32,12 @@ 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 cmd = ['git', 'clone', '-b' , branch, url, repodir] 35 cmd = ['git', 'clone']
36 if not branch: 36 if shallow:
37 # Branch really shouldn't be empty, but use the repo default if it is 37 cmd.extend(['--depth', '1'])
38 cmd = ['git', 'clone', url, repodir] 38 if branch:
39 cmd.extend(['-b' , branch])
40 cmd.extend([url, repodir])
39 result = subprocess.call(cmd) 41 result = subprocess.call(cmd)
40 if result: 42 if result:
41 logger.error("Failed to download %s (%s)" % (url, branch)) 43 logger.error("Failed to download %s (%s)" % (url, branch))
@@ -176,7 +178,8 @@ class LayerIndexPlugin(ActionPlugin):
176 layerBranch.layer.vcs_url, 178 layerBranch.layer.vcs_url,
177 layerBranch.vcs_subdir, 179 layerBranch.vcs_subdir,
178 not args.show_only, 180 not args.show_only,
179 layerBranch.actual_branch) 181 layerBranch.actual_branch,
182 args.shallow)
180 if not name: 183 if not name:
181 # Error already shown 184 # Error already shown
182 return 1 185 return 1
@@ -209,6 +212,7 @@ class LayerIndexPlugin(ActionPlugin):
209 parser_layerindex_fetch = self.add_command(sp, 'layerindex-fetch', self.do_layerindex_fetch, parserecipes=False) 212 parser_layerindex_fetch = self.add_command(sp, 'layerindex-fetch', self.do_layerindex_fetch, parserecipes=False)
210 parser_layerindex_fetch.add_argument('-n', '--show-only', help='show dependencies and do nothing else', action='store_true') 213 parser_layerindex_fetch.add_argument('-n', '--show-only', help='show dependencies and do nothing else', action='store_true')
211 parser_layerindex_fetch.add_argument('-b', '--branch', help='branch name to fetch') 214 parser_layerindex_fetch.add_argument('-b', '--branch', help='branch name to fetch')
215 parser_layerindex_fetch.add_argument('-s', '--shallow', help='do only shallow clones (--depth=1)', action='store_true')
212 parser_layerindex_fetch.add_argument('-i', '--ignore', help='assume the specified layers do not need to be fetched/added (separate multiple layers with commas, no spaces)', metavar='LAYER') 216 parser_layerindex_fetch.add_argument('-i', '--ignore', help='assume the specified layers do not need to be fetched/added (separate multiple layers with commas, no spaces)', metavar='LAYER')
213 parser_layerindex_fetch.add_argument('layername', nargs='+', help='layer to fetch') 217 parser_layerindex_fetch.add_argument('layername', nargs='+', help='layer to fetch')
214 218