aboutsummaryrefslogtreecommitdiffstats
path: root/layerindex/update_layer.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2018-01-04 16:39:25 +1300
committerPaul Eggleton <paul.eggleton@linux.intel.com>2018-01-09 17:10:45 +1300
commit87fe124ad7e91df21361f54e45e2c51742b60df9 (patch)
tree77710fd7294dd3d152d51d133f4dd73866be28f5 /layerindex/update_layer.py
parentfa0b01082fb0596959841e95af8c516ae3f267a7 (diff)
downloadopenembedded-core-contrib-87fe124ad7e91df21361f54e45e2c51742b60df9.tar.gz
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>
Diffstat (limited to 'layerindex/update_layer.py')
-rw-r--r--layerindex/update_layer.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/layerindex/update_layer.py b/layerindex/update_layer.py
index 307c43abf2..42e4da93fc 100644
--- a/layerindex/update_layer.py
+++ b/layerindex/update_layer.py
@@ -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]