diff options
Diffstat (limited to 'poky/bitbake/lib/toaster/bldcontrol')
7 files changed, 29 insertions, 38 deletions
diff --git a/poky/bitbake/lib/toaster/bldcontrol/admin.py b/poky/bitbake/lib/toaster/bldcontrol/admin.py index e85c30ed11..1754bc11cc 100644 --- a/poky/bitbake/lib/toaster/bldcontrol/admin.py +++ b/poky/bitbake/lib/toaster/bldcontrol/admin.py @@ -3,7 +3,6 @@ # from django.contrib import admin -from django.contrib.admin.filters import RelatedFieldListFilter from .models import BuildEnvironment class BuildEnvironmentAdmin(admin.ModelAdmin): diff --git a/poky/bitbake/lib/toaster/bldcontrol/bbcontroller.py b/poky/bitbake/lib/toaster/bldcontrol/bbcontroller.py index 301df1880a..71c288df34 100644 --- a/poky/bitbake/lib/toaster/bldcontrol/bbcontroller.py +++ b/poky/bitbake/lib/toaster/bldcontrol/bbcontroller.py @@ -8,10 +8,8 @@ import os import sys -import re -from django.db import transaction from django.db.models import Q -from bldcontrol.models import BuildEnvironment, BRLayer, BRVariable, BRTarget, BRBitbake +from bldcontrol.models import BuildEnvironment, BRLayer, BRBitbake # load Bitbake components path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) diff --git a/poky/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py b/poky/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py index 39ea736b58..75674ccbf1 100644 --- a/poky/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py +++ b/poky/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py @@ -7,27 +7,24 @@ # import os -import sys import re import shutil import time -from django.db import transaction -from django.db.models import Q -from bldcontrol.models import BuildEnvironment, BuildRequest, BRLayer, BRVariable, BRTarget, BRBitbake, Build -from orm.models import CustomImageRecipe, Layer, Layer_Version, Project, ProjectLayer, ToasterSetting +from bldcontrol.models import BuildEnvironment, BuildRequest, Build +from orm.models import CustomImageRecipe, Layer, Layer_Version, Project, ToasterSetting from orm.models import signal_runbuilds import subprocess from toastermain import settings -from bldcontrol.bbcontroller import BuildEnvironmentController, ShellCmdException, BuildSetupException, BitbakeController +from bldcontrol.bbcontroller import BuildEnvironmentController, ShellCmdException, BuildSetupException import logging logger = logging.getLogger("toaster") install_dir = os.environ.get('TOASTER_DIR') -from pprint import pprint, pformat +from pprint import pformat class LocalhostBEController(BuildEnvironmentController): """ Implementation of the BuildEnvironmentController for the localhost; diff --git a/poky/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py b/poky/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py index fe2c4dc2bb..20f9dce569 100644 --- a/poky/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py +++ b/poky/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py @@ -2,11 +2,9 @@ # SPDX-License-Identifier: GPL-2.0-only # -from django.core.management.base import BaseCommand, CommandError -from django.db import transaction +from django.core.management.base import BaseCommand from django.core.management import call_command -from bldcontrol.bbcontroller import getBuildEnvironmentController, ShellCmdException from bldcontrol.models import BuildRequest, BuildEnvironment, BRError from orm.models import ToasterSetting, Build, Layer @@ -80,7 +78,7 @@ class Command(BaseCommand): template_conf = os.environ.get("TEMPLATECONF", "") custom_xml_only = os.environ.get("CUSTOM_XML_ONLY") - if ToasterSetting.objects.filter(name='CUSTOM_XML_ONLY').count() > 0 or (not custom_xml_only == None): + if ToasterSetting.objects.filter(name='CUSTOM_XML_ONLY').count() > 0 or custom_xml_only is not None: # only use the custom settings pass elif "poky" in template_conf: diff --git a/poky/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py b/poky/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py index 50ec409860..19f659ec41 100644 --- a/poky/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py +++ b/poky/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py @@ -168,17 +168,17 @@ class Command(BaseCommand): try: self.cleanup() except Exception as e: - logger.warn("runbuilds: cleanup exception %s" % str(e)) + logger.warning("runbuilds: cleanup exception %s" % str(e)) try: self.archive() except Exception as e: - logger.warn("runbuilds: archive exception %s" % str(e)) + logger.warning("runbuilds: archive exception %s" % str(e)) try: self.schedule() except Exception as e: - logger.warn("runbuilds: schedule exception %s" % str(e)) + logger.warning("runbuilds: schedule exception %s" % str(e)) def handle(self, **options): pidfile_path = os.path.join(os.environ.get("BUILDDIR", "."), diff --git a/poky/bitbake/lib/toaster/bldcontrol/migrations/0001_initial.py b/poky/bitbake/lib/toaster/bldcontrol/migrations/0001_initial.py index 67db378561..7ee19f4745 100644 --- a/poky/bitbake/lib/toaster/bldcontrol/migrations/0001_initial.py +++ b/poky/bitbake/lib/toaster/bldcontrol/migrations/0001_initial.py @@ -37,7 +37,7 @@ class Migration(migrations.Migration): ('giturl', models.CharField(max_length=254)), ('commit', models.CharField(max_length=254)), ('dirpath', models.CharField(max_length=254)), - ('layer_version', models.ForeignKey(to='orm.Layer_Version', null=True)), + ('layer_version', models.ForeignKey(to='orm.Layer_Version', null=True, on_delete=models.CASCADE)), ], ), migrations.CreateModel( @@ -80,34 +80,34 @@ class Migration(migrations.Migration): ('state', models.IntegerField(default=0, choices=[(0, b'created'), (1, b'queued'), (2, b'in progress'), (3, b'completed'), (4, b'failed'), (5, b'deleted'), (6, b'archive')])), ('created', models.DateTimeField(auto_now_add=True)), ('updated', models.DateTimeField(auto_now=True)), - ('build', models.OneToOneField(null=True, to='orm.Build')), - ('environment', models.ForeignKey(to='bldcontrol.BuildEnvironment', null=True)), - ('project', models.ForeignKey(to='orm.Project')), + ('build', models.OneToOneField(null=True, to='orm.Build', on_delete=models.CASCADE)), + ('environment', models.ForeignKey(to='bldcontrol.BuildEnvironment', null=True, on_delete=models.CASCADE)), + ('project', models.ForeignKey(to='orm.Project', on_delete=models.CASCADE)), ], ), migrations.AddField( model_name='brvariable', name='req', - field=models.ForeignKey(to='bldcontrol.BuildRequest'), + field=models.ForeignKey(to='bldcontrol.BuildRequest', on_delete=models.CASCADE), ), migrations.AddField( model_name='brtarget', name='req', - field=models.ForeignKey(to='bldcontrol.BuildRequest'), + field=models.ForeignKey(to='bldcontrol.BuildRequest', on_delete=models.CASCADE), ), migrations.AddField( model_name='brlayer', name='req', - field=models.ForeignKey(to='bldcontrol.BuildRequest'), + field=models.ForeignKey(to='bldcontrol.BuildRequest', on_delete=models.CASCADE), ), migrations.AddField( model_name='brerror', name='req', - field=models.ForeignKey(to='bldcontrol.BuildRequest'), + field=models.ForeignKey(to='bldcontrol.BuildRequest', on_delete=models.CASCADE), ), migrations.AddField( model_name='brbitbake', name='req', - field=models.OneToOneField(to='bldcontrol.BuildRequest'), + field=models.OneToOneField(to='bldcontrol.BuildRequest', on_delete=models.CASCADE), ), ] diff --git a/poky/bitbake/lib/toaster/bldcontrol/models.py b/poky/bitbake/lib/toaster/bldcontrol/models.py index bcffcf5e20..c2f302da24 100644 --- a/poky/bitbake/lib/toaster/bldcontrol/models.py +++ b/poky/bitbake/lib/toaster/bldcontrol/models.py @@ -4,9 +4,8 @@ from __future__ import unicode_literals from django.db import models -from django.core.validators import MaxValueValidator, MinValueValidator from django.utils.encoding import force_text -from orm.models import Project, ProjectLayer, ProjectVariable, ProjectTarget, Build, Layer_Version +from orm.models import Project, Build, Layer_Version import logging logger = logging.getLogger("toaster") @@ -86,9 +85,9 @@ class BuildRequest(models.Model): search_allowed_fields = ("brtarget__target", "build__project__name") - project = models.ForeignKey(Project) - build = models.OneToOneField(Build, null = True) # TODO: toasterui should set this when Build is created - environment = models.ForeignKey(BuildEnvironment, null = True) + project = models.ForeignKey(Project, on_delete=models.CASCADE) + build = models.OneToOneField(Build, on_delete=models.CASCADE, null = True) # TODO: toasterui should set this when Build is created + environment = models.ForeignKey(BuildEnvironment, on_delete=models.CASCADE, null = True) state = models.IntegerField(choices = REQUEST_STATE, default = REQ_CREATED) created = models.DateTimeField(auto_now_add = True) updated = models.DateTimeField(auto_now = True) @@ -132,32 +131,32 @@ class BuildRequest(models.Model): class BRLayer(models.Model): - req = models.ForeignKey(BuildRequest) + req = models.ForeignKey(BuildRequest, on_delete=models.CASCADE) name = models.CharField(max_length=100) giturl = models.CharField(max_length=254, null=True) local_source_dir = models.CharField(max_length=254, null=True) commit = models.CharField(max_length=254, null=True) dirpath = models.CharField(max_length=254, null=True) - layer_version = models.ForeignKey(Layer_Version, null=True) + layer_version = models.ForeignKey(Layer_Version, on_delete=models.CASCADE, null=True) class BRBitbake(models.Model): - req = models.OneToOneField(BuildRequest) # only one bitbake for a request + req = models.OneToOneField(BuildRequest, on_delete=models.CASCADE) # only one bitbake for a request giturl = models.CharField(max_length =254) commit = models.CharField(max_length = 254) dirpath = models.CharField(max_length = 254) class BRVariable(models.Model): - req = models.ForeignKey(BuildRequest) + req = models.ForeignKey(BuildRequest, on_delete=models.CASCADE) name = models.CharField(max_length=100) value = models.TextField(blank = True) class BRTarget(models.Model): - req = models.ForeignKey(BuildRequest) + req = models.ForeignKey(BuildRequest, on_delete=models.CASCADE) target = models.CharField(max_length=100) task = models.CharField(max_length=100, null=True) class BRError(models.Model): - req = models.ForeignKey(BuildRequest) + req = models.ForeignKey(BuildRequest, on_delete=models.CASCADE) errtype = models.CharField(max_length=100) errmsg = models.TextField() traceback = models.TextField() |