diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2013-11-26 18:12:43 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-12-10 11:16:12 +0000 |
commit | 54d0e30433c249604611367cf387bc20721c4523 (patch) | |
tree | 8f576220f0a4627a763d663089c9ebc0f4b29884 /bitbake | |
parent | f8120984f459d193ce5ffa243137baf0e38d223e (diff) | |
download | poky-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')
-rw-r--r-- | bitbake/lib/bb/ui/buildinfohelper.py | 165 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/toasterui.py | 3 | ||||
-rw-r--r-- | bitbake/lib/toaster/bldviewer/templates/bpackage.html | 6 | ||||
-rw-r--r-- | bitbake/lib/toaster/bldviewer/templates/package.html | 2 | ||||
-rw-r--r-- | bitbake/lib/toaster/bldviewer/views.py | 25 | ||||
-rw-r--r-- | bitbake/lib/toaster/orm/models.py | 50 |
6 files changed, 108 insertions, 143 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index fef849d9a0..0252efdfef 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py | |||
@@ -20,15 +20,16 @@ import datetime | |||
20 | import sys | 20 | import sys |
21 | import bb | 21 | import bb |
22 | import re | 22 | import re |
23 | import ast | ||
23 | 24 | ||
24 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "toaster.toastermain.settings") | 25 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "toaster.toastermain.settings") |
25 | 26 | ||
26 | import toaster.toastermain.settings as toaster_django_settings | 27 | import toaster.toastermain.settings as toaster_django_settings |
27 | from toaster.orm.models import Build, Task, Recipe, Layer_Version, Layer, Target, LogMessage | 28 | from toaster.orm.models import Build, Task, Recipe, Layer_Version, Layer, Target, LogMessage |
28 | from toaster.orm.models import Variable, VariableHistory | 29 | from toaster.orm.models import Variable, VariableHistory |
29 | from toaster.orm.models import Target_Package, Build_Package, Build_File | 30 | from toaster.orm.models import Package, Package_File, Target_Installed_Package |
30 | from toaster.orm.models import Task_Dependency, Build_Package_Dependency | 31 | from toaster.orm.models import Task_Dependency, Package_Dependency |
31 | from toaster.orm.models import Target_Package_Dependency, Recipe_Dependency | 32 | from toaster.orm.models import Recipe_Dependency |
32 | from bb.msg import BBLogFormatter as format | 33 | from bb.msg import BBLogFormatter as format |
33 | 34 | ||
34 | class ORMWrapper(object): | 35 | class ORMWrapper(object): |
@@ -148,21 +149,48 @@ class ORMWrapper(object): | |||
148 | return layer_object[0] | 149 | return layer_object[0] |
149 | 150 | ||
150 | 151 | ||
151 | def save_target_package_information(self, target_obj, packagedict, bldpkgs, recipes): | 152 | def save_target_package_information(self, build_obj, target_obj, packagedict, pkgpnmap, recipes): |
152 | for p in packagedict: | 153 | for p in packagedict: |
153 | packagedict[p]['object'] = Target_Package.objects.create( target = target_obj, | 154 | packagedict[p]['object'], created = Package.objects.get_or_create( build = build_obj, name = p ) |
154 | name = p, | 155 | if created: |
155 | size = packagedict[p]['size']) | 156 | # package was not build in the current build, but |
156 | if p in bldpkgs: | 157 | # fill in everything we can from the runtime-reverse package data |
157 | packagedict[p]['object'].version = bldpkgs[p]['version'] | 158 | try: |
158 | packagedict[p]['object'].recipe = recipes[bldpkgs[p]['pn']] | 159 | packagedict[p]['object'].recipe = recipes[pkgpnmap[p]['PN']] |
159 | packagedict[p]['object'].save() | 160 | packagedict[p]['object'].version = pkgpnmap[p]['PV'] |
161 | packagedict[p]['object'].revision = pkgpnmap[p]['PR'] | ||
162 | packagedict[p]['object'].license = pkgpnmap[p]['LICENSE'] | ||
163 | packagedict[p]['object'].section = pkgpnmap[p]['SECTION'] | ||
164 | packagedict[p]['object'].summary = pkgpnmap[p]['SUMMARY'] | ||
165 | packagedict[p]['object'].description = pkgpnmap[p]['DESCRIPTION'] | ||
166 | packagedict[p]['object'].size = int(pkgpnmap[p]['PKGSIZE']) | ||
167 | |||
168 | # no files recorded for this package, so save files info | ||
169 | for targetpath in pkgpnmap[p]['FILES_INFO']: | ||
170 | targetfilesize = pkgpnmap[p]['FILES_INFO'][targetpath] | ||
171 | Package_File.objects.create( package = packagedict[p]['object'], | ||
172 | path = targetpath, | ||
173 | size = targetfilesize) | ||
174 | except KeyError as e: | ||
175 | print "Key error, package", p, "key", e | ||
176 | |||
177 | # save disk installed size | ||
178 | packagedict[p]['object'].installed_size = packagedict[p]['size'] | ||
179 | packagedict[p]['object'].save() | ||
180 | |||
181 | Target_Installed_Package.objects.create(target = target_obj, package = packagedict[p]['object']) | ||
160 | 182 | ||
161 | for p in packagedict: | 183 | for p in packagedict: |
162 | for (px,deptype) in packagedict[p]['depends']: | 184 | for (px,deptype) in packagedict[p]['depends']: |
163 | Target_Package_Dependency.objects.create( package = packagedict[p]['object'], | 185 | if deptype == 'depends': |
186 | tdeptype = Package_Dependency.TYPE_TRDEPENDS | ||
187 | elif deptype == 'recommends': | ||
188 | tdeptype = Package_Dependency.TYPE_TRECOMMENDS | ||
189 | |||
190 | Package_Dependency.objects.create( package = packagedict[p]['object'], | ||
164 | depends_on = packagedict[px]['object'], | 191 | depends_on = packagedict[px]['object'], |
165 | dep_type = deptype); | 192 | dep_type = tdeptype, |
193 | target = target_obj); | ||
166 | 194 | ||
167 | 195 | ||
168 | def create_logmessage(self, log_information): | 196 | def create_logmessage(self, log_information): |
@@ -180,48 +208,53 @@ class ORMWrapper(object): | |||
180 | 208 | ||
181 | def save_build_package_information(self, build_obj, package_info, recipes): | 209 | def save_build_package_information(self, build_obj, package_info, recipes): |
182 | # create and save the object | 210 | # create and save the object |
183 | bp_object = Build_Package.objects.create( build = build_obj, | 211 | bp_object, created = Package.objects.get_or_create( build = build_obj, |
184 | recipe = recipes[package_info['PN']], | 212 | name = package_info['PKG'] ) |
185 | name = package_info['PKG'], | 213 | |
186 | version = package_info['PKGV'], | 214 | bp_object.recipe = recipes[package_info['PN']] |
187 | revision = package_info['PKGR'], | 215 | bp_object.version = package_info['PKGV'] |
188 | summary = package_info['SUMMARY'], | 216 | bp_object.revision = package_info['PKGR'] |
189 | description = package_info['DESCRIPTION'], | 217 | bp_object.summary = package_info['SUMMARY'] |
190 | size = int(package_info['PKGSIZE']), | 218 | bp_object.description = package_info['DESCRIPTION'] |
191 | section = package_info['SECTION'], | 219 | bp_object.size = int(package_info['PKGSIZE']) |
192 | license = package_info['LICENSE'], | 220 | bp_object.section = package_info['SECTION'] |
193 | ) | 221 | bp_object.license = package_info['LICENSE'] |
222 | bp_object.save() | ||
223 | |||
194 | # save any attached file information | 224 | # save any attached file information |
195 | for path in package_info['FILES_INFO']: | 225 | for path in package_info['FILES_INFO']: |
196 | fo = Build_File.objects.create( bpackage = bp_object, | 226 | fo = Package_File.objects.create( package = bp_object, |
197 | path = path, | 227 | path = path, |
198 | size = package_info['FILES_INFO'][path] ) | 228 | size = package_info['FILES_INFO'][path] ) |
199 | 229 | ||
230 | def _po_byname(p): | ||
231 | return Package.objects.get_or_create(build = build_obj, name = p)[0] | ||
232 | |||
200 | # save soft dependency information | 233 | # save soft dependency information |
201 | if 'RDEPENDS' in package_info and package_info['RDEPENDS']: | 234 | if 'RDEPENDS' in package_info and package_info['RDEPENDS']: |
202 | for p in bb.utils.explode_deps(package_info['RDEPENDS']): | 235 | for p in bb.utils.explode_deps(package_info['RDEPENDS']): |
203 | Build_Package_Dependency.objects.get_or_create( package = bp_object, | 236 | Package_Dependency.objects.get_or_create( package = bp_object, |
204 | depends_on = p, dep_type = Build_Package_Dependency.TYPE_RDEPENDS) | 237 | depends_on = _po_byname(p), dep_type = Package_Dependency.TYPE_RDEPENDS) |
205 | if 'RPROVIDES' in package_info and package_info['RPROVIDES']: | 238 | if 'RPROVIDES' in package_info and package_info['RPROVIDES']: |
206 | for p in bb.utils.explode_deps(package_info['RPROVIDES']): | 239 | for p in bb.utils.explode_deps(package_info['RPROVIDES']): |
207 | Build_Package_Dependency.objects.get_or_create( package = bp_object, | 240 | Package_Dependency.objects.get_or_create( package = bp_object, |
208 | depends_on = p, dep_type = Build_Package_Dependency.TYPE_RPROVIDES) | 241 | depends_on = _po_byname(p), dep_type = Package_Dependency.TYPE_RPROVIDES) |
209 | if 'RRECOMMENDS' in package_info and package_info['RRECOMMENDS']: | 242 | if 'RRECOMMENDS' in package_info and package_info['RRECOMMENDS']: |
210 | for p in bb.utils.explode_deps(package_info['RRECOMMENDS']): | 243 | for p in bb.utils.explode_deps(package_info['RRECOMMENDS']): |
211 | Build_Package_Dependency.objects.get_or_create( package = bp_object, | 244 | Package_Dependency.objects.get_or_create( package = bp_object, |
212 | depends_on = p, dep_type = Build_Package_Dependency.TYPE_RRECOMMENDS) | 245 | depends_on = _po_byname(p), dep_type = Package_Dependency.TYPE_RRECOMMENDS) |
213 | if 'RSUGGESTS' in package_info and package_info['RSUGGESTS']: | 246 | if 'RSUGGESTS' in package_info and package_info['RSUGGESTS']: |
214 | for p in bb.utils.explode_deps(package_info['RSUGGESTS']): | 247 | for p in bb.utils.explode_deps(package_info['RSUGGESTS']): |
215 | Build_Package_Dependency.objects.get_or_create( package = bp_object, | 248 | Package_Dependency.objects.get_or_create( package = bp_object, |
216 | depends_on = p, dep_type = Build_Package_Dependency.TYPE_RSUGGESTS) | 249 | depends_on = _po_byname(p), dep_type = Package_Dependency.TYPE_RSUGGESTS) |
217 | if 'RREPLACES' in package_info and package_info['RREPLACES']: | 250 | if 'RREPLACES' in package_info and package_info['RREPLACES']: |
218 | for p in bb.utils.explode_deps(package_info['RREPLACES']): | 251 | for p in bb.utils.explode_deps(package_info['RREPLACES']): |
219 | Build_Package_Dependency.objects.get_or_create( package = bp_object, | 252 | Package_Dependency.objects.get_or_create( package = bp_object, |
220 | depends_on = p, dep_type = Build_Package_Dependency.TYPE_RREPLACES) | 253 | depends_on = _po_byname(p), dep_type = Package_Dependency.TYPE_RREPLACES) |
221 | if 'RCONFLICTS' in package_info and package_info['RCONFLICTS']: | 254 | if 'RCONFLICTS' in package_info and package_info['RCONFLICTS']: |
222 | for p in bb.utils.explode_deps(package_info['RCONFLICTS']): | 255 | for p in bb.utils.explode_deps(package_info['RCONFLICTS']): |
223 | Build_Package_Dependency.objects.get_or_create( package = bp_object, | 256 | Package_Dependency.objects.get_or_create( package = bp_object, |
224 | depends_on = p, dep_type = Build_Package_Dependency.TYPE_RCONFLICTS) | 257 | depends_on = _po_byname(p), dep_type = Package_Dependency.TYPE_RCONFLICTS) |
225 | 258 | ||
226 | return bp_object | 259 | return bp_object |
227 | 260 | ||
@@ -469,54 +502,13 @@ class BuildInfoHelper(object): | |||
469 | self.orm_wrapper.get_update_task_object(task_information) | 502 | self.orm_wrapper.get_update_task_object(task_information) |
470 | 503 | ||
471 | 504 | ||
472 | def read_target_package_dep_data(self, event): | 505 | def store_target_package_data(self, event): |
473 | # for all targets | 506 | # for all image targets |
474 | for target in self.internal_state['targets']: | 507 | for target in self.internal_state['targets']: |
475 | # verify that we have something to read | 508 | if target.is_image: |
476 | if not target.is_image or not self.has_build_history: | 509 | pkgdata = event.data['pkgdata'] |
477 | print "not collecting package info ", target.is_image, self.has_build_history | 510 | imgdata = event.data['imgdata'][target.target] |
478 | break | 511 | self.orm_wrapper.save_target_package_information(self.internal_state['build'], target, imgdata, pkgdata, self.internal_state['recipes']) |
479 | |||
480 | # TODO this is a temporary replication of the code in buildhistory.bbclass | ||
481 | # This MUST be changed to query the actual BUILD_DIR_IMAGE in the target context when | ||
482 | # the capability will be implemented in Bitbake | ||
483 | |||
484 | MACHINE_ARCH, error = self.server.runCommand(['getVariable', 'MACHINE_ARCH']) | ||
485 | TCLIBC, error = self.server.runCommand(['getVariable', 'TCLIBC']) | ||
486 | BUILDHISTORY_DIR, error = self.server.runCommand(['getVariable', 'BUILDHISTORY_DIR']) | ||
487 | BUILDHISTORY_DIR_IMAGE = "%s/images/%s/%s/%s" % (BUILDHISTORY_DIR, MACHINE_ARCH, TCLIBC, target.target) | ||
488 | |||
489 | self.internal_state['packages'] = {} | ||
490 | |||
491 | with open("%s/installed-package-sizes.txt" % BUILDHISTORY_DIR_IMAGE, "r") as fin: | ||
492 | for line in fin: | ||
493 | line = line.rstrip(";") | ||
494 | psize, px = line.split("\t") | ||
495 | punit, pname = px.split(" ") | ||
496 | self.internal_state['packages'][pname.strip()] = {'size':int(psize)*1024, 'depends' : []} | ||
497 | |||
498 | with open("%s/depends.dot" % BUILDHISTORY_DIR_IMAGE, "r") as fin: | ||
499 | p = re.compile(r' -> ') | ||
500 | dot = re.compile(r'.*style=dotted') | ||
501 | for line in fin: | ||
502 | line = line.rstrip(';') | ||
503 | linesplit = p.split(line) | ||
504 | if len(linesplit) == 2: | ||
505 | pname = linesplit[0].rstrip('"').strip('"') | ||
506 | dependsname = linesplit[1].split(" ")[0].strip().strip(";").strip('"').rstrip('"') | ||
507 | deptype = Target_Package_Dependency.TYPE_DEPENDS | ||
508 | if dot.match(line): | ||
509 | deptype = Target_Package_Dependency.TYPE_RECOMMENDS | ||
510 | if not pname in self.internal_state['packages']: | ||
511 | self.internal_state['packages'][pname] = {'size': 0, 'depends' : []} | ||
512 | if not dependsname in self.internal_state['packages']: | ||
513 | self.internal_state['packages'][dependsname] = {'size': 0, 'depends' : []} | ||
514 | self.internal_state['packages'][pname]['depends'].append((dependsname, deptype)) | ||
515 | |||
516 | self.orm_wrapper.save_target_package_information(target, | ||
517 | self.internal_state['packages'], | ||
518 | self.internal_state['bldpkgs'], self.internal_state['recipes']) | ||
519 | |||
520 | 512 | ||
521 | def store_dependency_information(self, event): | 513 | def store_dependency_information(self, event): |
522 | # save layer version priorities | 514 | # save layer version priorities |
@@ -528,11 +520,6 @@ class BuildInfoHelper(object): | |||
528 | layer_version_obj.priority = priority | 520 | layer_version_obj.priority = priority |
529 | layer_version_obj.save() | 521 | layer_version_obj.save() |
530 | 522 | ||
531 | # save build time package information | ||
532 | self.internal_state['bldpkgs'] = {} | ||
533 | for pkg in event._depgraph['packages']: | ||
534 | self.internal_state['bldpkgs'][pkg] = event._depgraph['packages'][pkg] | ||
535 | |||
536 | # save recipe information | 523 | # save recipe information |
537 | self.internal_state['recipes'] = {} | 524 | self.internal_state['recipes'] = {} |
538 | for pn in event._depgraph['pn']: | 525 | for pn in event._depgraph['pn']: |
diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py index 318fc28adb..e469d93e82 100644 --- a/bitbake/lib/bb/ui/toasterui.py +++ b/bitbake/lib/bb/ui/toasterui.py | |||
@@ -209,7 +209,6 @@ def main(server, eventHandler, params ): | |||
209 | continue | 209 | continue |
210 | 210 | ||
211 | if isinstance(event, (bb.event.BuildCompleted)): | 211 | if isinstance(event, (bb.event.BuildCompleted)): |
212 | buildinfohelper.read_target_package_dep_data(event) | ||
213 | buildinfohelper.update_build_information(event, errors, warnings, taskfailures) | 212 | buildinfohelper.update_build_information(event, errors, warnings, taskfailures) |
214 | continue | 213 | continue |
215 | 214 | ||
@@ -240,6 +239,8 @@ def main(server, eventHandler, params ): | |||
240 | buildinfohelper.store_layer_info(event) | 239 | buildinfohelper.store_layer_info(event) |
241 | if event.type == "BuildStatsList": | 240 | if event.type == "BuildStatsList": |
242 | buildinfohelper.store_tasks_stats(event) | 241 | buildinfohelper.store_tasks_stats(event) |
242 | if event.type == "ImagePkgList": | ||
243 | buildinfohelper.store_target_package_data(event) | ||
243 | continue | 244 | continue |
244 | 245 | ||
245 | # ignore | 246 | # ignore |
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 | ||
21 | from django.db.models import Q | 21 | from django.db.models import Q |
22 | from django.shortcuts import render | 22 | from django.shortcuts import render |
23 | from orm.models import Build, Target, Task, Layer, Layer_Version, Recipe, Target_Package, LogMessage, Variable | 23 | from orm.models import Build, Target, Task, Layer, Layer_Version, Recipe, LogMessage, Variable |
24 | from orm.models import Task_Dependency, Recipe_Dependency, Build_Package, Build_File, Build_Package_Dependency | 24 | from orm.models import Task_Dependency, Recipe_Dependency, Package, Package_File, Package_Dependency |
25 | from orm.models import Target_Installed_Package | ||
25 | from django.views.decorators.cache import cache_control | 26 | from 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 | ||
79 | def bpackage(request, build_id): | 80 | def 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 | ||
85 | def bfile(request, build_id, package_id): | 86 | def 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 | ||
91 | def tpackage(request, build_id, target_id): | 92 | def 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 | ||
100 | def layer(request): | 98 | def 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 | ||
133 | class Build_Package(models.Model): | 133 | class 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 | ||
145 | class Build_Package_Dependency(models.Model): | 146 | class 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 | ||
170 | class Target_Installed_Package(models.Model): | ||
171 | target = models.ForeignKey(Target) | ||
172 | package = models.ForeignKey(Package) | ||
164 | 173 | ||
165 | class Target_Package(models.Model): | 174 | class 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 | |||
173 | class 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 | |||
188 | class 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 | ||
193 | class 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 | |||
199 | class Recipe(models.Model): | 179 | class 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) |