summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/buildinfohelper.py
diff options
context:
space:
mode:
authorElliot Smith <elliot.smith@intel.com>2015-09-02 17:25:08 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-03 16:52:48 +0100
commit214ba674d057107688a281c542c21170657175e1 (patch)
treed99f0583a932d930e948c119d03bbf898550a82b /bitbake/lib/bb/ui/buildinfohelper.py
parent5b26bbdfe17d36fbdbdeefe99c9054e7657b74fb (diff)
downloadpoky-214ba674d057107688a281c542c21170657175e1.tar.gz
bitbake: toaster: Improve how default project is identified and fetched
Command line builds are associated with a "default project" (as we currently require a build to have a project). This acts as a container for builds initiated outside Toaster. Currently, this project is marked as the default by its ID being 0. However, this doesn't work with MySQL, as MySQL won't allow 0 in a foreign key which references an autoincrement field. Instead, use an is_default field to track the default Project for builds initiated outside Toaster. Add a method to fetch this default project, rather than fetching a project with a magic ID. Add this default project in a migration, rather than as a side effect of a get_or_create() style method. Also ensure that builds always have a project explicitly assigned to avoid any magic with a build's project foreign key defaulting to 0 (as it no longer does). [YOCTO #7932] (Bitbake rev: 71b709a1bbc26d89d61873763b467d21e625b274) Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui/buildinfohelper.py')
-rw-r--r--bitbake/lib/bb/ui/buildinfohelper.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index 09e8853338..2d1ed51116 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -145,13 +145,14 @@ class ORMWrapper(object):
145 prj = Project.objects.get(pk = project_id) 145 prj = Project.objects.get(pk = project_id)
146 146
147 else: # this build was triggered by a legacy system, or command line interactive mode 147 else: # this build was triggered by a legacy system, or command line interactive mode
148 prj, _ = Project.objects.get_or_create(pk=0, name="Default Project") 148 prj = Project.objects.get_default_project()
149 logger.debug(1, "buildinfohelper: project is not specified, defaulting to %s" % prj) 149 logger.debug(1, "buildinfohelper: project is not specified, defaulting to %s" % prj)
150 150
151 151
152 if buildrequest is not None: 152 if buildrequest is not None:
153 build = buildrequest.build 153 build = buildrequest.build
154 logger.info("Updating existing build, with %s", build_info) 154 logger.info("Updating existing build, with %s", build_info)
155 build.project = prj
155 build.machine=build_info['machine'] 156 build.machine=build_info['machine']
156 build.distro=build_info['distro'] 157 build.distro=build_info['distro']
157 build.distro_version=build_info['distro_version'] 158 build.distro_version=build_info['distro_version']