diff options
Diffstat (limited to 'bitbake/lib/bblayers/action.py')
-rw-r--r-- | bitbake/lib/bblayers/action.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/bitbake/lib/bblayers/action.py b/bitbake/lib/bblayers/action.py index f05f5d330f..a14f19948e 100644 --- a/bitbake/lib/bblayers/action.py +++ b/bitbake/lib/bblayers/action.py | |||
@@ -1,4 +1,6 @@ | |||
1 | # | 1 | # |
2 | # Copyright BitBake Contributors | ||
3 | # | ||
2 | # SPDX-License-Identifier: GPL-2.0-only | 4 | # SPDX-License-Identifier: GPL-2.0-only |
3 | # | 5 | # |
4 | 6 | ||
@@ -9,6 +11,7 @@ import shutil | |||
9 | import sys | 11 | import sys |
10 | import tempfile | 12 | import tempfile |
11 | 13 | ||
14 | from bb.cookerdata import findTopdir | ||
12 | import bb.utils | 15 | import bb.utils |
13 | 16 | ||
14 | from bblayers.common import LayerPlugin | 17 | from bblayers.common import LayerPlugin |
@@ -35,7 +38,7 @@ class ActionPlugin(LayerPlugin): | |||
35 | sys.stderr.write("Specified layer directory %s doesn't contain a conf/layer.conf file\n" % layerdir) | 38 | sys.stderr.write("Specified layer directory %s doesn't contain a conf/layer.conf file\n" % layerdir) |
36 | return 1 | 39 | return 1 |
37 | 40 | ||
38 | bblayers_conf = os.path.join('conf', 'bblayers.conf') | 41 | bblayers_conf = os.path.join(findTopdir(),'conf', 'bblayers.conf') |
39 | if not os.path.exists(bblayers_conf): | 42 | if not os.path.exists(bblayers_conf): |
40 | sys.stderr.write("Unable to find bblayers.conf\n") | 43 | sys.stderr.write("Unable to find bblayers.conf\n") |
41 | return 1 | 44 | return 1 |
@@ -48,12 +51,14 @@ class ActionPlugin(LayerPlugin): | |||
48 | try: | 51 | try: |
49 | notadded, _ = bb.utils.edit_bblayers_conf(bblayers_conf, layerdirs, None) | 52 | notadded, _ = bb.utils.edit_bblayers_conf(bblayers_conf, layerdirs, None) |
50 | if not (args.force or notadded): | 53 | if not (args.force or notadded): |
54 | self.tinfoil.modified_files() | ||
51 | try: | 55 | try: |
52 | self.tinfoil.run_command('parseConfiguration') | 56 | self.tinfoil.run_command('parseConfiguration') |
53 | except (bb.tinfoil.TinfoilUIException, bb.BBHandledException): | 57 | except (bb.tinfoil.TinfoilUIException, bb.BBHandledException): |
54 | # Restore the back up copy of bblayers.conf | 58 | # Restore the back up copy of bblayers.conf |
55 | shutil.copy2(backup, bblayers_conf) | 59 | shutil.copy2(backup, bblayers_conf) |
56 | bb.fatal("Parse failure with the specified layer added, aborting.") | 60 | self.tinfoil.modified_files() |
61 | bb.fatal("Parse failure with the specified layer added, exiting.") | ||
57 | else: | 62 | else: |
58 | for item in notadded: | 63 | for item in notadded: |
59 | sys.stderr.write("Specified layer %s is already in BBLAYERS\n" % item) | 64 | sys.stderr.write("Specified layer %s is already in BBLAYERS\n" % item) |
@@ -63,7 +68,7 @@ class ActionPlugin(LayerPlugin): | |||
63 | 68 | ||
64 | def do_remove_layer(self, args): | 69 | def do_remove_layer(self, args): |
65 | """Remove one or more layers from bblayers.conf.""" | 70 | """Remove one or more layers from bblayers.conf.""" |
66 | bblayers_conf = os.path.join('conf', 'bblayers.conf') | 71 | bblayers_conf = os.path.join(findTopdir() ,'conf', 'bblayers.conf') |
67 | if not os.path.exists(bblayers_conf): | 72 | if not os.path.exists(bblayers_conf): |
68 | sys.stderr.write("Unable to find bblayers.conf\n") | 73 | sys.stderr.write("Unable to find bblayers.conf\n") |
69 | return 1 | 74 | return 1 |
@@ -78,6 +83,9 @@ class ActionPlugin(LayerPlugin): | |||
78 | layerdir = os.path.abspath(item) | 83 | layerdir = os.path.abspath(item) |
79 | layerdirs.append(layerdir) | 84 | layerdirs.append(layerdir) |
80 | (_, notremoved) = bb.utils.edit_bblayers_conf(bblayers_conf, None, layerdirs) | 85 | (_, notremoved) = bb.utils.edit_bblayers_conf(bblayers_conf, None, layerdirs) |
86 | if args.force > 1: | ||
87 | return 0 | ||
88 | self.tinfoil.modified_files() | ||
81 | if notremoved: | 89 | if notremoved: |
82 | for item in notremoved: | 90 | for item in notremoved: |
83 | sys.stderr.write("No layers matching %s found in BBLAYERS\n" % item) | 91 | sys.stderr.write("No layers matching %s found in BBLAYERS\n" % item) |
@@ -237,6 +245,9 @@ build results (as the layer priority order has effectively changed). | |||
237 | if not entry_found: | 245 | if not entry_found: |
238 | logger.warning("File %s does not match the flattened layer's BBFILES setting, you may need to edit conf/layer.conf or move the file elsewhere" % f1full) | 246 | logger.warning("File %s does not match the flattened layer's BBFILES setting, you may need to edit conf/layer.conf or move the file elsewhere" % f1full) |
239 | 247 | ||
248 | self.tinfoil.modified_files() | ||
249 | |||
250 | |||
240 | def get_file_layer(self, filename): | 251 | def get_file_layer(self, filename): |
241 | layerdir = self.get_file_layerdir(filename) | 252 | layerdir = self.get_file_layerdir(filename) |
242 | if layerdir: | 253 | if layerdir: |