diff options
author | Irina Patru <irina.patru@intel.com> | 2014-03-19 14:24:47 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-03-25 11:17:34 +0000 |
commit | a6c3cb705d1a86e9959c6953735057077b4a92c7 (patch) | |
tree | cad6cd9361e5c7bcf50a8a3383eb4b0751332ae0 /bitbake | |
parent | da1b795a9ab68ae21625183dc65c6b09e2b83692 (diff) | |
download | poky-a6c3cb705d1a86e9959c6953735057077b4a92c7.tar.gz |
bitbake: toaster: Remove circular dependecies from packages/recipes
The RelatedManager for Package_Dependency and Recipe_Dependency is changed
so that circular dependacies are hidden in the UI, but will still remain in
the database.
[YOCTO #5655]
(Bitbake rev: 77e6cc952e73dec4a6e5149e52f87000709d2152)
Signed-off-by: Irina Patru <irina.patru@intel.com>
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/toaster/orm/models.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index bb018a9819..30599088e5 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py | |||
@@ -20,6 +20,7 @@ | |||
20 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 20 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
21 | 21 | ||
22 | from django.db import models | 22 | from django.db import models |
23 | from django.db.models import F | ||
23 | from django.utils.encoding import python_2_unicode_compatible | 24 | from django.utils.encoding import python_2_unicode_compatible |
24 | 25 | ||
25 | 26 | ||
@@ -211,6 +212,12 @@ class Package(models.Model): | |||
211 | section = models.CharField(max_length=80, blank=True) | 212 | section = models.CharField(max_length=80, blank=True) |
212 | license = models.CharField(max_length=80, blank=True) | 213 | license = models.CharField(max_length=80, blank=True) |
213 | 214 | ||
215 | class Package_DependencyManager(models.Manager): | ||
216 | use_for_related_fields = True | ||
217 | |||
218 | def get_query_set(self): | ||
219 | return super(Package_DependencyManager, self).get_query_set().exclude(package_id = F('depends_on__id')) | ||
220 | |||
214 | class Package_Dependency(models.Model): | 221 | class Package_Dependency(models.Model): |
215 | TYPE_RDEPENDS = 0 | 222 | TYPE_RDEPENDS = 0 |
216 | TYPE_TRDEPENDS = 1 | 223 | TYPE_TRDEPENDS = 1 |
@@ -250,6 +257,7 @@ class Package_Dependency(models.Model): | |||
250 | depends_on = models.ForeignKey(Package, related_name='package_dependencies_target') # soft dependency | 257 | depends_on = models.ForeignKey(Package, related_name='package_dependencies_target') # soft dependency |
251 | dep_type = models.IntegerField(choices=DEPENDS_TYPE) | 258 | dep_type = models.IntegerField(choices=DEPENDS_TYPE) |
252 | target = models.ForeignKey(Target, null=True) | 259 | target = models.ForeignKey(Target, null=True) |
260 | objects = Package_DependencyManager() | ||
253 | 261 | ||
254 | class Target_Installed_Package(models.Model): | 262 | class Target_Installed_Package(models.Model): |
255 | target = models.ForeignKey(Target) | 263 | target = models.ForeignKey(Target) |
@@ -273,6 +281,11 @@ class Recipe(models.Model): | |||
273 | bugtracker = models.URLField(blank=True) | 281 | bugtracker = models.URLField(blank=True) |
274 | file_path = models.FilePathField(max_length=255) | 282 | file_path = models.FilePathField(max_length=255) |
275 | 283 | ||
284 | class Recipe_DependencyManager(models.Manager): | ||
285 | use_for_related_fields = True | ||
286 | |||
287 | def get_query_set(self): | ||
288 | return super(Recipe_DependencyManager, self).get_query_set().exclude(recipe_id = F('depends_on__id')) | ||
276 | 289 | ||
277 | class Recipe_Dependency(models.Model): | 290 | class Recipe_Dependency(models.Model): |
278 | TYPE_DEPENDS = 0 | 291 | TYPE_DEPENDS = 0 |
@@ -285,6 +298,7 @@ class Recipe_Dependency(models.Model): | |||
285 | recipe = models.ForeignKey(Recipe, related_name='r_dependencies_recipe') | 298 | recipe = models.ForeignKey(Recipe, related_name='r_dependencies_recipe') |
286 | depends_on = models.ForeignKey(Recipe, related_name='r_dependencies_depends') | 299 | depends_on = models.ForeignKey(Recipe, related_name='r_dependencies_depends') |
287 | dep_type = models.IntegerField(choices=DEPENDS_TYPE) | 300 | dep_type = models.IntegerField(choices=DEPENDS_TYPE) |
301 | objects = Recipe_DependencyManager() | ||
288 | 302 | ||
289 | class Layer(models.Model): | 303 | class Layer(models.Model): |
290 | name = models.CharField(max_length=100) | 304 | name = models.CharField(max_length=100) |