rrs/tools: handle dry-run properly

In the case of dry-run a couple of the scripts were breaking out after
one layerbranch had been processed due to the code structure. Handle the
exception within the block for the layerbranch to avoid this.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2018-09-04 15:28:39 +12:00
parent 0201a86f0d
commit 9d0e048ded
2 changed files with 61 additions and 60 deletions

View File

@ -112,9 +112,7 @@ if __name__=="__main__":
logger.debug("Starting recipe distros update ...")
try:
origsyspath = sys.path
with transaction.atomic():
for maintplan in maintplans:
for item in maintplan.maintenanceplanlayerbranch_set.all():
layerbranch = item.layerbranch
@ -125,6 +123,8 @@ if __name__=="__main__":
if not recipes:
continue
try:
with transaction.atomic():
utils.setup_core_layer_sys_path(settings, layerbranch.branch.name)
from oe import distro_check
@ -153,10 +153,10 @@ if __name__=="__main__":
recipedistro.save()
logger.debug('%s: layer branch %s, add distro %s alias %s' % (pn,
str(layerbranch), distro, alias))
finally:
tinfoil.shutdown()
shutil.rmtree(tempdir)
if options.dry_run:
raise DryRunRollbackException
except DryRunRollbackException:
pass
finally:
tinfoil.shutdown()
shutil.rmtree(tempdir)

View File

@ -178,6 +178,7 @@ if __name__=="__main__":
for maintplan in maintplans:
for item in maintplan.maintenanceplanlayerbranch_set.all():
layerbranch = item.layerbranch
try:
with transaction.atomic():
sys.path = origsyspath