summaryrefslogtreecommitdiff
path: root/yocto-poky/bitbake/lib/toaster/toastermain/management/commands
diff options
context:
space:
mode:
authorPatrick Williams <patrick@stwcx.xyz>2016-08-17 22:31:25 +0300
committerPatrick Williams <patrick@stwcx.xyz>2016-08-22 19:43:26 +0300
commit60f9d69e016b11c468c98ea75ba0a60c44afbbc4 (patch)
treeecb49581a9e41a37943c22cd9ef3f63451b20ee7 /yocto-poky/bitbake/lib/toaster/toastermain/management/commands
parente18c61205e0234b03697129c20cc69c9b3940efc (diff)
downloadopenbmc-60f9d69e016b11c468c98ea75ba0a60c44afbbc4.tar.xz
yocto-poky: Move to import-layers subdir
We are going to import additional layers, so create a subdir to hold all of the layers that we import with git-subtree. Change-Id: I6f732153a22be8ca663035c518837e3cc5ec0799 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Diffstat (limited to 'yocto-poky/bitbake/lib/toaster/toastermain/management/commands')
-rw-r--r--yocto-poky/bitbake/lib/toaster/toastermain/management/commands/__init__.py0
-rw-r--r--yocto-poky/bitbake/lib/toaster/toastermain/management/commands/builddelete.py54
-rw-r--r--yocto-poky/bitbake/lib/toaster/toastermain/management/commands/buildslist.py13
-rw-r--r--yocto-poky/bitbake/lib/toaster/toastermain/management/commands/checksocket.py69
-rw-r--r--yocto-poky/bitbake/lib/toaster/toastermain/management/commands/get-dburl.py9
-rw-r--r--yocto-poky/bitbake/lib/toaster/toastermain/management/commands/perf.py58
6 files changed, 0 insertions, 203 deletions
diff --git a/yocto-poky/bitbake/lib/toaster/toastermain/management/commands/__init__.py b/yocto-poky/bitbake/lib/toaster/toastermain/management/commands/__init__.py
deleted file mode 100644
index e69de29bb..000000000
--- a/yocto-poky/bitbake/lib/toaster/toastermain/management/commands/__init__.py
+++ /dev/null
diff --git a/yocto-poky/bitbake/lib/toaster/toastermain/management/commands/builddelete.py b/yocto-poky/bitbake/lib/toaster/toastermain/management/commands/builddelete.py
deleted file mode 100644
index ff93e549d..000000000
--- a/yocto-poky/bitbake/lib/toaster/toastermain/management/commands/builddelete.py
+++ /dev/null
@@ -1,54 +0,0 @@
-from django.core.management.base import BaseCommand, CommandError
-from django.core.exceptions import ObjectDoesNotExist
-from orm.models import Build
-from django.db import OperationalError
-import os
-
-
-
-class Command(BaseCommand):
- args = '<buildID1 buildID2 .....>'
- help = "Deletes selected build(s)"
-
- def handle(self, *args, **options):
- for bid in args:
- try:
- b = Build.objects.get(pk = bid)
- except ObjectDoesNotExist:
- print 'build %s does not exist, skipping...' %(bid)
- continue
- # theoretically, just b.delete() would suffice
- # however SQLite runs into problems when you try to
- # delete too many rows at once, so we delete some direct
- # relationships from Build manually.
- for t in b.target_set.all():
- t.delete()
- for t in b.task_build.all():
- t.delete()
- for p in b.package_set.all():
- p.delete()
- for lv in b.layer_version_build.all():
- lv.delete()
- for v in b.variable_build.all():
- v.delete()
- for l in b.logmessage_set.all():
- l.delete()
-
- # delete the build; some databases might have had problem with migration of the bldcontrol app
- retry_count = 0
- need_bldcontrol_migration = False
- while True:
- if retry_count >= 5:
- break
- retry_count += 1
- if need_bldcontrol_migration:
- from django.core import management
- management.call_command('migrate', 'bldcontrol', interactive=False)
-
- try:
- b.delete()
- break
- except OperationalError as e:
- # execute migrations
- need_bldcontrol_migration = True
-
diff --git a/yocto-poky/bitbake/lib/toaster/toastermain/management/commands/buildslist.py b/yocto-poky/bitbake/lib/toaster/toastermain/management/commands/buildslist.py
deleted file mode 100644
index cad987fd9..000000000
--- a/yocto-poky/bitbake/lib/toaster/toastermain/management/commands/buildslist.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from django.core.management.base import NoArgsCommand, CommandError
-from orm.models import Build
-import os
-
-
-
-class Command(NoArgsCommand):
- args = ""
- help = "Lists current builds"
-
- def handle_noargs(self,**options):
- for b in Build.objects.all():
- print "%d: %s %s %s" % (b.pk, b.machine, b.distro, ",".join([x.target for x in b.target_set.all()]))
diff --git a/yocto-poky/bitbake/lib/toaster/toastermain/management/commands/checksocket.py b/yocto-poky/bitbake/lib/toaster/toastermain/management/commands/checksocket.py
deleted file mode 100644
index 0399b8659..000000000
--- a/yocto-poky/bitbake/lib/toaster/toastermain/management/commands/checksocket.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/env python
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
-#
-# BitBake Toaster Implementation
-#
-# Copyright (C) 2015 Intel Corporation
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-"""Custom management command checksocket."""
-
-import errno
-import socket
-
-from django.core.management.base import BaseCommand, CommandError
-from django.utils.encoding import force_text
-
-DEFAULT_ADDRPORT = "0.0.0.0:8000"
-
-class Command(BaseCommand):
- """Custom management command."""
-
- help = 'Check if Toaster can listen on address:port'
-
- def add_arguments(self, parser):
- parser.add_argument('addrport', nargs='?', default=DEFAULT_ADDRPORT,
- help='ipaddr:port to check, %s by default' % \
- DEFAULT_ADDRPORT)
-
- def handle(self, *args, **options):
- addrport = options['addrport']
- if ':' not in addrport:
- raise CommandError('Invalid addr:port specified: %s' % addrport)
- splitted = addrport.split(':')
- try:
- splitted[1] = int(splitted[1])
- except ValueError:
- raise CommandError('Invalid port specified: %s' % splitted[1])
- self.stdout.write('Check if toaster can listen on %s' % addrport)
- try:
- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
- sock.bind(tuple(splitted))
- except (socket.error, OverflowError) as err:
- errors = {
- errno.EACCES: 'You don\'t have permission to access port %s' \
- % splitted[1],
- errno.EADDRINUSE: 'Port %s is already in use' % splitted[1],
- errno.EADDRNOTAVAIL: 'IP address can\'t be assigned to',
- }
- if hasattr(err, 'errno') and err.errno in errors:
- errtext = errors[err.errno]
- else:
- errtext = force_text(err)
- raise CommandError(errtext)
-
- self.stdout.write("OK")
diff --git a/yocto-poky/bitbake/lib/toaster/toastermain/management/commands/get-dburl.py b/yocto-poky/bitbake/lib/toaster/toastermain/management/commands/get-dburl.py
deleted file mode 100644
index 22b3eb79e..000000000
--- a/yocto-poky/bitbake/lib/toaster/toastermain/management/commands/get-dburl.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from toastermain.settings import getDATABASE_URL
-from django.core.management.base import NoArgsCommand
-
-class Command(NoArgsCommand):
- args = ""
- help = "get database url"
-
- def handle_noargs(self,**options):
- print getDATABASE_URL()
diff --git a/yocto-poky/bitbake/lib/toaster/toastermain/management/commands/perf.py b/yocto-poky/bitbake/lib/toaster/toastermain/management/commands/perf.py
deleted file mode 100644
index 71a48e95d..000000000
--- a/yocto-poky/bitbake/lib/toaster/toastermain/management/commands/perf.py
+++ /dev/null
@@ -1,58 +0,0 @@
-from django.core.management.base import BaseCommand
-from django.test.client import Client
-import os, sys, re
-import requests
-from django.conf import settings
-
-# pylint: disable=E1103
-# Instance of 'WSGIRequest' has no 'status_code' member
-# (but some types could not be inferred) (maybe-no-member)
-
-
-class Command(BaseCommand):
- help = "Test the response time for all toaster urls"
-
- def handle(self, *args, **options):
- root_urlconf = __import__(settings.ROOT_URLCONF)
- patterns = root_urlconf.urls.urlpatterns
- global full_url
- for pat in patterns:
- if pat.__class__.__name__ == 'RegexURLResolver':
- url_root_res = str(pat).split('^')[1].replace('>', '')
- if 'gui' in url_root_res:
- for url_patt in pat.url_patterns:
- full_url = self.get_full_url(url_patt, url_root_res)
- info = self.url_info(full_url)
- status_code = info[0]
- load_time = info[1]
- print 'Trying \'' + full_url + '\', ' + str(status_code) + ', ' + str(load_time)
-
- def get_full_url(self, url_patt, url_root_res):
- full_url = str(url_patt).split('^')[1].replace('$>', '').replace('(?P<file_path>(?:/[', '/bin/busybox').replace('.*', '')
- full_url = str(url_root_res + full_url)
- full_url = re.sub('\(\?P<.*?>\\\d\+\)', '1', full_url)
- full_url = 'http://localhost:8000/' + full_url
- return full_url
-
- def url_info(self, full_url):
- client = Client()
- info = []
- try:
- resp = client.get(full_url, follow = True)
- except Exception as e_status_code:
- self.error('Url: %s, error: %s' % (full_url, e_status_code))
- resp = type('object', (), {'status_code':0, 'content': str(e_status_code)})
- status_code = resp.status_code
- info.append(status_code)
- try:
- req = requests.get(full_url)
- except Exception as e_load_time:
- self.error('Url: %s, error: %s' % (full_url, e_load_time))
- load_time = req.elapsed
- info.append(load_time)
- return info
-
- def error(self, *args):
- for arg in args:
- print >>sys.stderr, arg,
- print >>sys.stderr