From d7bf8c17eca8f8c89898a7794462c773c449e983 Mon Sep 17 00:00:00 2001 From: Brad Bishop Date: Sun, 25 Feb 2018 22:55:05 -0500 Subject: Yocto 2.4 Move OpenBMC to Yocto 2.4(rocko) Tested: Built and verified Witherspoon and Palmetto images Change-Id: I12057b18610d6fb0e6903c60213690301e9b0c67 Signed-off-by: Brad Bishop --- .../yocto-poky/bitbake/lib/bblayers/action.py | 26 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'import-layers/yocto-poky/bitbake/lib/bblayers/action.py') diff --git a/import-layers/yocto-poky/bitbake/lib/bblayers/action.py b/import-layers/yocto-poky/bitbake/lib/bblayers/action.py index cf9470427..b1326e5f5 100644 --- a/import-layers/yocto-poky/bitbake/lib/bblayers/action.py +++ b/import-layers/yocto-poky/bitbake/lib/bblayers/action.py @@ -1,7 +1,9 @@ import fnmatch import logging import os +import shutil import sys +import tempfile import bb.utils @@ -32,10 +34,26 @@ class ActionPlugin(LayerPlugin): sys.stderr.write("Unable to find bblayers.conf\n") return 1 - notadded, _ = bb.utils.edit_bblayers_conf(bblayers_conf, layerdir, None) - if notadded: - for item in notadded: - sys.stderr.write("Specified layer %s is already in BBLAYERS\n" % item) + # Back up bblayers.conf to tempdir before we add layers + tempdir = tempfile.mkdtemp() + backup = tempdir + "/bblayers.conf.bak" + shutil.copy2(bblayers_conf, backup) + + try: + notadded, _ = bb.utils.edit_bblayers_conf(bblayers_conf, layerdir, None) + if not (args.force or notadded): + try: + self.tinfoil.parseRecipes() + except bb.tinfoil.TinfoilUIException: + # Restore the back up copy of bblayers.conf + shutil.copy2(backup, bblayers_conf) + bb.fatal("Parse failure with the specified layer added") + else: + for item in notadded: + sys.stderr.write("Specified layer %s is already in BBLAYERS\n" % item) + finally: + # Remove the back up copy of bblayers.conf + shutil.rmtree(tempdir) def do_remove_layer(self, args): """Remove a layer from bblayers.conf.""" -- cgit v1.2.1