Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id A7A01E009AA; Wed, 20 Jul 2016 06:48:24 -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,DKIM_SIGNED, DKIM_VALID,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 * [74.125.82.41 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 34549E00951 for ; Wed, 20 Jul 2016 06:48:18 -0700 (PDT) Received: by mail-wm0-f41.google.com with SMTP id f65so176573273wmi.0 for ; Wed, 20 Jul 2016 06:48:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=g0+JGl/eA8wuhWpxfjqJLBo9ixCgx98vHwnDmQjAPus=; b=fy5Oyt0I9hh+CLgWgXOXFjy3zaZZOsmZgjzeHaOrxhB1JZZ+PshzbV7sGh0S4x94wi o6apGXtSkHlu98ixZauKC1MVBCoLIfPwE26OTMz63KndUnJk53WGdZfqd5C1rEPFdRi9 vB0xIJDVuoCQddY0IyHjvD4rPBUxioAlv8P0DxzKtlMtWjVYepE0FG2wo8DLDweJloUs hnxggtCnchH5kMgDVFmAjDSXf1TVyfCv5hRngjJXHf81LxEGGc5LoLzRLrd2G4mHGHAA jY7AAmp0vDmYR2hsfQs8IXGrn2Bc0jjXGa5utHv91WIdvfD7ea5+ZsgisB+SyBWCX/RA JNSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=g0+JGl/eA8wuhWpxfjqJLBo9ixCgx98vHwnDmQjAPus=; b=bKlKeZRO68ceqFAOuU3YDdeyZCHDW+A6kW0a7zn0ZzqbqMPuGFgpfn4pQWcQuCfEw8 Feec/IO/bszGecCw1oIPtydhRSTPJtKzuOJXxTyfsO7jAYAMyqVbCWZK5Y9k4bl6O0pY pufw+SPH41pTUFQXy7NaHQgHLrI4EG0DPgr77jOO7zXxuXZ8OhjMgp9n1iw3vnCXUXsK H/81gufCvgJq6uDKgexy0PwX+/uQZij78eaAciDokMtY9nhg8BKbxdpc/7kfGuR5IJjS 2zaBV7+bVlh0UsuxkApw2yy7x27ZfoAIBA+78HMh+Rr83XS8+9EmwWKD9Cuy9K6/JpZc NyYQ== X-Gm-Message-State: ALyK8tJW5aNgnVWs6Fu5pAWmEOE5hGrFSR0EpWGTUqHAazg30gPBbchUPg565Xd/xDssDp/p X-Received: by 10.28.69.203 with SMTP id l72mr10941054wmi.51.1469022497099; Wed, 20 Jul 2016 06:48:17 -0700 (PDT) Received: from localhost.localdomain (host109-153-40-30.range109-153.btcentralplus.com. [109.153.40.30]) by smtp.gmail.com with ESMTPSA id d64sm5206662wmc.22.2016.07.20.06.48.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Jul 2016 06:48:16 -0700 (PDT) From: Michael Wood To: toaster@yoctoproject.org Date: Wed, 20 Jul 2016 14:48:03 +0100 Message-Id: <1469022492-19823-2-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1469022492-19823-1-git-send-email-michael.g.wood@intel.com> References: <1469022492-19823-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH v3 01/10] toaster: loadconf remove Loading LayerSources 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: Wed, 20 Jul 2016 13:48:24 -0000 We don't need to configure layer sources in the initial configuration as this information is provided by the models. Signed-off-by: Michael Wood --- .../bldcontrol/management/commands/loadconf.py | 69 +--------------------- 1 file changed, 2 insertions(+), 67 deletions(-) diff --git a/bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py b/bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py index 173e3ce..6f08f1d 100644 --- a/bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py +++ b/bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py @@ -1,6 +1,6 @@ from django.core.management.base import BaseCommand, CommandError from orm.models import LayerSource, ToasterSetting, Branch, Layer, Layer_Version -from orm.models import BitbakeVersion, Release, ReleaseDefaultLayer, ReleaseLayerSourcePriority +from orm.models import BitbakeVersion, Release, ReleaseDefaultLayer from django.db import IntegrityError import os @@ -42,7 +42,7 @@ class Command(BaseCommand): data = json.loads(open(filepath, "r").read()) # verify config file validity before updating settings - for i in ['bitbake', 'releases', 'defaultrelease', 'config', 'layersources']: + for i in ['bitbake', 'releases', 'defaultrelease', 'config']: assert i in data def _read_git_url_from_local_repository(address): @@ -81,65 +81,6 @@ class Command(BaseCommand): bvo.dirpath = bvi['dirpath'] bvo.save() - # set the layer sources - for lsi in data['layersources']: - assert 'sourcetype' in lsi - assert 'apiurl' in lsi - assert 'name' in lsi - assert 'branches' in lsi - - - if _get_id_for_sourcetype(lsi['sourcetype']) == LayerSource.TYPE_LAYERINDEX or lsi['apiurl'].startswith("/"): - apiurl = lsi['apiurl'] - else: - apiurl = _reduce_canon_path(os.path.join(DN(os.path.abspath(filepath)), lsi['apiurl'])) - - assert ((_get_id_for_sourcetype(lsi['sourcetype']) == LayerSource.TYPE_LAYERINDEX) or apiurl.startswith("/")), (lsi['sourcetype'],apiurl) - - try: - ls, created = LayerSource.objects.get_or_create(sourcetype = _get_id_for_sourcetype(lsi['sourcetype']), apiurl = apiurl) - ls.name = lsi['name'] - ls.save() - except IntegrityError as e: - logger.warning("IntegrityError %s \nWhile setting name %s for layer source %s " % (e, lsi['name'], ls)) - - - layerbranches = [] - for branchname in lsi['branches']: - bo, created = Branch.objects.get_or_create(layer_source = ls, name = branchname) - layerbranches.append(bo) - - if 'layers' in lsi: - for layerinfo in lsi['layers']: - lo, created = Layer.objects.get_or_create(layer_source = ls, name = layerinfo['name']) - if layerinfo['local_path'].startswith("/"): - lo.local_path = layerinfo['local_path'] - else: - lo.local_path = _reduce_canon_path(os.path.join(ls.apiurl, layerinfo['local_path'])) - - if not os.path.exists(lo.local_path): - logger.error("Local layer path %s must exists. Are you trying to import a layer that does not exist ? Check your local toasterconf.json" % lo.local_path) - - if layerinfo['vcs_url'].startswith("remote:"): - lo.vcs_url = _read_git_url_from_local_repository(layerinfo['vcs_url']) - if lo.vcs_url is None: - logger.error("The toaster config file references the local git repo, but Toaster cannot detect it.\nYour local configuration for layer %s is invalid. Make sure that the toasterconf.json file is correct." % layerinfo['name']) - - if lo.vcs_url is None: - lo.vcs_url = layerinfo['vcs_url'] - - if 'layer_index_url' in layerinfo: - lo.layer_index_url = layerinfo['layer_index_url'] - lo.save() - - for branch in layerbranches: - lvo, created = Layer_Version.objects.get_or_create(layer_source = ls, - up_branch = branch, - commit = branch.name, - layer = lo) - lvo.dirpath = layerinfo['dirpath'] - lvo.save() - # set releases for ri in data['releases']: bvo = BitbakeVersion.objects.get(name = ri['bitbake']) assert bvo is not None @@ -149,12 +90,6 @@ class Command(BaseCommand): ro.helptext = ri['helptext'] ro.save() - # save layer source priority for release - for ls_name in ri['layersourcepriority'].keys(): - rlspo, created = ReleaseLayerSourcePriority.objects.get_or_create(release = ro, layer_source = LayerSource.objects.get(name=ls_name)) - rlspo.priority = ri['layersourcepriority'][ls_name] - rlspo.save() - for dli in ri['defaultlayers']: # find layers with the same name ReleaseDefaultLayer.objects.get_or_create( release = ro, layer_name = dli) -- 2.7.4