All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Wood <michael.g.wood@intel.com>
To: Ed Bartosh <ed.bartosh@linux.intel.com>,
	"toaster@yoctoproject.org" <toaster@yoctoproject.org>
Subject: Re: [PATCH 1/5] toaster: implement API to get full list of deps
Date: Fri, 9 Oct 2015 18:34:26 +0100	[thread overview]
Message-ID: <5617FAA2.6020805@intel.com> (raw)
In-Reply-To: <56154585.3060101@intel.com>

On 07/10/15 17:17, Michael Wood wrote:
> On 01/10/15 14:56, Ed Bartosh wrote:
>> 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")
>
> Sorry for too late review, spotted a regression.
>
> This will cause a regression in the layerdetails page, the API should 
> not be filtering out any layer dependencies that are already added to 
> the project.
>
> - This is already done in the client side logic which is why the 
> context has projectlayers in it
> - The layerdetails page is supposed to list the dependencies for the 
> layer regardless as to whether they have been added or not.
>
> (btw you can do something like this 
> self.dependencies.exclude(depends_on__in=prj.get_project_layer_versions()) 
> if you want a list of the layers it depends on but are not added, 
> rather than iterate through these and create a new list)
>
> As it's been submitted would you be able to write a patch on top to 
> fix this.
>
> Michael

Ah so I might be wrong here, later on in the thread Belen mentioned:

On 01/10/15 16:51, Barros Pena, Belen wrote:
> So both the 'compatible layers' table and the layer details page should
> show the fist-level dependencies for a layer

Which contradicts the bug I was looking at 
https://bugzilla.yoctoproject.org/show_bug.cgi?id=8042
I'll push that bug to you Belen so you can decide what to do.

Thanks,

Michael


  reply	other threads:[~2015-10-09 17:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-01 13:56 [PATCH v2 0/5] Fix for 8004 Ed Bartosh
2015-10-01 13:56 ` [PATCH 1/5] toaster: implement API to get full list of deps Ed Bartosh
2015-10-07 16:17   ` Michael Wood
2015-10-09 17:34     ` Michael Wood [this message]
2015-10-01 13:56 ` [PATCH 2/5] toaster: use get_alldeps in layerdetails renderer Ed Bartosh
2015-10-01 13:56 ` [PATCH 3/5] toaster: fix NameError Ed Bartosh
2015-10-01 13:56 ` [PATCH 4/5] toaster: fix orm tests Ed Bartosh
2015-10-01 13:56 ` [PATCH 5/5] toaster: test get_alldeps API Ed Bartosh
2015-10-01 15:51 ` [PATCH v2 0/5] Fix for 8004 Barros Pena, Belen
2015-10-01 17:56   ` Brian Avery
2015-10-02  9:29     ` Barros Pena, Belen
2015-10-02 18:05       ` Brian Avery
  -- strict thread matches above, loose matches on Subject: below --
2015-10-02 18:05 [PATCH 0/5] toaster:Add layer dependencies recursively #8004 brian avery
2015-10-02 18:05 ` [PATCH 1/5] toaster: implement API to get full list of deps brian avery

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5617FAA2.6020805@intel.com \
    --to=michael.g.wood@intel.com \
    --cc=ed.bartosh@linux.intel.com \
    --cc=toaster@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.