From c527fd1f14c27855a37f2e8ac5346ce8d940ced2 Mon Sep 17 00:00:00 2001 From: Tudor Florea Date: Thu, 16 Oct 2014 03:05:19 +0200 Subject: initial commit for Enea Linux 4.0-140929 Migrated from the internal git server on the daisy-enea-point-release branch Signed-off-by: Tudor Florea --- bitbake/lib/toaster/toastermain/__init__.py | 0 .../lib/toaster/toastermain/management/__init__.py | 0 .../toastermain/management/commands/__init__.py | 0 .../toastermain/management/commands/builddelete.py | 33 +++ .../toastermain/management/commands/buildslist.py | 13 ++ bitbake/lib/toaster/toastermain/settings.py | 231 +++++++++++++++++++++ bitbake/lib/toaster/toastermain/urls.py | 44 ++++ bitbake/lib/toaster/toastermain/wsgi.py | 35 ++++ 8 files changed, 356 insertions(+) create mode 100644 bitbake/lib/toaster/toastermain/__init__.py create mode 100644 bitbake/lib/toaster/toastermain/management/__init__.py create mode 100644 bitbake/lib/toaster/toastermain/management/commands/__init__.py create mode 100644 bitbake/lib/toaster/toastermain/management/commands/builddelete.py create mode 100644 bitbake/lib/toaster/toastermain/management/commands/buildslist.py create mode 100644 bitbake/lib/toaster/toastermain/settings.py create mode 100644 bitbake/lib/toaster/toastermain/urls.py create mode 100644 bitbake/lib/toaster/toastermain/wsgi.py (limited to 'bitbake/lib/toaster/toastermain') diff --git a/bitbake/lib/toaster/toastermain/__init__.py b/bitbake/lib/toaster/toastermain/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bitbake/lib/toaster/toastermain/management/__init__.py b/bitbake/lib/toaster/toastermain/management/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bitbake/lib/toaster/toastermain/management/commands/__init__.py b/bitbake/lib/toaster/toastermain/management/commands/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bitbake/lib/toaster/toastermain/management/commands/builddelete.py b/bitbake/lib/toaster/toastermain/management/commands/builddelete.py new file mode 100644 index 0000000000..5cec436714 --- /dev/null +++ b/bitbake/lib/toaster/toastermain/management/commands/builddelete.py @@ -0,0 +1,33 @@ +from django.core.management.base import BaseCommand, CommandError +from orm.models import Build +import os + + + +class Command(BaseCommand): + args = "buildId" + help = "Deletes selected build" + + def handle(self, buildId, *args, **options): + b = Build.objects.get(pk = buildId) + # 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() + + # this should take care of the rest + b.delete() + diff --git a/bitbake/lib/toaster/toastermain/management/commands/buildslist.py b/bitbake/lib/toaster/toastermain/management/commands/buildslist.py new file mode 100644 index 0000000000..cad987fd93 --- /dev/null +++ b/bitbake/lib/toaster/toastermain/management/commands/buildslist.py @@ -0,0 +1,13 @@ +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/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py new file mode 100644 index 0000000000..645f32746d --- /dev/null +++ b/bitbake/lib/toaster/toastermain/settings.py @@ -0,0 +1,231 @@ +# +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +# +# BitBake Toaster Implementation +# +# Copyright (C) 2013 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. + +# Django settings for Toaster project. + +DEBUG = True +TEMPLATE_DEBUG = DEBUG + +ADMINS = ( + # ('Your Name', 'your_email@example.com'), +) + +MANAGERS = ADMINS + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. + 'NAME': 'toaster.sqlite', # Or path to database file if using sqlite3. + 'USER': '', + 'PASSWORD': '', + 'HOST': '127.0.0.1', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. + 'PORT': '3306', # Set to empty string for default. + } +} + +# Hosts/domain names that are valid for this site; required if DEBUG is False +# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts +ALLOWED_HOSTS = [] + +# Local time zone for this installation. Choices can be found here: +# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name +# although not all choices may be available on all operating systems. +# In a Windows environment this must be set to your system time zone. + +# Always use local computer's time zone, find +import os, hashlib +if 'TZ' in os.environ: + TIME_ZONE = os.environ['TZ'] +else: + # need to read the /etc/localtime file which is the libc standard + # and do a reverse-mapping to /usr/share/zoneinfo/; + # since the timezone may match any number of identical timezone definitions, + + zonefilelist = {} + ZONEINFOPATH = '/usr/share/zoneinfo/' + for dirpath, dirnames, filenames in os.walk(ZONEINFOPATH): + for fn in filenames: + filepath = os.path.join(dirpath, fn) + zonename = filepath.lstrip(ZONEINFOPATH).strip() + try: + import pytz + from pytz.exceptions import UnknownTimeZoneError + pass + try: + if pytz.timezone(zonename) is not None: + zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename + except UnknownTimeZoneError, ValueError: + # we expect timezone failures here, just move over + pass + except ImportError: + zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename + + TIME_ZONE = zonefilelist[hashlib.md5(open('/etc/localtime').read()).hexdigest()] + +# Language code for this installation. All choices can be found here: +# http://www.i18nguy.com/unicode/language-identifiers.html +LANGUAGE_CODE = 'en-us' + +SITE_ID = 1 + +# If you set this to False, Django will make some optimizations so as not +# to load the internationalization machinery. +USE_I18N = True + +# If you set this to False, Django will not format dates, numbers and +# calendars according to the current locale. +USE_L10N = True + +# If you set this to False, Django will not use timezone-aware datetimes. +USE_TZ = True + +# Absolute filesystem path to the directory that will hold user-uploaded files. +# Example: "/var/www/example.com/media/" +MEDIA_ROOT = '' + +# URL that handles the media served from MEDIA_ROOT. Make sure to use a +# trailing slash. +# Examples: "http://example.com/media/", "http://media.example.com/" +MEDIA_URL = '' + +# Absolute path to the directory static files should be collected to. +# Don't put anything in this directory yourself; store your static files +# in apps' "static/" subdirectories and in STATICFILES_DIRS. +# Example: "/var/www/example.com/static/" +STATIC_ROOT = '' + +# URL prefix for static files. +# Example: "http://example.com/static/", "http://static.example.com/" +STATIC_URL = '/static/' + +# Additional locations of static files +STATICFILES_DIRS = ( + # Put strings here, like "/home/html/static" or "C:/www/django/static". + # Always use forward slashes, even on Windows. + # Don't forget to use absolute paths, not relative paths. +) + +# List of finder classes that know how to find static files in +# various locations. +STATICFILES_FINDERS = ( + 'django.contrib.staticfiles.finders.FileSystemFinder', + 'django.contrib.staticfiles.finders.AppDirectoriesFinder', +# 'django.contrib.staticfiles.finders.DefaultStorageFinder', +) + +# Make this unique, and don't share it with anybody. +SECRET_KEY = 'NOT_SUITABLE_FOR_HOSTED_DEPLOYMENT' + +# List of callables that know how to import templates from various sources. +TEMPLATE_LOADERS = ( + 'django.template.loaders.filesystem.Loader', + 'django.template.loaders.app_directories.Loader', +# 'django.template.loaders.eggs.Loader', +) + +MIDDLEWARE_CLASSES = ( + 'django.middleware.common.CommonMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + # Uncomment the next line for simple clickjacking protection: + # 'django.middleware.clickjacking.XFrameOptionsMiddleware', +) + +ROOT_URLCONF = 'toastermain.urls' + +# Python dotted path to the WSGI application used by Django's runserver. +WSGI_APPLICATION = 'toastermain.wsgi.application' + +TEMPLATE_DIRS = ( + # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". + # Always use forward slashes, even on Windows. + # Don't forget to use absolute paths, not relative paths. +) + +TEMPLATE_CONTEXT_PROCESSORS = ('django.contrib.auth.context_processors.auth', + 'django.core.context_processors.debug', + 'django.core.context_processors.i18n', + 'django.core.context_processors.media', + 'django.core.context_processors.static', + 'django.core.context_processors.tz', + 'django.contrib.messages.context_processors.messages', + "django.core.context_processors.request") + +INSTALLED_APPS = ( + #'django.contrib.auth', + #'django.contrib.contenttypes', + #'django.contrib.sessions', + #'django.contrib.sites', + #'django.contrib.messages', + 'django.contrib.staticfiles', + # Uncomment the next line to enable the admin: + # 'django.contrib.admin', + # Uncomment the next line to enable admin documentation: + # 'django.contrib.admindocs', + 'django.contrib.humanize', + 'orm', + 'toastermain', + 'toastergui', + 'bldviewer', + 'south', +) + +# A sample logging configuration. The only tangible logging +# performed by this configuration is to send an email to +# the site admins on every HTTP 500 error when DEBUG=False. +# See http://docs.djangoproject.com/en/dev/topics/logging for +# more details on how to customize your logging configuration. +LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'filters': { + 'require_debug_false': { + '()': 'django.utils.log.RequireDebugFalse' + } + }, + 'handlers': { + 'mail_admins': { + 'level': 'ERROR', + 'filters': ['require_debug_false'], + 'class': 'django.utils.log.AdminEmailHandler' + } + }, + 'loggers': { + 'django.request': { + 'handlers': ['mail_admins'], + 'level': 'ERROR', + 'propagate': True, + }, + } +} + +# If we're using sqlite, we need to tweak the performance a bit +from django.db.backends.signals import connection_created +def activate_synchronous_off(sender, connection, **kwargs): + if connection.vendor == 'sqlite': + cursor = connection.cursor() + cursor.execute('PRAGMA synchronous = 0;') +connection_created.connect(activate_synchronous_off) +# + + diff --git a/bitbake/lib/toaster/toastermain/urls.py b/bitbake/lib/toaster/toastermain/urls.py new file mode 100644 index 0000000000..ede5e4f96f --- /dev/null +++ b/bitbake/lib/toaster/toastermain/urls.py @@ -0,0 +1,44 @@ +# +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +# +# BitBake Toaster Implementation +# +# Copyright (C) 2013 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. + +from django.conf.urls import patterns, include, url +from django.views.generic import RedirectView +from django.views.decorators.cache import never_cache + + +# Uncomment the next two lines to enable the admin: +# from django.contrib import admin +# admin.autodiscover() + +urlpatterns = patterns('', + url(r'^simple/', include('bldviewer.urls')), + url(r'^api/1.0/', include('bldviewer.api')), + url(r'^gui/', include('toastergui.urls')), + url(r'^$', never_cache(RedirectView.as_view(url='/gui/'))), + # Examples: + # url(r'^toaster/', include('toaster.foo.urls')), + + # Uncomment the admin/doc line below to enable admin documentation: + # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), + + # Uncomment the next line to enable the admin: + # url(r'^admin/', include(admin.site.urls)), +) diff --git a/bitbake/lib/toaster/toastermain/wsgi.py b/bitbake/lib/toaster/toastermain/wsgi.py new file mode 100644 index 0000000000..031b314b1a --- /dev/null +++ b/bitbake/lib/toaster/toastermain/wsgi.py @@ -0,0 +1,35 @@ +""" +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +# +WSGI config for Toaster project. + +This module contains the WSGI application used by Django's development server +and any production WSGI deployments. It should expose a module-level variable +named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover +this application via the ``WSGI_APPLICATION`` setting. + +Usually you will have the standard Django WSGI application here, but it also +might make sense to replace the whole Django WSGI application with a custom one +that later delegates to the Django one. For example, you could introduce WSGI +middleware here, or combine a Django application with an application of another +framework. + +""" +import os + +# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks +# if running multiple sites in the same mod_wsgi process. To fix this, use +# mod_wsgi daemon mode with each site in its own daemon process, or use +# os.environ["DJANGO_SETTINGS_MODULE"] = "Toaster.settings" +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "toastermain.settings") + +# This application object is used by any WSGI server configured to use this +# file. This includes Django's development server, if the WSGI_APPLICATION +# setting points here. +from django.core.wsgi import get_wsgi_application +application = get_wsgi_application() + +# Apply WSGI middleware here. +# from helloworld.wsgi import HelloWorldApplication +# application = HelloWorldApplication(application) -- cgit v1.2.3-54-g00ecf