From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 31D66E00461; Mon, 3 Aug 2015 03:26:13 -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.170 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id B3047E00349 for ; Mon, 3 Aug 2015 03:26:08 -0700 (PDT) Received: by wicgj17 with SMTP id gj17so98511095wic.1 for ; Mon, 03 Aug 2015 03:26:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=ZgVNxljEk6WfrGeKFvnRESYd+4RcA/U4ujseiD6xImo=; b=NptIoI6i5T+z26FYj4FA9DseGEoVIEv8oMIPXRgMrKm18HgPxPraTV2yRega94nPLD YNeq/K4PIViQz2Wvv8g5ROxaMqy956GjOu0zwkIsjse3kIoMLBCWo/WhgQky2LvAnqIW bAib7tFTbQ63tfpyaK+aVqTW5uZIIck7pQoVHYHxDM3Snbov/2mI5lj4adsTDs13recp MaiH23M99NOXjy5jZs3AUBU1WzzW1MW2t7xJn3MHf6ZeTRo9dHF2yvxKfy5axUcU4MZ2 MBJUml5+t2sQ1Jy9gk9G6MRDFvYl0DinO98DRxNkQwaS1ed+xe+7XJk1S4fhpdBqOg6b pfWQ== X-Gm-Message-State: ALoCoQnUpXu8314y8Y4Px8SG3UQNhWydyibrmzeA7E8Ekm9iYogAWoOU0c+foaV1NfICDXbWu2lb X-Received: by 10.180.84.194 with SMTP id b2mr32654946wiz.24.1438597567856; Mon, 03 Aug 2015 03:26:07 -0700 (PDT) Received: from [192.168.2.72] ([83.217.123.106]) by smtp.googlemail.com with ESMTPSA id gc4sm12809880wib.23.2015.08.03.03.26.05 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Aug 2015 03:26:06 -0700 (PDT) Message-ID: <55BF41BD.5000500@intel.com> Date: Mon, 03 Aug 2015 11:26:05 +0100 From: Michael Wood User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: sujith h References: <55B6312D.1000801@intel.com> <55B7CF14.7000409@intel.com> In-Reply-To: Cc: toaster@yoctoproject.org Subject: Re: Usage of already cloned layers in toaster 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: Mon, 03 Aug 2015 10:26:13 -0000 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 31/07/15 14:06, sujith h wrote: > > > On Wed, Jul 29, 2015 at 8:09 PM, sujith h > wrote: > > > > On Wed, Jul 29, 2015 at 12:21 AM, Michael Wood > > wrote: > > On 27/07/15 16:23, sujith h wrote: > > > > On Mon, Jul 27, 2015 at 6:55 PM, Michael Wood > > >> wrote: > > On 27/07/15 11:31, sujith h wrote: > > > > On Mon, Jul 27, 2015 at 3:39 PM, Barros Pena, Belen > > > > > >>> wrote: > > > > On 27/07/2015 07:54, "sujith h" > > > > >>> > wrote: > > > > > > >On Fri, Jul 24, 2015 at 6:36 PM, Barros Pena, > Belen > > > > > > >>> wrote: > > > > > > > >On 24/07/2015 13:57, "sujith h" > > > > >>> > > wrote: > > > > > >* Which version of Yocto Project you are > using (fido or > master)? > > > >I am using fido branch. > > > > > >* Which release you have selected for your > project? > > > > > >In the release I have selected "Local Yocto > Project" > > > > > >* If you click the "view all compatible > layers" link and > in that > page you > >search for meta-oe, do you get any results? > > > >I can see only "meta-yocto-bsp", "meta-yocto" and > "openembedded-core". > >Attached screenshot of the same. > > > > > >Also attaching screenshot of page where I try > to import > meta-oe > from my > >locally cloned location. > > > > > >Below is the file structure I have: > > > >sujith@kdekid:~/MEL/homework$ pwd > >/home/sujith/MEL/homework > >sujith@kdekid:~/MEL/homework$ ls -l > >total 5180 > >drwxrwxr-x 19 sujith sujith 4096 Jun 12 18:40 > meta-oe-local > >drwxrwxr-x 19 sujith sujith 4096 Jul 24 18:04 > meta-openembedded-local > >drwxrwxr-x 8 sujith sujith 4096 Jul 24 18:02 > meta-qt5-local > >drwxrwxr-x 11 sujith sujith 4096 Jul 27 > 12:07 poky > >drwxrwxr-x 2 sujith sujith 4096 Jul 27 12:08 > toaster_build_artifacts > >-rw-r--r-- 1 sujith sujith 5277696 Jul 27 12:19 > toaster.sqlite > >drwxrwxr-x 6 sujith sujith 4096 Jul 24 > 16:25 venv > >sujith@kdekid:~/MEL/homework$ > > > > Right, I've managed to reproduce this. Looking > at the browser > console, it > might be a problem with the javascript doing > the layer name > validation. If > you change the layer name to something > completely random > that does not > exist in the Toaster database (something like > meta-xyz), > can you > import > the layer? > > > Am bit new to the web world. So I gave a try with > firebug to > debug which script ( Javascript or any ) call happens > when I click "Import and add to project" button. > Even after > changing meta-oe repo to meta-xyz as per suggestion, > the result remains same. But this is the output I > see in the > firebug console: > |{"current_id": 5, "current_url": > "git://git.openembedded.org/meta-openembedded > > > ", > "error": > "hint-layer-exists-with-different-url"||}| > hint-layer-exists-with-different-url > > Also attaching the screenshot of the same ( to get > more clarity ). > > > Thanks for this, I noticed this wasn't working > properly last week, > and rolled a couple of patches to fix these regressions. > > > http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/commit/?h=michaelw/toaster/wip-nav-project-changes&id=0181c56dd608427c0a7bd986df75bf7a1189e064 > > and > > > http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/commit/?h=michaelw/toaster/wip-nav-project-changes&id=aa5b023f03f5465ea22318a1f21199ce434eb700 > > I have a few other things to fix on this branch as I > have been > fixing a number of things to allow me to test the new > project > page, I'm intending to roll a separate branch for > review on it. > > You've highlighted that we need a unit test which does > a layer > import using the back end API calls, which although it > wouldn't > have caught this error would be really good to have, > if you're > interested in helping with that? > > > It would be my pleasure to help :) I might need some > assistance as I am learning Django. May be some hint like > where to start with or so. > > > This is the best place to start > https://docs.djangoproject.com/en/1.6/topics/testing/overview/ > > In ./bitbake > /lib > /toaster > /toastergui > /tests.py > > > We can add something like > > class ImportLayerTestCase(|ProvisionedLayersProjectTestCase|): > .... > ... > def test_import_layer(self): > client.post(reverse('xhr_importlayer',..... > > ... > > We can then use the JSON response from the client to help > validate the data coming back as well as checking the import > layer actually entered the database. > > There are a few examples in the yocto error-report-web project > too that might be useful to look at e.g. > http://git.yoctoproject.org/cgit/cgit.cgi/error-report-web/tree/Post/test.py#n153 > > > You can run the test by doing running ./manage.py test toastergui > > > Thank you Michael for such a detailed step to follow. I have > started reading the docs from django mentioned in the link and the > reference mentioned in the mail. > > > I wrote a small piece of code in > bitbake/lib/toaster/toastergui/tests.py. Below is the code ( since I > have written a small code, I thought to share here. Kindly let me know > if there is any problem sharing small code in the mailing list ): > ---------- > from django.test import TestCase > from django.test.client import Client > from django.core.urlresolvers import reverse > import json > > > class ImportLayerTestCase(TestCase): > def test_import_layers(self): > client = Client() > json_string = json.dumps({'name':'meta-oe', > 'vcs-url':'/home/sujith/MEL/homework/meta-xyz', > 'git_ref':'c12b9596afd236116b25ce26dbe0d793de9dc7ce', > 'dir_path':'/home/sujith/MEL/homework/meta-xyz/meta-oe', > 'project_id':'1', 'layer_deps':'1'}) > response = client.post(reverse('xhr_importlayer'), > {'data':json_string}, > 'json', > HTTP_X_REQUESTED_WITH='XMLHttpRequest') > ------------- > > Let me know if I am in the right track. After following your mail and > bit of google, helped me in writing this code. My query here is when I > try to print response, it prints an html as follows: --8<-- Yep that's a good start, we currently don't actually pass IN a JSON document for the import layers call, it's just a bunch of parameters in the POST request. So instead of > json_string = json.dumps({'name':'meta-oe', you can do: data = {'name':'meta-oe', and then: response = client.post(reverse('xhr_importlayer', args(1,)), data, etc Looking at that response I'm wondering if you are you using current master branch? It seems to be showing the old response to that request where you haven't enabled build mode (which is enabled by default in current master). The response should be a JSON response where you have the returned state in it e.g. { "error" : "hint-layer-exists" } We can then parse this and test the various conditions are correct based on the data we sent it. Thanks, Michael