mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
update_layer: fix handling of database errors
If a database error occurs when we save a recipe (e.g. because a database-level constraint is voilated) it will mess up the transaction. Unfortunately that means we need to break out of updating the entire layer rather than catching the error, because if we do catch it we just get errors on every update after the initial error; failing early and giving up on the transaction is a little better in terms of not filling up the update logs with further useless errors. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
fa0b01082f
commit
87fe124ad7
|
@ -56,6 +56,8 @@ def split_recipe_fn(path):
|
|||
return (pn, pv)
|
||||
|
||||
def update_recipe_file(tinfoil, data, path, recipe, layerdir_start, repodir):
|
||||
from django.db import DatabaseError
|
||||
|
||||
fn = str(os.path.join(path, recipe.filename))
|
||||
from layerindex.models import PackageConfig, StaticBuildDep, DynamicBuildDep
|
||||
try:
|
||||
|
@ -156,6 +158,8 @@ def update_recipe_file(tinfoil, data, path, recipe, layerdir_start, repodir):
|
|||
|
||||
except KeyboardInterrupt:
|
||||
raise
|
||||
except DatabaseError:
|
||||
raise
|
||||
except BaseException as e:
|
||||
if not recipe.pn:
|
||||
recipe.pn = recipe.filename[:-3].split('_')[0]
|
||||
|
|
Loading…
Reference in New Issue
Block a user