mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-05 13:14:46 +02:00
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:
parent
0201a86f0d
commit
9d0e048ded
|
@ -112,19 +112,19 @@ 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
|
||||
sys.path = origsyspath
|
||||
(tinfoil, d, recipes, tempdir) = load_recipes(layerbranch, bitbakepath,
|
||||
fetchdir, settings, logger)
|
||||
try:
|
||||
if not recipes:
|
||||
continue
|
||||
origsyspath = sys.path
|
||||
for maintplan in maintplans:
|
||||
for item in maintplan.maintenanceplanlayerbranch_set.all():
|
||||
layerbranch = item.layerbranch
|
||||
sys.path = origsyspath
|
||||
(tinfoil, d, recipes, tempdir) = load_recipes(layerbranch, bitbakepath,
|
||||
fetchdir, settings, logger)
|
||||
try:
|
||||
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
|
||||
if options.dry_run:
|
||||
raise DryRunRollbackException
|
||||
except DryRunRollbackException:
|
||||
pass
|
||||
finally:
|
||||
tinfoil.shutdown()
|
||||
shutil.rmtree(tempdir)
|
||||
|
|
|
@ -178,59 +178,60 @@ if __name__=="__main__":
|
|||
for maintplan in maintplans:
|
||||
for item in maintplan.maintenanceplanlayerbranch_set.all():
|
||||
layerbranch = item.layerbranch
|
||||
with transaction.atomic():
|
||||
sys.path = origsyspath
|
||||
try:
|
||||
with transaction.atomic():
|
||||
sys.path = origsyspath
|
||||
|
||||
layer = layerbranch.layer
|
||||
urldir = layer.get_fetch_dir()
|
||||
repodir = os.path.join(fetchdir, urldir)
|
||||
layerdir = os.path.join(repodir, layerbranch.vcs_subdir)
|
||||
layer = layerbranch.layer
|
||||
urldir = layer.get_fetch_dir()
|
||||
repodir = os.path.join(fetchdir, urldir)
|
||||
layerdir = os.path.join(repodir, layerbranch.vcs_subdir)
|
||||
|
||||
recipe_files = []
|
||||
for recipe in layerbranch.recipe_set.all():
|
||||
file = str(os.path.join(layerdir, recipe.full_path()))
|
||||
recipe_files.append(file)
|
||||
recipe_files = []
|
||||
for recipe in layerbranch.recipe_set.all():
|
||||
file = str(os.path.join(layerdir, recipe.full_path()))
|
||||
recipe_files.append(file)
|
||||
|
||||
(tinfoil, d, recipes, tempdir) = load_recipes(layerbranch, bitbakepath,
|
||||
fetchdir, settings, logger, recipe_files=recipe_files)
|
||||
try:
|
||||
(tinfoil, d, recipes, tempdir) = load_recipes(layerbranch, bitbakepath,
|
||||
fetchdir, settings, logger, recipe_files=recipe_files)
|
||||
try:
|
||||
|
||||
if not recipes:
|
||||
continue
|
||||
if not recipes:
|
||||
continue
|
||||
|
||||
utils.setup_core_layer_sys_path(settings, layerbranch.branch.name)
|
||||
utils.setup_core_layer_sys_path(settings, layerbranch.branch.name)
|
||||
|
||||
for recipe_data in recipes:
|
||||
set_regexes(recipe_data)
|
||||
for recipe_data in recipes:
|
||||
set_regexes(recipe_data)
|
||||
|
||||
history = RecipeUpstreamHistory(layerbranch=layerbranch, start_date=datetime.now())
|
||||
history = RecipeUpstreamHistory(layerbranch=layerbranch, start_date=datetime.now())
|
||||
|
||||
result = []
|
||||
for recipe_data in recipes:
|
||||
try:
|
||||
get_upstream_info(layerbranch, recipe_data, result)
|
||||
except:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
result = []
|
||||
for recipe_data in recipes:
|
||||
try:
|
||||
get_upstream_info(layerbranch, recipe_data, result)
|
||||
except:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
history.end_date = datetime.now()
|
||||
history.save()
|
||||
history.end_date = datetime.now()
|
||||
history.save()
|
||||
|
||||
for res in result:
|
||||
(recipe, ru) = res
|
||||
for res in result:
|
||||
(recipe, ru) = res
|
||||
|
||||
ru.history = history
|
||||
ru.save()
|
||||
ru.history = history
|
||||
ru.save()
|
||||
|
||||
logger.debug('%s: layer branch %s, pv %s, upstream (%s)' % (recipe.pn,
|
||||
str(layerbranch), recipe.pv, str(ru)))
|
||||
logger.debug('%s: layer branch %s, pv %s, upstream (%s)' % (recipe.pn,
|
||||
str(layerbranch), recipe.pv, str(ru)))
|
||||
|
||||
finally:
|
||||
tinfoil.shutdown()
|
||||
shutil.rmtree(tempdir)
|
||||
if options.dry_run:
|
||||
raise DryRunRollbackException
|
||||
except DryRunRollbackException:
|
||||
pass
|
||||
finally:
|
||||
tinfoil.shutdown()
|
||||
shutil.rmtree(tempdir)
|
||||
if options.dry_run:
|
||||
raise DryRunRollbackException
|
||||
except DryRunRollbackException:
|
||||
pass
|
||||
finally:
|
||||
utils.unlock_file(lockfile)
|
||||
|
|
Loading…
Reference in New Issue
Block a user