update_layer: fix tinfoil shutdown

Fix a couple of problems with shutting down tinfoil:

1) tinfoil.shutdown() wasn't being called on error because it wasn't
   inside a finally: section, thus on error the script hung with bitbake
   master (since the tinfoil2 changes) - this is almost certainly a bug
   in bitbake but let's handle it here anyway.
2) We need to check whether the tinfoil object actually has a shutdown
   attribute since we still want to support updating for older branches
   where tinfoil didn't have a shutdown() method.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2017-01-16 09:26:56 +13:00
parent 9ad2b36469
commit 15748efcc1

View File

@ -678,8 +678,10 @@ def main():
except:
import traceback
traceback.print_exc()
finally:
if hasattr(tinfoil, 'shutdown'):
tinfoil.shutdown()
tinfoil.shutdown()
shutil.rmtree(tempdir)
sys.exit(0)