Skip to contentSkip to conversation

fix for 7969 - Toaster shows recipes without names to users

PATCH In review Ed Bartosh 2 participants 4 messages Oct 1, 2015

lore
Share & tools
lore

Ed Bartosh

author
#0 lore raw

cover fix for 7969 - Toaster shows recipes without names to users

Hi,

Fixed 7969. The issue was caused by incomplete records in the database. Now the root cause is fixed in backend(lsupdate).
Just to make sure incomplete records are not shown in UI even if they exist another piece of backend(get_all_compatible_recipes) was modified to filter out recipes with empty names.

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 ed/toaster/7969
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/toaster/7969

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

 bitbake/lib/toaster/orm/models.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
Regards,
Ed

author
#1 lore raw

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

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]

---
 bitbake/lib/toaster/orm/models.py | 1 +
 1 file changed, 1 insertion(+)
bitbake/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
2.1.4
author
#2 lore raw

PATCH 2/2 toaster: exclude recipes with empty names

In reply to Ed Bartosh

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]

---
 bitbake/lib/toaster/orm/models.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/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
2.1.4
#3 lore raw
In reply to Ed Bartosh

worked for me on both new layer pull and on an old db with bad recipes and a migration.
Upstreamed and pushed to toaster-next.
-b

p.s. we still have 1 broken orm test but that was there before this test. broken test:
orm ->FAIL: test_build_layerversion (orm.tests.LayerVersionEquivalenceTestCase)

Quoted 33 lines · Ed Bartosh

Hi,

Fixed 7969. The issue was caused by incomplete records in the database. Now the root cause is fixed in backend(lsupdate).
Just to make sure incomplete records are not shown in UI even if they exist another piece of backend(get_all_compatible_recipes) was modified to filter out recipes with empty names.

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 ed/toaster/7969
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/toaster/7969

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

 bitbake/lib/toaster/orm/models.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
Regards,
Ed

--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster