From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 7FAE2E00C3A; Fri, 9 Oct 2015 10:34:30 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [209.85.212.182 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 11C52E00ADB for ; Fri, 9 Oct 2015 10:34:28 -0700 (PDT) Received: by wicge5 with SMTP id ge5so77890103wic.0 for ; Fri, 09 Oct 2015 10:34:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=k8UbVY7SndBrz7ywsPawasST+Nq8PUtLgpAvXZTtLFc=; b=R6HIuMlZNwA24QsqaELgx7z+QjRnrEXJjFCnN/1YQdelqVO+jbhhK+bHRVC14+weFT ZY19xQYHmbL7ajWnLNor+PrF2z8FOye9fvKfyQVQD13C4naaR3rS2I+SX9x4VxYHJA2D aRxCCJjza/EipUMvo0Jpl+CzYOMa8l3wjsQgVPzicqfN4OzSbNYe9GOtVB2Wgc40G7cV UlIiYFxlNH+xNV9cW6saIgO/SjC0aSH+WKVejDaF6+PX4YuE1K4WHFH2uhyVqDoH9BkI AEuvY3H3f9D35EWUOOCn4wjGDXF+VfSZRavZiwSsV+xLYvKeaZAD7YE0e0ifo5KGsnni eHqg== X-Gm-Message-State: ALoCoQm2tFnkxd/RsuiUuNjrL/zudyY0KwgF4D3MvG/Vf604h7q0AdyQsHZXVvHxLYbthOhbkSFX X-Received: by 10.194.171.3 with SMTP id aq3mr16017589wjc.54.1444412067741; Fri, 09 Oct 2015 10:34:27 -0700 (PDT) Received: from [192.168.0.22] ([2.218.205.118]) by smtp.googlemail.com with ESMTPSA id uq5sm3315726wjc.3.2015.10.09.10.34.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Oct 2015 10:34:27 -0700 (PDT) To: Ed Bartosh , "toaster@yoctoproject.org" References: <3bc71fb705081ed2a00819f76720f985ca5cc223.1443707344.git.ed.bartosh@linux.intel.com> <56154585.3060101@intel.com> From: Michael Wood Message-ID: <5617FAA2.6020805@intel.com> Date: Fri, 9 Oct 2015 18:34:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <56154585.3060101@intel.com> Subject: Re: [PATCH 1/5] toaster: implement API to get full list of deps X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Oct 2015 17:34:30 -0000 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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 >> --- >> 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