diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2015-05-14 16:10:50 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-05-29 11:59:43 +0100 |
commit | e3e85bdf7100cc5619d7f184dc8d9e2a77a03364 (patch) | |
tree | a3dcc4abf6973288c0001e7498f8270d6fccdb7e /bitbake/lib/toaster/orm/models.py | |
parent | a5236be47fd62d41eaea2d4b4f1a394de0aac4a9 (diff) | |
download | poky-e3e85bdf7100cc5619d7f184dc8d9e2a77a03364.tar.gz |
bitbake: toaster logger: refactor recipe and layer file paths
This refactoring brings the "local_path" of the
layer from the Layer object to the Layer_Version object, which
is more appropriate as different checkouts of the same
Layer may live in different directories.
This enables us to store Recipe file paths relative to a Layer_Version
at all times, aleviating the need to store full file paths in the
database. We also turn the prefix of the path (e.g. virtual:native
path name space) into a pathflag field.
In turn, this solves the problem of mis-identification of tasks based
on the recipe file paths, since we can also match the namespace of the
file paths on the recipe files.
[YOCTO #7594]
(Bitbake rev: ec43dc569e370767c709dec225cbee0c99151c19)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/orm/models.py')
-rw-r--r-- | bitbake/lib/toaster/orm/models.py | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index 20b02bbbb3..29ede657c8 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py | |||
@@ -457,7 +457,7 @@ class Task_Dependency(models.Model): | |||
457 | depends_on = models.ForeignKey(Task, related_name='task_dependencies_depends') | 457 | depends_on = models.ForeignKey(Task, related_name='task_dependencies_depends') |
458 | 458 | ||
459 | class Package(models.Model): | 459 | class Package(models.Model): |
460 | search_allowed_fields = ['name', 'version', 'revision', 'recipe__name', 'recipe__version', 'recipe__license', 'recipe__layer_version__layer__name', 'recipe__layer_version__branch', 'recipe__layer_version__commit', 'recipe__layer_version__layer__local_path', 'installed_name'] | 460 | search_allowed_fields = ['name', 'version', 'revision', 'recipe__name', 'recipe__version', 'recipe__license', 'recipe__layer_version__layer__name', 'recipe__layer_version__branch', 'recipe__layer_version__commit', 'recipe__layer_version__local_path', 'installed_name'] |
461 | build = models.ForeignKey('Build') | 461 | build = models.ForeignKey('Build') |
462 | recipe = models.ForeignKey('Recipe', null=True) | 462 | recipe = models.ForeignKey('Recipe', null=True) |
463 | name = models.CharField(max_length=100) | 463 | name = models.CharField(max_length=100) |
@@ -528,7 +528,7 @@ class Package_File(models.Model): | |||
528 | size = models.IntegerField() | 528 | size = models.IntegerField() |
529 | 529 | ||
530 | class Recipe(models.Model): | 530 | class Recipe(models.Model): |
531 | search_allowed_fields = ['name', 'version', 'file_path', 'section', 'summary', 'description', 'license', 'layer_version__layer__name', 'layer_version__branch', 'layer_version__commit', 'layer_version__layer__local_path', 'layer_version__layer_source__name'] | 531 | search_allowed_fields = ['name', 'version', 'file_path', 'section', 'summary', 'description', 'license', 'layer_version__layer__name', 'layer_version__branch', 'layer_version__commit', 'layer_version__local_path', 'layer_version__layer_source__name'] |
532 | 532 | ||
533 | layer_source = models.ForeignKey('LayerSource', default = None, null = True) # from where did we get this recipe | 533 | layer_source = models.ForeignKey('LayerSource', default = None, null = True) # from where did we get this recipe |
534 | up_id = models.IntegerField(null = True, default = None) # id of entry in the source | 534 | up_id = models.IntegerField(null = True, default = None) # id of entry in the source |
@@ -544,6 +544,7 @@ class Recipe(models.Model): | |||
544 | homepage = models.URLField(blank=True) | 544 | homepage = models.URLField(blank=True) |
545 | bugtracker = models.URLField(blank=True) | 545 | bugtracker = models.URLField(blank=True) |
546 | file_path = models.FilePathField(max_length=255) | 546 | file_path = models.FilePathField(max_length=255) |
547 | pathflags = models.CharField(max_length=200, blank=True) | ||
547 | 548 | ||
548 | def get_layersource_view_url(self): | 549 | def get_layersource_view_url(self): |
549 | if self.layer_source is None: | 550 | if self.layer_source is None: |
@@ -555,18 +556,6 @@ class Recipe(models.Model): | |||
555 | def __unicode__(self): | 556 | def __unicode__(self): |
556 | return "Recipe " + self.name + ":" + self.version | 557 | return "Recipe " + self.name + ":" + self.version |
557 | 558 | ||
558 | def get_local_path(self): | ||
559 | if settings.MANAGED and self.layer_version.build is not None and self.layer_version.build.project is not None: | ||
560 | # strip any tag prefixes ('virtual:native:') | ||
561 | layer_path=self.layer_version.layer.local_path.split(":")[-1] | ||
562 | recipe_path=self.file_path.split(":")[-1] | ||
563 | if 0 == recipe_path.find(layer_path): | ||
564 | return recipe_path[len(layer_path)+1:] | ||
565 | else: | ||
566 | return recipe_path | ||
567 | |||
568 | return self.file_path | ||
569 | |||
570 | def get_vcs_recipe_file_link_url(self): | 559 | def get_vcs_recipe_file_link_url(self): |
571 | return self.layer_version.get_vcs_file_link_url(self.file_path) | 560 | return self.layer_version.get_vcs_file_link_url(self.file_path) |
572 | 561 | ||
@@ -579,7 +568,8 @@ class Recipe(models.Model): | |||
579 | return "" | 568 | return "" |
580 | 569 | ||
581 | class Meta: | 570 | class Meta: |
582 | unique_together = ("layer_version", "file_path") | 571 | unique_together = (("layer_version", "file_path", "pathflags"), ) |
572 | |||
583 | 573 | ||
584 | class Recipe_DependencyManager(models.Manager): | 574 | class Recipe_DependencyManager(models.Manager): |
585 | use_for_related_fields = True | 575 | use_for_related_fields = True |
@@ -976,7 +966,6 @@ class Layer(models.Model): | |||
976 | up_date = models.DateTimeField(null = True, default = None) | 966 | up_date = models.DateTimeField(null = True, default = None) |
977 | 967 | ||
978 | name = models.CharField(max_length=100) | 968 | name = models.CharField(max_length=100) |
979 | local_path = models.FilePathField(max_length=255, null = True, default = None) | ||
980 | layer_index_url = models.URLField() | 969 | layer_index_url = models.URLField() |
981 | vcs_url = GitURLField(default = None, null = True) | 970 | vcs_url = GitURLField(default = None, null = True) |
982 | vcs_web_url = models.URLField(null = True, default = None) | 971 | vcs_web_url = models.URLField(null = True, default = None) |
@@ -1009,6 +998,8 @@ class Layer_Version(models.Model): | |||
1009 | dirpath = models.CharField(max_length=255, null = True, default = None) # LayerBranch.vcs_subdir | 998 | dirpath = models.CharField(max_length=255, null = True, default = None) # LayerBranch.vcs_subdir |
1010 | priority = models.IntegerField(default = 0) # if -1, this is a default layer | 999 | priority = models.IntegerField(default = 0) # if -1, this is a default layer |
1011 | 1000 | ||
1001 | local_path = models.FilePathField(max_length=1024, default = "/") # where this layer was checked-out | ||
1002 | |||
1012 | project = models.ForeignKey('Project', null = True, default = None) # Set if this layer is project-specific; always set for imported layers, and project-set branches | 1003 | project = models.ForeignKey('Project', null = True, default = None) # Set if this layer is project-specific; always set for imported layers, and project-set branches |
1013 | 1004 | ||
1014 | # code lifted, with adaptations, from the layerindex-web application https://git.yoctoproject.org/cgit/cgit.cgi/layerindex-web/ | 1005 | # code lifted, with adaptations, from the layerindex-web application https://git.yoctoproject.org/cgit/cgit.cgi/layerindex-web/ |