summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2013-11-26 18:12:43 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-12-10 11:16:12 +0000
commit54d0e30433c249604611367cf387bc20721c4523 (patch)
tree8f576220f0a4627a763d663089c9ebc0f4b29884 /bitbake/lib/toaster
parentf8120984f459d193ce5ffa243137baf0e38d223e (diff)
downloadpoky-54d0e30433c249604611367cf387bc20721c4523.tar.gz
bitbake: toaster: change package storage model
Up until this patch, package information lived in two places - one table for build packages and one table for target installed packaged. This situation leads to two problems: there is no direct link between a build package and a installed package, and a lot of data is duplicated. This change unifies all package types in a single table. The SimpleUI remains the same for continuity sake, but the REST API will be changed in a future patch. The package dependencies and package files are now kept in a single table. Since we collect target installed package information at all times, we need to expand it to supplement missing information if a package is not actually built in the current build. Small changes to the Simple UI reflect the updated database schema. [YOCTO #5565] [YOCTO #5269] (Bitbake rev: f5d655bfaeb349c8680d74530617e34aa389d1f0) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster')
-rw-r--r--bitbake/lib/toaster/bldviewer/templates/bpackage.html6
-rw-r--r--bitbake/lib/toaster/bldviewer/templates/package.html2
-rw-r--r--bitbake/lib/toaster/bldviewer/views.py25
-rw-r--r--bitbake/lib/toaster/orm/models.py50
4 files changed, 30 insertions, 53 deletions
diff --git a/bitbake/lib/toaster/bldviewer/templates/bpackage.html b/bitbake/lib/toaster/bldviewer/templates/bpackage.html
index 4e6d9c6778..ca092ca6a0 100644
--- a/bitbake/lib/toaster/bldviewer/templates/bpackage.html
+++ b/bitbake/lib/toaster/bldviewer/templates/bpackage.html
@@ -23,7 +23,7 @@
23 <tr class="data"> 23 <tr class="data">
24 <td><a name="#{{package.name}}" href="{% url bfile build.pk package.pk %}">{{package.name}} ({{package.filelist_bpackage.count}} files)</a></td> 24 <td><a name="#{{package.name}}" href="{% url bfile build.pk package.pk %}">{{package.name}} ({{package.filelist_bpackage.count}} files)</a></td>
25 <td>{{package.version}}-{{package.revision}}</td> 25 <td>{{package.version}}-{{package.revision}}</td>
26 <td><a href="{% url layer_versions_recipes package.recipe.layer_version_id %}#{{package.recipe.name}}">{{package.recipe.name}}</a>{{package.package_name}}</a></td> 26 <td>{%if package.recipe%}<a href="{% url "layer_versions_recipes" package.recipe.layer_version_id %}#{{package.recipe.name}}">{{package.recipe.name}}</a>{{package.package_name}}</a>{%endif%}</td>
27 27
28 <td>{{package.summary}}</td> 28 <td>{{package.summary}}</td>
29 <td>{{package.section}}</td> 29 <td>{{package.section}}</td>
@@ -32,8 +32,8 @@
32 <td>{{package.license}}</td> 32 <td>{{package.license}}</td>
33 <td> 33 <td>
34 <div style="height: 3em; overflow:auto"> 34 <div style="height: 3em; overflow:auto">
35 {% for bpd in package.bpackage_dependencies_package.all %} 35 {% for bpd in package.package_dependencies_source.all %}
36 {{bpd.dep_type}}: {{bpd.depends_on}} <br/> 36 {{bpd.dep_type}}: {{bpd.depends_on.name}} <br/>
37 {% endfor %} 37 {% endfor %}
38 </div> 38 </div>
39 </td> 39 </td>
diff --git a/bitbake/lib/toaster/bldviewer/templates/package.html b/bitbake/lib/toaster/bldviewer/templates/package.html
index c22e988e95..b1246e788a 100644
--- a/bitbake/lib/toaster/bldviewer/templates/package.html
+++ b/bitbake/lib/toaster/bldviewer/templates/package.html
@@ -23,7 +23,7 @@
23 <a href="{% url layer_versions_recipes package.recipe.layer_version_id %}#{{package.recipe.name}}">{{package.recipe.name}}</a>{{package.package_name}}</a>{%endif%}</td> 23 <a href="{% url layer_versions_recipes package.recipe.layer_version_id %}#{{package.recipe.name}}">{{package.recipe.name}}</a>{{package.package_name}}</a>{%endif%}</td>
24 <td> 24 <td>
25 <div style="height: 4em; overflow:auto"> 25 <div style="height: 4em; overflow:auto">
26 {% for d in package.tpackage_dependencies_package.all %} 26 {% for d in package.package_dependencies_source.all %}
27 <a href="#{{d.name}}">{{d.depends_on.name}}</a><br/> 27 <a href="#{{d.name}}">{{d.depends_on.name}}</a><br/>
28 {% endfor %} 28 {% endfor %}
29 </div> 29 </div>
diff --git a/bitbake/lib/toaster/bldviewer/views.py b/bitbake/lib/toaster/bldviewer/views.py
index 7be4d4b899..3eb785b6c6 100644
--- a/bitbake/lib/toaster/bldviewer/views.py
+++ b/bitbake/lib/toaster/bldviewer/views.py
@@ -20,8 +20,9 @@ import operator
20 20
21from django.db.models import Q 21from django.db.models import Q
22from django.shortcuts import render 22from django.shortcuts import render
23from orm.models import Build, Target, Task, Layer, Layer_Version, Recipe, Target_Package, LogMessage, Variable 23from orm.models import Build, Target, Task, Layer, Layer_Version, Recipe, LogMessage, Variable
24from orm.models import Task_Dependency, Recipe_Dependency, Build_Package, Build_File, Build_Package_Dependency 24from orm.models import Task_Dependency, Recipe_Dependency, Package, Package_File, Package_Dependency
25from orm.models import Target_Installed_Package
25from django.views.decorators.cache import cache_control 26from django.views.decorators.cache import cache_control
26 27
27@cache_control(no_store=True) 28@cache_control(no_store=True)
@@ -78,23 +79,20 @@ def configuration(request, build_id):
78 79
79def bpackage(request, build_id): 80def bpackage(request, build_id):
80 template = 'bpackage.html' 81 template = 'bpackage.html'
81 packages = Build_Package.objects.filter(build = build_id) 82 packages = Package.objects.filter(build = build_id)
82 context = {'build': Build.objects.filter(pk=build_id)[0], 'packages' : packages} 83 context = {'build': Build.objects.filter(pk=build_id)[0], 'packages' : packages}
83 return render(request, template, context) 84 return render(request, template, context)
84 85
85def bfile(request, build_id, package_id): 86def bfile(request, build_id, package_id):
86 template = 'bfile.html' 87 template = 'bfile.html'
87 files = Build_File.objects.filter(bpackage = package_id) 88 files = Package_File.objects.filter(package = package_id)
88 context = {'build': Build.objects.filter(pk=build_id)[0], 'files' : files} 89 context = {'build': Build.objects.filter(pk=build_id)[0], 'files' : files}
89 return render(request, template, context) 90 return render(request, template, context)
90 91
91def tpackage(request, build_id, target_id): 92def tpackage(request, build_id, target_id):
92 template = 'package.html' 93 template = 'package.html'
93 94 packages = map(lambda x: x.package, list(Target_Installed_Package.objects.filter(target=target_id)))
94 packages = Target_Package.objects.filter(target=target_id) 95 context = {'build': Build.objects.filter(pk=build_id)[0], 'packages' : packages}
95
96 context = {'build' : Build.objects.filter(pk=build_id)[0],'packages': packages}
97
98 return render(request, template, context) 96 return render(request, template, context)
99 97
100def layer(request): 98def layer(request):
@@ -135,17 +133,16 @@ def model_explorer(request, model_name):
135 model_mapping = { 133 model_mapping = {
136 'build': Build, 134 'build': Build,
137 'target': Target, 135 'target': Target,
138 'target_package': Target_Package,
139 'task': Task, 136 'task': Task,
140 'task_dependency': Task_Dependency, 137 'task_dependency': Task_Dependency,
141 'package': Build_Package, 138 'package': Package,
142 'layer': Layer, 139 'layer': Layer,
143 'layerversion': Layer_Version, 140 'layerversion': Layer_Version,
144 'recipe': Recipe, 141 'recipe': Recipe,
145 'recipe_dependency': Recipe_Dependency, 142 'recipe_dependency': Recipe_Dependency,
146 'build_package': Build_Package, 143 'package': Package,
147 'build_package_dependency': Build_Package_Dependency, 144 'package_dependency': Package_Dependency,
148 'build_file': Build_File, 145 'build_file': Package_File,
149 'variable': Variable, 146 'variable': Variable,
150 'logmessage': LogMessage, 147 'logmessage': LogMessage,
151 } 148 }
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 0bb048c756..b30e405c0e 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -130,7 +130,7 @@ class Task_Dependency(models.Model):
130 depends_on = models.ForeignKey(Task, related_name='task_dependencies_depends') 130 depends_on = models.ForeignKey(Task, related_name='task_dependencies_depends')
131 131
132 132
133class Build_Package(models.Model): 133class Package(models.Model):
134 build = models.ForeignKey('Build') 134 build = models.ForeignKey('Build')
135 recipe = models.ForeignKey('Recipe', null=True) 135 recipe = models.ForeignKey('Recipe', null=True)
136 name = models.CharField(max_length=100) 136 name = models.CharField(max_length=100)
@@ -139,16 +139,19 @@ class Build_Package(models.Model):
139 summary = models.CharField(max_length=200, blank=True) 139 summary = models.CharField(max_length=200, blank=True)
140 description = models.CharField(max_length=200, blank=True) 140 description = models.CharField(max_length=200, blank=True)
141 size = models.IntegerField(default=0) 141 size = models.IntegerField(default=0)
142 installed_size = models.IntegerField(default=0)
142 section = models.CharField(max_length=80, blank=True) 143 section = models.CharField(max_length=80, blank=True)
143 license = models.CharField(max_length=80, blank=True) 144 license = models.CharField(max_length=80, blank=True)
144 145
145class Build_Package_Dependency(models.Model): 146class Package_Dependency(models.Model):
146 TYPE_RDEPENDS = 0 147 TYPE_RDEPENDS = 0
147 TYPE_RPROVIDES = 1 148 TYPE_RPROVIDES = 1
148 TYPE_RRECOMMENDS = 2 149 TYPE_RRECOMMENDS = 2
149 TYPE_RSUGGESTS = 3 150 TYPE_RSUGGESTS = 3
150 TYPE_RREPLACES = 4 151 TYPE_RREPLACES = 4
151 TYPE_RCONFLICTS = 5 152 TYPE_RCONFLICTS = 5
153 TYPE_TRDEPENDS = 6
154 TYPE_TRECOMMENDS = 7
152 DEPENDS_TYPE = ( 155 DEPENDS_TYPE = (
153 (TYPE_RDEPENDS, "rdepends"), 156 (TYPE_RDEPENDS, "rdepends"),
154 (TYPE_RPROVIDES, "rprovides"), 157 (TYPE_RPROVIDES, "rprovides"),
@@ -156,46 +159,23 @@ class Build_Package_Dependency(models.Model):
156 (TYPE_RSUGGESTS, "rsuggests"), 159 (TYPE_RSUGGESTS, "rsuggests"),
157 (TYPE_RREPLACES, "rreplaces"), 160 (TYPE_RREPLACES, "rreplaces"),
158 (TYPE_RCONFLICTS, "rconflicts"), 161 (TYPE_RCONFLICTS, "rconflicts"),
162 (TYPE_TRDEPENDS, "trdepends"),
163 (TYPE_TRECOMMENDS, "trecommends"),
159 ) 164 )
160 package = models.ForeignKey(Build_Package, related_name='bpackage_dependencies_package') 165 package = models.ForeignKey(Package, related_name='package_dependencies_source')
161 depends_on = models.CharField(max_length=100) # soft dependency 166 depends_on = models.ForeignKey(Package, related_name='package_dependencies_target') # soft dependency
162 dep_type = models.IntegerField(choices=DEPENDS_TYPE) 167 dep_type = models.IntegerField(choices=DEPENDS_TYPE)
168 target = models.ForeignKey(Target, null=True)
163 169
170class Target_Installed_Package(models.Model):
171 target = models.ForeignKey(Target)
172 package = models.ForeignKey(Package)
164 173
165class Target_Package(models.Model): 174class Package_File(models.Model):
166 target = models.ForeignKey('Target') 175 package = models.ForeignKey(Package, related_name='buildfilelist_package')
167 recipe = models.ForeignKey('Recipe', null=True)
168 name = models.CharField(max_length=100)
169 version = models.CharField(max_length=100, blank=True)
170 size = models.IntegerField()
171
172
173class Target_Package_Dependency(models.Model):
174 TYPE_DEPENDS = 0
175 TYPE_RDEPENDS = 1
176 TYPE_RECOMMENDS = 2
177
178 DEPENDS_TYPE = (
179 (TYPE_DEPENDS, "depends"),
180 (TYPE_RDEPENDS, "rdepends"),
181 (TYPE_RECOMMENDS, "recommends"),
182 )
183 package = models.ForeignKey(Target_Package, related_name='tpackage_dependencies_package')
184 depends_on = models.ForeignKey(Target_Package, related_name='tpackage_dependencies_depends')
185 dep_type = models.IntegerField(choices=DEPENDS_TYPE)
186
187
188class Build_File(models.Model):
189 bpackage = models.ForeignKey(Build_Package, related_name='filelist_bpackage')
190 path = models.FilePathField(max_length=255, blank=True) 176 path = models.FilePathField(max_length=255, blank=True)
191 size = models.IntegerField() 177 size = models.IntegerField()
192 178
193class Target_File(models.Model):
194 tpackage = models.ForeignKey(Target_Package, related_name='filelist_tpackage')
195 path = models.FilePathField(max_length=255, blank=True)
196 size = models.IntegerField()
197
198
199class Recipe(models.Model): 179class Recipe(models.Model):
200 name = models.CharField(max_length=100, blank=True) 180 name = models.CharField(max_length=100, blank=True)
201 version = models.CharField(max_length=100, blank=True) 181 version = models.CharField(max_length=100, blank=True)