summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bblayers
diff options
context:
space:
mode:
authorChang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>2017-06-05 08:43:55 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-06-06 18:52:51 (GMT)
commit576821ea0a7558b626ccc87e9ae0e9ee40864956 (patch)
tree436e9076e21da7dca0922e47986e6aec6f603883 /bitbake/lib/bblayers
parent1125621b921763ff73614aae228d2d5dbb5bd2ce (diff)
downloadpoky-576821ea0a7558b626ccc87e9ae0e9ee40864956.tar.gz
bitbake: bitbake-layers: check layer dependencies before adding
In the original implementation, "bitbake-layers add-layers <layer>" succeeded without error checking. This will further introduce failures in recipe parsing only when "bitbake" command is executed. Adding a meta layer without its dependency layer(s) should failed and exit the process gracefully. Added extra argument "-F" to force add a layer without checking layer dependency. [YOCTO #10913] (Bitbake rev: 705ab252e631903e6d2e46202b419a9e8adcd861) Signed-off-by: Phoong Stanley Cheong Kwan <stanley.cheong.kwan.phoong@intel.com> Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bblayers')
-rw-r--r--bitbake/lib/bblayers/action.py26
1 files changed, 22 insertions, 4 deletions
diff --git a/bitbake/lib/bblayers/action.py b/bitbake/lib/bblayers/action.py
index cf94704..b1326e5 100644
--- a/bitbake/lib/bblayers/action.py
+++ b/bitbake/lib/bblayers/action.py
@@ -1,7 +1,9 @@
1import fnmatch 1import fnmatch
2import logging 2import logging
3import os 3import os
4import shutil
4import sys 5import sys
6import tempfile
5 7
6import bb.utils 8import bb.utils
7 9
@@ -32,10 +34,26 @@ class ActionPlugin(LayerPlugin):
32 sys.stderr.write("Unable to find bblayers.conf\n") 34 sys.stderr.write("Unable to find bblayers.conf\n")
33 return 1 35 return 1
34 36
35 notadded, _ = bb.utils.edit_bblayers_conf(bblayers_conf, layerdir, None) 37 # Back up bblayers.conf to tempdir before we add layers
36 if notadded: 38 tempdir = tempfile.mkdtemp()
37 for item in notadded: 39 backup = tempdir + "/bblayers.conf.bak"
38 sys.stderr.write("Specified layer %s is already in BBLAYERS\n" % item) 40 shutil.copy2(bblayers_conf, backup)
41
42 try:
43 notadded, _ = bb.utils.edit_bblayers_conf(bblayers_conf, layerdir, None)
44 if not (args.force or notadded):
45 try:
46 self.tinfoil.parseRecipes()
47 except bb.tinfoil.TinfoilUIException:
48 # Restore the back up copy of bblayers.conf
49 shutil.copy2(backup, bblayers_conf)
50 bb.fatal("Parse failure with the specified layer added")
51 else:
52 for item in notadded:
53 sys.stderr.write("Specified layer %s is already in BBLAYERS\n" % item)
54 finally:
55 # Remove the back up copy of bblayers.conf
56 shutil.rmtree(tempdir)
39 57
40 def do_remove_layer(self, args): 58 def do_remove_layer(self, args):
41 """Remove a layer from bblayers.conf.""" 59 """Remove a layer from bblayers.conf."""