Skip to contentSkip to conversation

remove empty recipe names #7969

PATCH New brian avery 1 participant 3 messages Oct 1, 2015

lore
Share & tools
lore
#0 lore raw

cover remove empty recipe names #7969

This removes the receipes with empty names from toaster.

The following changes since commit 7b10ae122d46891c734e786358ea5f36760e8d5e:

toaster: Fix broken test case (2015-10-01 10:42:16 +0100)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib bavery/submit/ed/2015-10-1_nameless-recipes-7969
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=bavery/submit/ed/2015-10-1_nameless-recipes-7969

Ed Bartosh (2):
toaster: delete recipe if it can't be saved
toaster: exclude recipes with empty names

 lib/toaster/orm/models.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/2 toaster: delete recipe if it can't be saved

From: Ed Bartosh <[email protected]>

Due to Recipe model constraints some recipes can't be saved. However, they still can create incomplete records in the database. This causes all sorts of errors when Toaster operates with those objects. Removing them should fix those issues.

[YOCTO #7969]

---
 lib/toaster/orm/models.py | 1 +
 1 file changed, 1 insertion(+)
lib/toaster/orm/models.py +1 -0
index 5aed158..89343f2 100644
@@ -1011,6 +1011,7 @@ class LayerIndexLayerSource(LayerSource):
                 ro.save()
             except IntegrityError as e:
                 logger.debug("Failed saving recipe, ignoring: %s (%s:%s)" % (e, ro.layer_version, ri['filepath']+"/"+ri['filename']))
+                ro.delete()
         if not connection.features.autocommits_when_autocommit_is_off:
             transaction.set_autocommit(True)
 
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/2 toaster: exclude recipes with empty names

From: Ed Bartosh <[email protected]>

Modified get_all_compatible_recipes function to exclude recipes with empty names from the result queryset. This should stop UI to show recipes with empty names in compatible recipes page.

[YOCTO #7969]

---
 lib/toaster/orm/models.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/toaster/orm/models.py +1 -1
index 89343f2..ad12dd4 100644
@@ -253,7 +253,7 @@ class Project(models.Model):
         """ Returns QuerySet of all the compatible Recipes available to the
         project including ones from Layers not currently added """
         queryset = Recipe.objects.filter(
-            layer_version__in=self.get_all_compatible_layer_versions())
+            layer_version__in=self.get_all_compatible_layer_versions()).exclude(name__exact='')
 
         return queryset
 
Signature · 1 line
1.9.1