mirror of
https://git.yoctoproject.org/poky
synced 2026-09-14 21:49:33 +02:00
bitbake: toaster: use OneToOneField instead of ForeignKey
Used OneToOneField to reference BuildRequest in BRBitbake model.
Fixed django warning:
WARNINGS: Setting unique=True on a ForeignKey has the same effect
as using a OneToOneField.
(Bitbake rev: aaa4319ebbb06facb77b4ba936cf3aa2068ff238)
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
c464f34d5b
commit
84daa40bc7
@@ -141,10 +141,10 @@ class BuildEnvironmentController(object):
|
|||||||
raise Exception("FIXME: Must override in order to actually start the BB server")
|
raise Exception("FIXME: Must override in order to actually start the BB server")
|
||||||
|
|
||||||
|
|
||||||
def setLayers(self, bbs, ls):
|
def setLayers(self, bitbake, ls):
|
||||||
""" Checks-out bitbake executor and layers from git repositories.
|
""" Checks-out bitbake executor and layers from git repositories.
|
||||||
Sets the layer variables in the config file, after validating local layer paths.
|
Sets the layer variables in the config file, after validating local layer paths.
|
||||||
The bitbakes must be a 1-length list of BRBitbake
|
bitbake must be a single BRBitbake instance
|
||||||
The layer paths must be in a list of BRLayer object
|
The layer paths must be in a list of BRLayer object
|
||||||
|
|
||||||
a word of attention: by convention, the first layer for any build will be poky!
|
a word of attention: by convention, the first layer for any build will be poky!
|
||||||
|
|||||||
@@ -115,18 +115,17 @@ class LocalhostBEController(BuildEnvironmentController):
|
|||||||
return local_checkout_path
|
return local_checkout_path
|
||||||
|
|
||||||
|
|
||||||
def setLayers(self, bitbakes, layers, targets):
|
def setLayers(self, bitbake, layers, targets):
|
||||||
""" a word of attention: by convention, the first layer for any build will be poky! """
|
""" a word of attention: by convention, the first layer for any build will be poky! """
|
||||||
|
|
||||||
assert self.be.sourcedir is not None
|
assert self.be.sourcedir is not None
|
||||||
assert len(bitbakes) == 1
|
|
||||||
# set layers in the layersource
|
# set layers in the layersource
|
||||||
|
|
||||||
# 1. get a list of repos with branches, and map dirpaths for each layer
|
# 1. get a list of repos with branches, and map dirpaths for each layer
|
||||||
gitrepos = {}
|
gitrepos = {}
|
||||||
|
|
||||||
gitrepos[(bitbakes[0].giturl, bitbakes[0].commit)] = []
|
gitrepos[(bitbake.giturl, bitbake.commit)] = []
|
||||||
gitrepos[(bitbakes[0].giturl, bitbakes[0].commit)].append( ("bitbake", bitbakes[0].dirpath) )
|
gitrepos[(bitbake.giturl, bitbake.commit)].append( ("bitbake", bitbake.dirpath) )
|
||||||
|
|
||||||
for layer in layers:
|
for layer in layers:
|
||||||
# we don't process local URLs
|
# we don't process local URLs
|
||||||
@@ -198,7 +197,7 @@ class LocalhostBEController(BuildEnvironmentController):
|
|||||||
# make sure we have a working bitbake
|
# make sure we have a working bitbake
|
||||||
if not os.path.exists(os.path.join(self.pokydirname, 'bitbake')):
|
if not os.path.exists(os.path.join(self.pokydirname, 'bitbake')):
|
||||||
logger.debug("localhostbecontroller: checking bitbake into the poky dirname %s " % self.pokydirname)
|
logger.debug("localhostbecontroller: checking bitbake into the poky dirname %s " % self.pokydirname)
|
||||||
self._shellcmd("git clone -b \"%s\" \"%s\" \"%s\" " % (bitbakes[0].commit, bitbakes[0].giturl, os.path.join(self.pokydirname, 'bitbake')))
|
self._shellcmd("git clone -b \"%s\" \"%s\" \"%s\" " % (bitbake.commit, bitbake.giturl, os.path.join(self.pokydirname, 'bitbake')))
|
||||||
|
|
||||||
# verify our repositories
|
# verify our repositories
|
||||||
for name, dirpath in gitrepos[(giturl, commit)]:
|
for name, dirpath in gitrepos[(giturl, commit)]:
|
||||||
@@ -224,7 +223,7 @@ class LocalhostBEController(BuildEnvironmentController):
|
|||||||
for target in targets:
|
for target in targets:
|
||||||
try:
|
try:
|
||||||
customrecipe = CustomImageRecipe.objects.get(name=target.target,
|
customrecipe = CustomImageRecipe.objects.get(name=target.target,
|
||||||
project=bitbakes[0].req.project)
|
project=bitbake.req.project)
|
||||||
except CustomImageRecipe.DoesNotExist:
|
except CustomImageRecipe.DoesNotExist:
|
||||||
continue # not a custom recipe, skip
|
continue # not a custom recipe, skip
|
||||||
|
|
||||||
@@ -278,7 +277,7 @@ class LocalhostBEController(BuildEnvironmentController):
|
|||||||
|
|
||||||
|
|
||||||
def triggerBuild(self, bitbake, layers, variables, targets):
|
def triggerBuild(self, bitbake, layers, variables, targets):
|
||||||
# set up the buid environment with the needed layers
|
# set up the build environment with the needed layers
|
||||||
self.setLayers(bitbake, layers, targets)
|
self.setLayers(bitbake, layers, targets)
|
||||||
|
|
||||||
# get the bb server running with the build req id and build env id
|
# get the bb server running with the build req id and build env id
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class Command(NoArgsCommand):
|
|||||||
br.save()
|
br.save()
|
||||||
|
|
||||||
# this triggers an async build
|
# this triggers an async build
|
||||||
bec.triggerBuild(br.brbitbake_set.all(), br.brlayer_set.all(), br.brvariable_set.all(), br.brtarget_set.all())
|
bec.triggerBuild(br.brbitbake, br.brlayer_set.all(), br.brvariable_set.all(), br.brtarget_set.all())
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("runbuilds: Error launching build %s" % e)
|
logger.error("runbuilds: Error launching build %s" % e)
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ class BRLayer(models.Model):
|
|||||||
layer_version = models.ForeignKey(Layer_Version, null=True)
|
layer_version = models.ForeignKey(Layer_Version, null=True)
|
||||||
|
|
||||||
class BRBitbake(models.Model):
|
class BRBitbake(models.Model):
|
||||||
req = models.ForeignKey(BuildRequest, unique = True) # only one bitbake for a request
|
req = models.OneToOneField(BuildRequest) # only one bitbake for a request
|
||||||
giturl = models.CharField(max_length =254)
|
giturl = models.CharField(max_length =254)
|
||||||
commit = models.CharField(max_length = 254)
|
commit = models.CharField(max_length = 254)
|
||||||
dirpath = models.CharField(max_length = 254)
|
dirpath = models.CharField(max_length = 254)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import subprocess
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
# standard poky data hardcoded for testing
|
# standard poky data hardcoded for testing
|
||||||
BITBAKE_LAYERS = [type('bitbake_info', (object,), { "giturl": "git://git.yoctoproject.org/poky.git", "dirpath": "", "commit": "HEAD"})]
|
BITBAKE_LAYER = type('bitbake_info', (object,), { "giturl": "git://git.yoctoproject.org/poky.git", "dirpath": "", "commit": "HEAD"})
|
||||||
POKY_LAYERS = [
|
POKY_LAYERS = [
|
||||||
type('poky_info', (object,), { "name": "meta", "giturl": "git://git.yoctoproject.org/poky.git", "dirpath": "meta", "commit": "HEAD"}),
|
type('poky_info', (object,), { "name": "meta", "giturl": "git://git.yoctoproject.org/poky.git", "dirpath": "meta", "commit": "HEAD"}),
|
||||||
type('poky_info', (object,), { "name": "meta-yocto", "giturl": "git://git.yoctoproject.org/poky.git", "dirpath": "meta-yocto", "commit": "HEAD"}),
|
type('poky_info', (object,), { "name": "meta-yocto", "giturl": "git://git.yoctoproject.org/poky.git", "dirpath": "meta-yocto", "commit": "HEAD"}),
|
||||||
@@ -53,7 +53,7 @@ class BEControllerTests(object):
|
|||||||
bc = self._getBEController(obe)
|
bc = self._getBEController(obe)
|
||||||
try:
|
try:
|
||||||
# setting layers, skip any layer info
|
# setting layers, skip any layer info
|
||||||
bc.setLayers(BITBAKE_LAYERS, POKY_LAYERS)
|
bc.setLayers(BITBAKE_LAYER, POKY_LAYERS)
|
||||||
except NotImplementedException, e:
|
except NotImplementedException, e:
|
||||||
print "Test skipped due to command not implemented yet"
|
print "Test skipped due to command not implemented yet"
|
||||||
return True
|
return True
|
||||||
@@ -80,7 +80,7 @@ class BEControllerTests(object):
|
|||||||
layerSet = False
|
layerSet = False
|
||||||
try:
|
try:
|
||||||
# setting layers, skip any layer info
|
# setting layers, skip any layer info
|
||||||
layerSet = bc.setLayers(BITBAKE_LAYERS, POKY_LAYERS)
|
layerSet = bc.setLayers(BITBAKE_LAYER, POKY_LAYERS)
|
||||||
except NotImplementedException:
|
except NotImplementedException:
|
||||||
print "Test skipped due to command not implemented yet"
|
print "Test skipped due to command not implemented yet"
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user