diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2015-12-09 19:56:38 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-12-14 23:13:07 +0000 |
commit | 84daa40bc7600df75d93db358be94cac10452936 (patch) | |
tree | d23c913ca773bd04720e0cbfe6a98a199cee3dec /bitbake | |
parent | c464f34d5bd3aa4119aa3d1591ee7d55afe9b35f (diff) | |
download | poky-84daa40bc7600df75d93db358be94cac10452936.tar.gz |
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>
Diffstat (limited to 'bitbake')
5 files changed, 13 insertions, 14 deletions
diff --git a/bitbake/lib/toaster/bldcontrol/bbcontroller.py b/bitbake/lib/toaster/bldcontrol/bbcontroller.py index 781ff73d1a..1387bdaa7b 100644 --- a/bitbake/lib/toaster/bldcontrol/bbcontroller.py +++ b/bitbake/lib/toaster/bldcontrol/bbcontroller.py | |||
@@ -141,10 +141,10 @@ class BuildEnvironmentController(object): | |||
141 | raise Exception("FIXME: Must override in order to actually start the BB server") | 141 | raise Exception("FIXME: Must override in order to actually start the BB server") |
142 | 142 | ||
143 | 143 | ||
144 | def setLayers(self, bbs, ls): | 144 | def setLayers(self, bitbake, ls): |
145 | """ Checks-out bitbake executor and layers from git repositories. | 145 | """ Checks-out bitbake executor and layers from git repositories. |
146 | Sets the layer variables in the config file, after validating local layer paths. | 146 | Sets the layer variables in the config file, after validating local layer paths. |
147 | The bitbakes must be a 1-length list of BRBitbake | 147 | bitbake must be a single BRBitbake instance |
148 | The layer paths must be in a list of BRLayer object | 148 | The layer paths must be in a list of BRLayer object |
149 | 149 | ||
150 | a word of attention: by convention, the first layer for any build will be poky! | 150 | a word of attention: by convention, the first layer for any build will be poky! |
diff --git a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py index 00228e9ef0..4f6f15c601 100644 --- a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py +++ b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py | |||
@@ -115,18 +115,17 @@ class LocalhostBEController(BuildEnvironmentController): | |||
115 | return local_checkout_path | 115 | return local_checkout_path |
116 | 116 | ||
117 | 117 | ||
118 | def setLayers(self, bitbakes, layers, targets): | 118 | def setLayers(self, bitbake, layers, targets): |
119 | """ a word of attention: by convention, the first layer for any build will be poky! """ | 119 | """ a word of attention: by convention, the first layer for any build will be poky! """ |
120 | 120 | ||
121 | assert self.be.sourcedir is not None | 121 | assert self.be.sourcedir is not None |
122 | assert len(bitbakes) == 1 | ||
123 | # set layers in the layersource | 122 | # set layers in the layersource |
124 | 123 | ||
125 | # 1. get a list of repos with branches, and map dirpaths for each layer | 124 | # 1. get a list of repos with branches, and map dirpaths for each layer |
126 | gitrepos = {} | 125 | gitrepos = {} |
127 | 126 | ||
128 | gitrepos[(bitbakes[0].giturl, bitbakes[0].commit)] = [] | 127 | gitrepos[(bitbake.giturl, bitbake.commit)] = [] |
129 | gitrepos[(bitbakes[0].giturl, bitbakes[0].commit)].append( ("bitbake", bitbakes[0].dirpath) ) | 128 | gitrepos[(bitbake.giturl, bitbake.commit)].append( ("bitbake", bitbake.dirpath) ) |
130 | 129 | ||
131 | for layer in layers: | 130 | for layer in layers: |
132 | # we don't process local URLs | 131 | # we don't process local URLs |
@@ -198,7 +197,7 @@ class LocalhostBEController(BuildEnvironmentController): | |||
198 | # make sure we have a working bitbake | 197 | # make sure we have a working bitbake |
199 | if not os.path.exists(os.path.join(self.pokydirname, 'bitbake')): | 198 | if not os.path.exists(os.path.join(self.pokydirname, 'bitbake')): |
200 | logger.debug("localhostbecontroller: checking bitbake into the poky dirname %s " % self.pokydirname) | 199 | logger.debug("localhostbecontroller: checking bitbake into the poky dirname %s " % self.pokydirname) |
201 | self._shellcmd("git clone -b \"%s\" \"%s\" \"%s\" " % (bitbakes[0].commit, bitbakes[0].giturl, os.path.join(self.pokydirname, 'bitbake'))) | 200 | self._shellcmd("git clone -b \"%s\" \"%s\" \"%s\" " % (bitbake.commit, bitbake.giturl, os.path.join(self.pokydirname, 'bitbake'))) |
202 | 201 | ||
203 | # verify our repositories | 202 | # verify our repositories |
204 | for name, dirpath in gitrepos[(giturl, commit)]: | 203 | for name, dirpath in gitrepos[(giturl, commit)]: |
@@ -224,7 +223,7 @@ class LocalhostBEController(BuildEnvironmentController): | |||
224 | for target in targets: | 223 | for target in targets: |
225 | try: | 224 | try: |
226 | customrecipe = CustomImageRecipe.objects.get(name=target.target, | 225 | customrecipe = CustomImageRecipe.objects.get(name=target.target, |
227 | project=bitbakes[0].req.project) | 226 | project=bitbake.req.project) |
228 | except CustomImageRecipe.DoesNotExist: | 227 | except CustomImageRecipe.DoesNotExist: |
229 | continue # not a custom recipe, skip | 228 | continue # not a custom recipe, skip |
230 | 229 | ||
@@ -278,7 +277,7 @@ class LocalhostBEController(BuildEnvironmentController): | |||
278 | 277 | ||
279 | 278 | ||
280 | def triggerBuild(self, bitbake, layers, variables, targets): | 279 | def triggerBuild(self, bitbake, layers, variables, targets): |
281 | # set up the buid environment with the needed layers | 280 | # set up the build environment with the needed layers |
282 | self.setLayers(bitbake, layers, targets) | 281 | self.setLayers(bitbake, layers, targets) |
283 | 282 | ||
284 | # get the bb server running with the build req id and build env id | 283 | # get the bb server running with the build req id and build env id |
diff --git a/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py b/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py index d40dedb4b0..edf71a7d7b 100644 --- a/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py +++ b/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py | |||
@@ -57,7 +57,7 @@ class Command(NoArgsCommand): | |||
57 | br.save() | 57 | br.save() |
58 | 58 | ||
59 | # this triggers an async build | 59 | # this triggers an async build |
60 | bec.triggerBuild(br.brbitbake_set.all(), br.brlayer_set.all(), br.brvariable_set.all(), br.brtarget_set.all()) | 60 | bec.triggerBuild(br.brbitbake, br.brlayer_set.all(), br.brvariable_set.all(), br.brtarget_set.all()) |
61 | 61 | ||
62 | except Exception as e: | 62 | except Exception as e: |
63 | logger.error("runbuilds: Error launching build %s" % e) | 63 | logger.error("runbuilds: Error launching build %s" % e) |
diff --git a/bitbake/lib/toaster/bldcontrol/models.py b/bitbake/lib/toaster/bldcontrol/models.py index ab41105303..a3a49ce472 100644 --- a/bitbake/lib/toaster/bldcontrol/models.py +++ b/bitbake/lib/toaster/bldcontrol/models.py | |||
@@ -106,7 +106,7 @@ class BRLayer(models.Model): | |||
106 | layer_version = models.ForeignKey(Layer_Version, null=True) | 106 | layer_version = models.ForeignKey(Layer_Version, null=True) |
107 | 107 | ||
108 | class BRBitbake(models.Model): | 108 | class BRBitbake(models.Model): |
109 | req = models.ForeignKey(BuildRequest, unique = True) # only one bitbake for a request | 109 | req = models.OneToOneField(BuildRequest) # only one bitbake for a request |
110 | giturl = models.CharField(max_length =254) | 110 | giturl = models.CharField(max_length =254) |
111 | commit = models.CharField(max_length = 254) | 111 | commit = models.CharField(max_length = 254) |
112 | dirpath = models.CharField(max_length = 254) | 112 | dirpath = models.CharField(max_length = 254) |
diff --git a/bitbake/lib/toaster/bldcontrol/tests.py b/bitbake/lib/toaster/bldcontrol/tests.py index f54cf7f366..141b42acbc 100644 --- a/bitbake/lib/toaster/bldcontrol/tests.py +++ b/bitbake/lib/toaster/bldcontrol/tests.py | |||
@@ -18,7 +18,7 @@ import subprocess | |||
18 | import os | 18 | import os |
19 | 19 | ||
20 | # standard poky data hardcoded for testing | 20 | # standard poky data hardcoded for testing |
21 | BITBAKE_LAYERS = [type('bitbake_info', (object,), { "giturl": "git://git.yoctoproject.org/poky.git", "dirpath": "", "commit": "HEAD"})] | 21 | BITBAKE_LAYER = type('bitbake_info', (object,), { "giturl": "git://git.yoctoproject.org/poky.git", "dirpath": "", "commit": "HEAD"}) |
22 | POKY_LAYERS = [ | 22 | POKY_LAYERS = [ |
23 | type('poky_info', (object,), { "name": "meta", "giturl": "git://git.yoctoproject.org/poky.git", "dirpath": "meta", "commit": "HEAD"}), | 23 | type('poky_info', (object,), { "name": "meta", "giturl": "git://git.yoctoproject.org/poky.git", "dirpath": "meta", "commit": "HEAD"}), |
24 | type('poky_info', (object,), { "name": "meta-yocto", "giturl": "git://git.yoctoproject.org/poky.git", "dirpath": "meta-yocto", "commit": "HEAD"}), | 24 | 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): | |||
53 | bc = self._getBEController(obe) | 53 | bc = self._getBEController(obe) |
54 | try: | 54 | try: |
55 | # setting layers, skip any layer info | 55 | # setting layers, skip any layer info |
56 | bc.setLayers(BITBAKE_LAYERS, POKY_LAYERS) | 56 | bc.setLayers(BITBAKE_LAYER, POKY_LAYERS) |
57 | except NotImplementedException, e: | 57 | except NotImplementedException, e: |
58 | print "Test skipped due to command not implemented yet" | 58 | print "Test skipped due to command not implemented yet" |
59 | return True | 59 | return True |
@@ -80,7 +80,7 @@ class BEControllerTests(object): | |||
80 | layerSet = False | 80 | layerSet = False |
81 | try: | 81 | try: |
82 | # setting layers, skip any layer info | 82 | # setting layers, skip any layer info |
83 | layerSet = bc.setLayers(BITBAKE_LAYERS, POKY_LAYERS) | 83 | layerSet = bc.setLayers(BITBAKE_LAYER, POKY_LAYERS) |
84 | except NotImplementedException: | 84 | except NotImplementedException: |
85 | print "Test skipped due to command not implemented yet" | 85 | print "Test skipped due to command not implemented yet" |
86 | return True | 86 | return True |