* [PATCH 0/7] Fix 8004
@ 2015-09-30 12:02 Ed Bartosh
2015-09-30 12:02 ` [PATCH 1/7] toaster: implement API to get full list of deps Ed Bartosh
` (7 more replies)
0 siblings, 8 replies; 10+ messages in thread
From: Ed Bartosh @ 2015-09-30 12:02 UTC (permalink / raw)
To: toaster
Hi,
This patchset fixes bug 8004: importing a layer from the recipes page
auto adds the 1st level dependencies but not the 2nd level.
Now dependent layers are discovered recursively and Toaster shows all of them
in Compatible layers view.
The patchset includes fixes for orm test suite and new test case for
Layer_Version.get_alldeps API used in this bug fix.
Please review.
The following changes since commit f8bd18184a84e6de1976ecb4d0d929c55bc19a66:
toaster: orm remove the complicated querying on the ORM (2015-09-28 20:07:38 -0700)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib ed/toaster/8004
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/toaster/8004
Ed Bartosh (7):
toaster: implement API to get full list of deps
toaster: use get_alldeps in layerdetails renderer
toaster: add template filter get_alldeps
toaster: use get_alldeps in LayerTable
toaster: fix NameError
toaster: fix orm tests
toaster: test get_alldeps API
bitbake/lib/toaster/orm/models.py | 21 ++++++++-
bitbake/lib/toaster/orm/tests.py | 53 ++++++++++------------
bitbake/lib/toaster/toastergui/tables.py | 11 +++--
.../toaster/toastergui/templatetags/projecttags.py | 4 ++
bitbake/lib/toaster/toastergui/views.py | 4 +-
5 files changed, 55 insertions(+), 38 deletions(-)
--
Ed
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/7] toaster: implement API to get full list of deps
2015-09-30 12:02 [PATCH 0/7] Fix 8004 Ed Bartosh
@ 2015-09-30 12:02 ` Ed Bartosh
2015-09-30 12:02 ` [PATCH 2/7] toaster: use get_alldeps in layerdetails renderer Ed Bartosh
` (6 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Ed Bartosh @ 2015-09-30 12:02 UTC (permalink / raw)
To: toaster
Implemented Layer_Version.get_alldeps API to recursively get
full list of dependencies for the layer. Dependencies that are
already in the project are filtered out from the result.
Result list of Layer_Version objects is sorted by layer name
for UI to look consistent.
This API is going to be used to show amount and list of
dependencies for the layer in the list of compatible layers
for the project.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
bitbake/lib/toaster/orm/models.py | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 5aed158..c5e256f 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -1177,6 +1177,25 @@ class Layer_Version(models.Model):
def get_detailspage_url(self, project_id):
return reverse('layerdetails', args=(project_id, self.pk))
+ def get_alldeps(self, project_id):
+ """Get full list of unique layer dependencies."""
+ def gen_layerdeps(lver, project):
+ for ldep in lver.dependencies.all():
+ yield ldep.depends_on
+ # get next level of deps recursively calling gen_layerdeps
+ for subdep in gen_layerdeps(ldep.depends_on, project):
+ yield subdep
+
+ project = Project.objects.get(pk=project_id)
+ result = []
+ projectlvers = [player.layercommit for player in project.projectlayer_set.all()]
+ for dep in gen_layerdeps(self, project):
+ # filter out duplicates and layers already belonging to the project
+ if dep not in result + projectlvers:
+ result.append(dep)
+
+ return sorted(result, key=lambda x: x.layer.name)
+
def __unicode__(self):
return "%d %s (VCS %s, Project %s)" % (self.pk, str(self.layer), self.get_vcs_reference(), self.build.project if self.build is not None else "No project")
--
2.1.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/7] toaster: use get_alldeps in layerdetails renderer
2015-09-30 12:02 [PATCH 0/7] Fix 8004 Ed Bartosh
2015-09-30 12:02 ` [PATCH 1/7] toaster: implement API to get full list of deps Ed Bartosh
@ 2015-09-30 12:02 ` Ed Bartosh
2015-09-30 12:02 ` [PATCH 3/7] toaster: add template filter get_alldeps Ed Bartosh
` (5 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Ed Bartosh @ 2015-09-30 12:02 UTC (permalink / raw)
To: toaster
Used Layer_Version.get_alldeps api in layerdetails template
renderer to get list of layer dependencies.
[YOCTO 8004]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
bitbake/lib/toaster/toastergui/views.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index b7eddf4..f66b5ab 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -2760,8 +2760,8 @@ if True:
context = { 'project' : project,
'layerversion' : layer_version,
- 'layerdeps' : { "list": [
- [{"id": y.id, "name": y.layer.name} for y in x.depends_on.get_equivalents_wpriority(project)][0] for x in layer_version.dependencies.all()]},
+ 'layerdeps' : {"list": [{"id": dep.id, "name": dep.layer.name} \
+ for dep in layer_version.get_alldeps(project.id)]},
'projectlayers': map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=project))
}
--
2.1.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/7] toaster: add template filter get_alldeps
2015-09-30 12:02 [PATCH 0/7] Fix 8004 Ed Bartosh
2015-09-30 12:02 ` [PATCH 1/7] toaster: implement API to get full list of deps Ed Bartosh
2015-09-30 12:02 ` [PATCH 2/7] toaster: use get_alldeps in layerdetails renderer Ed Bartosh
@ 2015-09-30 12:02 ` Ed Bartosh
2015-09-30 12:02 ` [PATCH 4/7] toaster: use get_alldeps in LayerTable Ed Bartosh
` (4 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Ed Bartosh @ 2015-09-30 12:02 UTC (permalink / raw)
To: toaster
This filter will be used in the tables.py template to call
Layer_Version.get_alldeps API. This API has a parameter and
the only way to pass parameter from Django template to the
function is to use filter.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
bitbake/lib/toaster/toastergui/templatetags/projecttags.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
index 75f2261..55f255b 100644
--- a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
+++ b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
@@ -297,3 +297,7 @@ def cut_path_prefix(fullpath, prefixes):
if fullpath.startswith(prefix):
return relpath(fullpath, prefix)
return fullpath
+
+@register.filter
+def get_alldeps(lver, project_id):
+ return lver.get_alldeps(int(project_id))
--
2.1.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/7] toaster: use get_alldeps in LayerTable
2015-09-30 12:02 [PATCH 0/7] Fix 8004 Ed Bartosh
` (2 preceding siblings ...)
2015-09-30 12:02 ` [PATCH 3/7] toaster: add template filter get_alldeps Ed Bartosh
@ 2015-09-30 12:02 ` Ed Bartosh
2015-09-30 12:02 ` [PATCH 5/7] toaster: fix NameError Ed Bartosh
` (3 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Ed Bartosh @ 2015-09-30 12:02 UTC (permalink / raw)
To: toaster
Called Layer_Version.get_alldeps API through get_alldeps
filter in tables.py:LayerTable template to show amount and
list of dependencies for the layer.
[YOCTO 8004]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
bitbake/lib/toaster/toastergui/tables.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py
index 3354072..6809056 100644
--- a/bitbake/lib/toaster/toastergui/tables.py
+++ b/bitbake/lib/toaster/toastergui/tables.py
@@ -166,15 +166,16 @@ class LayersTable(ToasterTable):
static_data_template=revision_template)
deps_template = '''
- {% with ods=data.dependencies.all%}
- {% if ods.count %}
+ {% load projecttags %}
+ {% with deps=data|get_alldeps:extra.pid %}
+ {% if deps|length %}
<a class="btn" title="<a href='{% url "layerdetails" extra.pid data.id %}'>{{data.layer.name}}</a> dependencies"
data-content="<ul class='unstyled'>
- {% for i in ods%}
- <li><a href='{% url "layerdetails" extra.pid i.depends_on.pk %}'>{{i.depends_on.layer.name}}</a></li>
+ {% for dep in deps %}
+ <li><a href='{% url "layerdetails" extra.pid dep.pk %}'>{{dep.layer.name}}</a></li>
{% endfor %}
</ul>">
- {{ods.count}}
+ {{deps|length}}
</a>
{% endif %}
{% endwith %}
--
2.1.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 5/7] toaster: fix NameError
2015-09-30 12:02 [PATCH 0/7] Fix 8004 Ed Bartosh
` (3 preceding siblings ...)
2015-09-30 12:02 ` [PATCH 4/7] toaster: use get_alldeps in LayerTable Ed Bartosh
@ 2015-09-30 12:02 ` Ed Bartosh
2015-09-30 12:02 ` [PATCH 6/7] toaster: fix orm tests Ed Bartosh
` (2 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Ed Bartosh @ 2015-09-30 12:02 UTC (permalink / raw)
To: toaster
Fixed exception: NameError: global name 'DoesNotExist' is not defined
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
bitbake/lib/toaster/orm/models.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index c5e256f..5bc7c6b 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -900,7 +900,7 @@ class LayerIndexLayerSource(LayerSource):
oe_core_l.save()
continue
- except DoesNotExist:
+ except Layer.DoesNotExist:
pass
l, created = Layer.objects.get_or_create(layer_source = self, name = li['name'])
--
2.1.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 6/7] toaster: fix orm tests
2015-09-30 12:02 [PATCH 0/7] Fix 8004 Ed Bartosh
` (4 preceding siblings ...)
2015-09-30 12:02 ` [PATCH 5/7] toaster: fix NameError Ed Bartosh
@ 2015-09-30 12:02 ` Ed Bartosh
2015-09-30 12:02 ` [PATCH 7/7] toaster: test get_alldeps API Ed Bartosh
2015-10-01 9:39 ` [PATCH 0/7] Fix 8004 Barros Pena, Belen
7 siblings, 0 replies; 10+ messages in thread
From: Ed Bartosh @ 2015-09-30 12:02 UTC (permalink / raw)
To: toaster
Cleaned up and fixed orm tests. Removed test_build_layerversion as
it's not needed due to changed compatible_layer_versions API.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
bitbake/lib/toaster/orm/tests.py | 33 ++++-----------------------------
1 file changed, 4 insertions(+), 29 deletions(-)
diff --git a/bitbake/lib/toaster/orm/tests.py b/bitbake/lib/toaster/orm/tests.py
index 783aea8..c30f99a 100644
--- a/bitbake/lib/toaster/orm/tests.py
+++ b/bitbake/lib/toaster/orm/tests.py
@@ -25,10 +25,9 @@ from django.test import TestCase, TransactionTestCase
from orm.models import LocalLayerSource, LayerIndexLayerSource, ImportedLayerSource, LayerSource
from orm.models import Branch
-from orm.models import Project, Build, Layer, Layer_Version, Branch, ProjectLayer
+from orm.models import Project, Layer, Layer_Version, Branch, ProjectLayer
from orm.models import Release, ReleaseLayerSourcePriority, BitbakeVersion
-from django.utils import timezone
from django.db import IntegrityError
import os
@@ -153,35 +152,11 @@ class LayerVersionEquivalenceTestCase(TestCase):
equivqs = self.lver.get_equivalents_wpriority(self.project)
self.assertEqual(list(equivqs), [lver2, self.lver])
- def test_build_layerversion(self):
+ def test_compatible_layer_versions(self):
"""
- Any layer version coming from the build should show up
- before any layer version coming from upstream
- """
- build = Build.objects.create(project=self.project,
- started_on=timezone.now(),
- completed_on=timezone.now())
- lvb = Layer_Version.objects.create(layer=self.layer, build=build,
- commit="deadbeef")
-
- # a build layerversion must be in the equivalence
- # list for the original layerversion
- equivqs = self.lver.get_equivalents_wpriority(self.project)
- self.assertTrue(len(equivqs) == 2)
- self.assertTrue(equivqs[0] == self.lver)
- self.assertTrue(equivqs[1] == lvb)
-
- # getting the build layerversion equivalent list must
- # return the same list as the original layer
- bequivqs = lvb.get_equivalents_wpriority(self.project)
-
- self.assertEqual(list(equivqs), list(bequivqs))
-
- def test_compatible_layerversions(self):
- """
- When we have a 2 layer versions, compatible_layerversions()
+ When we have a 2 layer versions, get_all_compatible_layerversions()
should return a queryset with both.
"""
- compat_lv = self.project.compatible_layerversions()
+ compat_lv = self.project.get_all_compatible_layer_versions()
self.assertEqual(list(compat_lv), [self.lver, self.lver2])
--
2.1.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 7/7] toaster: test get_alldeps API
2015-09-30 12:02 [PATCH 0/7] Fix 8004 Ed Bartosh
` (5 preceding siblings ...)
2015-09-30 12:02 ` [PATCH 6/7] toaster: fix orm tests Ed Bartosh
@ 2015-09-30 12:02 ` Ed Bartosh
2015-10-01 9:39 ` [PATCH 0/7] Fix 8004 Barros Pena, Belen
7 siblings, 0 replies; 10+ messages in thread
From: Ed Bartosh @ 2015-09-30 12:02 UTC (permalink / raw)
To: toaster
Added test case to test Layer_Version.get_alldeps API.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
bitbake/lib/toaster/orm/tests.py | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/bitbake/lib/toaster/orm/tests.py b/bitbake/lib/toaster/orm/tests.py
index c30f99a..719266e 100644
--- a/bitbake/lib/toaster/orm/tests.py
+++ b/bitbake/lib/toaster/orm/tests.py
@@ -23,7 +23,7 @@
from django.test import TestCase, TransactionTestCase
from orm.models import LocalLayerSource, LayerIndexLayerSource, ImportedLayerSource, LayerSource
-from orm.models import Branch
+from orm.models import Branch, LayerVersionDependency
from orm.models import Project, Layer, Layer_Version, Branch, ProjectLayer
from orm.models import Release, ReleaseLayerSourcePriority, BitbakeVersion
@@ -160,3 +160,21 @@ class LayerVersionEquivalenceTestCase(TestCase):
compat_lv = self.project.get_all_compatible_layer_versions()
self.assertEqual(list(compat_lv), [self.lver, self.lver2])
+ def test_layerversion_get_alldeps(self):
+ """Test Layer_Version.get_alldeps API."""
+ lvers = {}
+ for i in range(10):
+ name = "layer%d" % i
+ lvers[name] = Layer_Version.objects.create(layer=Layer.objects.create(name=name),
+ project=self.project)
+ if i:
+ LayerVersionDependency.objects.create(layer_version=lvers["layer%d" % (i - 1)],
+ depends_on=lvers[name])
+ # Check dinamically added deps
+ self.assertEqual(lvers['layer0'].get_alldeps(self.project.id),
+ [lvers['layer%d' % n] for n in range(1, i+1)])
+
+ # Check chain of deps created in previous loop
+ for i in range(10):
+ self.assertEqual(lvers['layer%d' % i].get_alldeps(self.project.id),
+ [lvers['layer%d' % n] for n in range(i+1, 10)])
--
2.1.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 0/7] Fix 8004
2015-09-30 12:02 [PATCH 0/7] Fix 8004 Ed Bartosh
` (6 preceding siblings ...)
2015-09-30 12:02 ` [PATCH 7/7] toaster: test get_alldeps API Ed Bartosh
@ 2015-10-01 9:39 ` Barros Pena, Belen
2015-10-01 13:03 ` Ed Bartosh
7 siblings, 1 reply; 10+ messages in thread
From: Barros Pena, Belen @ 2015-10-01 9:39 UTC (permalink / raw)
To: Ed Bartosh; +Cc: toaster@yoctoproject.org
On 30/09/2015 13:02, "toaster-bounces@yoctoproject.org on behalf of Ed
Bartosh" <toaster-bounces@yoctoproject.org on behalf of
ed.bartosh@linux.intel.com> wrote:
>Hi,
>
>This patchset fixes bug 8004: importing a layer from the recipes page
>auto adds the 1st level dependencies but not the 2nd level.
>Now dependent layers are discovered recursively and Toaster shows all of
>them
>in Compatible layers view.
>
>The patchset includes fixes for orm test suite and new test case for
>Layer_Version.get_alldeps API used in this bug fix.
>
>Please review.
>
>
>The following changes since commit
>f8bd18184a84e6de1976ecb4d0d929c55bc19a66:
>
> toaster: orm remove the complicated querying on the ORM (2015-09-28
>20:07:38 -0700)
>
>are available in the git repository at:
>
> git://git.yoctoproject.org/poky-contrib ed/toaster/8004
> http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/toaster/8004
This seems to be working, except for a small issue: the second-level
dependency information is not showing up in the layer details page. So,
for example, if you look at meta-aurora in the compatible layers table,
you get 6 dependencies listed. If you add meta-aurora to your project, you
also get 6 dependencies listed in the dependencies modal dialog. But if
you click meta-aurora and check the layer details page, there are only 4
dependencies listed. We need to show the second-level dependency
information in the layer details page too.
Thanks!
Belén
>
>Ed Bartosh (7):
> toaster: implement API to get full list of deps
> toaster: use get_alldeps in layerdetails renderer
> toaster: add template filter get_alldeps
> toaster: use get_alldeps in LayerTable
> toaster: fix NameError
> toaster: fix orm tests
> toaster: test get_alldeps API
>
> bitbake/lib/toaster/orm/models.py | 21 ++++++++-
> bitbake/lib/toaster/orm/tests.py | 53
>++++++++++------------
> bitbake/lib/toaster/toastergui/tables.py | 11 +++--
> .../toaster/toastergui/templatetags/projecttags.py | 4 ++
> bitbake/lib/toaster/toastergui/views.py | 4 +-
> 5 files changed, 55 insertions(+), 38 deletions(-)
>
>--
>Ed
>
>--
>_______________________________________________
>toaster mailing list
>toaster@yoctoproject.org
>https://lists.yoctoproject.org/listinfo/toaster
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/7] Fix 8004
2015-10-01 9:39 ` [PATCH 0/7] Fix 8004 Barros Pena, Belen
@ 2015-10-01 13:03 ` Ed Bartosh
0 siblings, 0 replies; 10+ messages in thread
From: Ed Bartosh @ 2015-10-01 13:03 UTC (permalink / raw)
To: Barros Pena, Belen; +Cc: toaster@yoctoproject.org
Hi Belen,
On Thu, Oct 01, 2015 at 09:39:33AM +0000, Barros Pena, Belen wrote:
> This seems to be working, except for a small issue: the second-level
> dependency information is not showing up in the layer details page. So,
> for example, if you look at meta-aurora in the compatible layers table,
> you get 6 dependencies listed. If you add meta-aurora to your project, you
> also get 6 dependencies listed in the dependencies modal dialog. But if
> you click meta-aurora and check the layer details page, there are only 4
> dependencies listed. We need to show the second-level dependency
> information in the layer details page too.
Thank you for pointing out to this. I'll fix it in v2.
--
Regards,
Ed
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-10-01 13:03 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-30 12:02 [PATCH 0/7] Fix 8004 Ed Bartosh
2015-09-30 12:02 ` [PATCH 1/7] toaster: implement API to get full list of deps Ed Bartosh
2015-09-30 12:02 ` [PATCH 2/7] toaster: use get_alldeps in layerdetails renderer Ed Bartosh
2015-09-30 12:02 ` [PATCH 3/7] toaster: add template filter get_alldeps Ed Bartosh
2015-09-30 12:02 ` [PATCH 4/7] toaster: use get_alldeps in LayerTable Ed Bartosh
2015-09-30 12:02 ` [PATCH 5/7] toaster: fix NameError Ed Bartosh
2015-09-30 12:02 ` [PATCH 6/7] toaster: fix orm tests Ed Bartosh
2015-09-30 12:02 ` [PATCH 7/7] toaster: test get_alldeps API Ed Bartosh
2015-10-01 9:39 ` [PATCH 0/7] Fix 8004 Barros Pena, Belen
2015-10-01 13:03 ` Ed Bartosh
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.