diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2013-10-11 13:46:23 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-10-18 11:13:49 +0100 |
commit | 164ab730ccb504b823f43b48de282de702ccf71b (patch) | |
tree | 3f8331f10df8fadab7b761f2a90416aa08507697 /bitbake/lib/toaster/toastermain | |
parent | d0072fc1391eda890268a91d692075b876f85914 (diff) | |
download | poky-164ab730ccb504b823f43b48de282de702ccf71b.tar.gz |
bitbake: toaster: add toaster code to bitbake
This patch adds the Toaster component to Bitbake.
Toaster is a module designed to record the progress of a
Bitbake build, and data about the resultant artifacts.
It contains a web-based interface and a REST API allowing
post-facto inspection of the build process and artifacts.
Features present in this build:
* toaster start script
* relational data model
* Django boilerplate code
* the REST API
* the Simple UI web interface
This patch has all the development history squashed together.
Code portions contributed by Calin Dragomir <calindragomir@gmail.com>.
(Bitbake rev: d24334a5e83d09b3ab227af485971bb768bf5412)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastermain')
-rw-r--r-- | bitbake/lib/toaster/toastermain/__init__.py | 0 | ||||
-rw-r--r-- | bitbake/lib/toaster/toastermain/settings.py | 190 | ||||
-rw-r--r-- | bitbake/lib/toaster/toastermain/urls.py | 41 | ||||
-rw-r--r-- | bitbake/lib/toaster/toastermain/wsgi.py | 32 |
4 files changed, 263 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastermain/__init__.py b/bitbake/lib/toaster/toastermain/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/bitbake/lib/toaster/toastermain/__init__.py | |||
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py new file mode 100644 index 0000000000..dd1e25c087 --- /dev/null +++ b/bitbake/lib/toaster/toastermain/settings.py | |||
@@ -0,0 +1,190 @@ | |||
1 | # | ||
2 | # BitBake Toaster Implementation | ||
3 | # | ||
4 | # Copyright (C) 2013 Intel Corporation | ||
5 | # | ||
6 | # This program is free software; you can redistribute it and/or modify | ||
7 | # it under the terms of the GNU General Public License version 2 as | ||
8 | # published by the Free Software Foundation. | ||
9 | # | ||
10 | # This program is distributed in the hope that it will be useful, | ||
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | # GNU General Public License for more details. | ||
14 | # | ||
15 | # You should have received a copy of the GNU General Public License along | ||
16 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
17 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
18 | |||
19 | # Django settings for Toaster project. | ||
20 | |||
21 | DEBUG = True | ||
22 | TEMPLATE_DEBUG = DEBUG | ||
23 | |||
24 | ADMINS = ( | ||
25 | # ('Your Name', 'your_email@example.com'), | ||
26 | ) | ||
27 | |||
28 | MANAGERS = ADMINS | ||
29 | |||
30 | DATABASES = { | ||
31 | 'default': { | ||
32 | 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. | ||
33 | 'NAME': 'toaster.sqlite', # Or path to database file if using sqlite3. | ||
34 | 'USER': '', | ||
35 | 'PASSWORD': '', | ||
36 | 'HOST': '127.0.0.1', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. | ||
37 | 'PORT': '3306', # Set to empty string for default. | ||
38 | } | ||
39 | } | ||
40 | |||
41 | # Hosts/domain names that are valid for this site; required if DEBUG is False | ||
42 | # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts | ||
43 | ALLOWED_HOSTS = [] | ||
44 | |||
45 | # Local time zone for this installation. Choices can be found here: | ||
46 | # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name | ||
47 | # although not all choices may be available on all operating systems. | ||
48 | # In a Windows environment this must be set to your system time zone. | ||
49 | |||
50 | # Always use local computer's time zone | ||
51 | #TIME_ZONE = '' | ||
52 | |||
53 | # Language code for this installation. All choices can be found here: | ||
54 | # http://www.i18nguy.com/unicode/language-identifiers.html | ||
55 | LANGUAGE_CODE = 'en-us' | ||
56 | |||
57 | SITE_ID = 1 | ||
58 | |||
59 | # If you set this to False, Django will make some optimizations so as not | ||
60 | # to load the internationalization machinery. | ||
61 | USE_I18N = True | ||
62 | |||
63 | # If you set this to False, Django will not format dates, numbers and | ||
64 | # calendars according to the current locale. | ||
65 | USE_L10N = True | ||
66 | |||
67 | # If you set this to False, Django will not use timezone-aware datetimes. | ||
68 | USE_TZ = False | ||
69 | |||
70 | # Absolute filesystem path to the directory that will hold user-uploaded files. | ||
71 | # Example: "/var/www/example.com/media/" | ||
72 | MEDIA_ROOT = '' | ||
73 | |||
74 | # URL that handles the media served from MEDIA_ROOT. Make sure to use a | ||
75 | # trailing slash. | ||
76 | # Examples: "http://example.com/media/", "http://media.example.com/" | ||
77 | MEDIA_URL = '' | ||
78 | |||
79 | # Absolute path to the directory static files should be collected to. | ||
80 | # Don't put anything in this directory yourself; store your static files | ||
81 | # in apps' "static/" subdirectories and in STATICFILES_DIRS. | ||
82 | # Example: "/var/www/example.com/static/" | ||
83 | STATIC_ROOT = '' | ||
84 | |||
85 | # URL prefix for static files. | ||
86 | # Example: "http://example.com/static/", "http://static.example.com/" | ||
87 | STATIC_URL = '/static/' | ||
88 | |||
89 | # Additional locations of static files | ||
90 | STATICFILES_DIRS = ( | ||
91 | # Put strings here, like "/home/html/static" or "C:/www/django/static". | ||
92 | # Always use forward slashes, even on Windows. | ||
93 | # Don't forget to use absolute paths, not relative paths. | ||
94 | ) | ||
95 | |||
96 | # List of finder classes that know how to find static files in | ||
97 | # various locations. | ||
98 | STATICFILES_FINDERS = ( | ||
99 | 'django.contrib.staticfiles.finders.FileSystemFinder', | ||
100 | 'django.contrib.staticfiles.finders.AppDirectoriesFinder', | ||
101 | # 'django.contrib.staticfiles.finders.DefaultStorageFinder', | ||
102 | ) | ||
103 | |||
104 | # Make this unique, and don't share it with anybody. | ||
105 | SECRET_KEY = 'NOT_SUITABLE_FOR_HOSTED_DEPLOYMENT' | ||
106 | |||
107 | # List of callables that know how to import templates from various sources. | ||
108 | TEMPLATE_LOADERS = ( | ||
109 | 'django.template.loaders.filesystem.Loader', | ||
110 | 'django.template.loaders.app_directories.Loader', | ||
111 | # 'django.template.loaders.eggs.Loader', | ||
112 | ) | ||
113 | |||
114 | MIDDLEWARE_CLASSES = ( | ||
115 | 'django.middleware.common.CommonMiddleware', | ||
116 | 'django.contrib.sessions.middleware.SessionMiddleware', | ||
117 | 'django.middleware.csrf.CsrfViewMiddleware', | ||
118 | 'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
119 | 'django.contrib.messages.middleware.MessageMiddleware', | ||
120 | # Uncomment the next line for simple clickjacking protection: | ||
121 | # 'django.middleware.clickjacking.XFrameOptionsMiddleware', | ||
122 | ) | ||
123 | |||
124 | ROOT_URLCONF = 'toastermain.urls' | ||
125 | |||
126 | # Python dotted path to the WSGI application used by Django's runserver. | ||
127 | WSGI_APPLICATION = 'toastermain.wsgi.application' | ||
128 | |||
129 | TEMPLATE_DIRS = ( | ||
130 | # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". | ||
131 | # Always use forward slashes, even on Windows. | ||
132 | # Don't forget to use absolute paths, not relative paths. | ||
133 | ) | ||
134 | |||
135 | INSTALLED_APPS = ( | ||
136 | #'django.contrib.auth', | ||
137 | #'django.contrib.contenttypes', | ||
138 | #'django.contrib.sessions', | ||
139 | #'django.contrib.sites', | ||
140 | #'django.contrib.messages', | ||
141 | 'django.contrib.staticfiles', | ||
142 | # Uncomment the next line to enable the admin: | ||
143 | # 'django.contrib.admin', | ||
144 | # Uncomment the next line to enable admin documentation: | ||
145 | # 'django.contrib.admindocs', | ||
146 | 'orm', | ||
147 | 'toastermain', | ||
148 | 'bldviewer', | ||
149 | 'toastergui', | ||
150 | ) | ||
151 | |||
152 | # A sample logging configuration. The only tangible logging | ||
153 | # performed by this configuration is to send an email to | ||
154 | # the site admins on every HTTP 500 error when DEBUG=False. | ||
155 | # See http://docs.djangoproject.com/en/dev/topics/logging for | ||
156 | # more details on how to customize your logging configuration. | ||
157 | LOGGING = { | ||
158 | 'version': 1, | ||
159 | 'disable_existing_loggers': False, | ||
160 | 'filters': { | ||
161 | 'require_debug_false': { | ||
162 | '()': 'django.utils.log.RequireDebugFalse' | ||
163 | } | ||
164 | }, | ||
165 | 'handlers': { | ||
166 | 'mail_admins': { | ||
167 | 'level': 'ERROR', | ||
168 | 'filters': ['require_debug_false'], | ||
169 | 'class': 'django.utils.log.AdminEmailHandler' | ||
170 | } | ||
171 | }, | ||
172 | 'loggers': { | ||
173 | 'django.request': { | ||
174 | 'handlers': ['mail_admins'], | ||
175 | 'level': 'ERROR', | ||
176 | 'propagate': True, | ||
177 | }, | ||
178 | } | ||
179 | } | ||
180 | |||
181 | # If we're using sqlite, we need to tweak the performance a bit | ||
182 | from django.db.backends.signals import connection_created | ||
183 | def activate_synchronous_off(sender, connection, **kwargs): | ||
184 | if connection.vendor == 'sqlite': | ||
185 | cursor = connection.cursor() | ||
186 | cursor.execute('PRAGMA synchronous = 0;') | ||
187 | connection_created.connect(activate_synchronous_off) | ||
188 | # | ||
189 | |||
190 | |||
diff --git a/bitbake/lib/toaster/toastermain/urls.py b/bitbake/lib/toaster/toastermain/urls.py new file mode 100644 index 0000000000..d0606bce9e --- /dev/null +++ b/bitbake/lib/toaster/toastermain/urls.py | |||
@@ -0,0 +1,41 @@ | |||
1 | # | ||
2 | # BitBake Toaster Implementation | ||
3 | # | ||
4 | # Copyright (C) 2013 Intel Corporation | ||
5 | # | ||
6 | # This program is free software; you can redistribute it and/or modify | ||
7 | # it under the terms of the GNU General Public License version 2 as | ||
8 | # published by the Free Software Foundation. | ||
9 | # | ||
10 | # This program is distributed in the hope that it will be useful, | ||
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | # GNU General Public License for more details. | ||
14 | # | ||
15 | # You should have received a copy of the GNU General Public License along | ||
16 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
17 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
18 | |||
19 | from django.conf.urls import patterns, include, url | ||
20 | from django.views.generic.simple import redirect_to | ||
21 | from django.views.decorators.cache import never_cache | ||
22 | |||
23 | |||
24 | # Uncomment the next two lines to enable the admin: | ||
25 | # from django.contrib import admin | ||
26 | # admin.autodiscover() | ||
27 | |||
28 | urlpatterns = patterns('', | ||
29 | url(r'^simple/', include('bldviewer.urls')), | ||
30 | url(r'^api/1.0/', include('bldviewer.api')), | ||
31 | url(r'^gui/', include('toastergui.urls')), | ||
32 | url(r'^$', never_cache(redirect_to), {'url': '/simple/'}), | ||
33 | # Examples: | ||
34 | # url(r'^toaster/', include('toaster.foo.urls')), | ||
35 | |||
36 | # Uncomment the admin/doc line below to enable admin documentation: | ||
37 | # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), | ||
38 | |||
39 | # Uncomment the next line to enable the admin: | ||
40 | # url(r'^admin/', include(admin.site.urls)), | ||
41 | ) | ||
diff --git a/bitbake/lib/toaster/toastermain/wsgi.py b/bitbake/lib/toaster/toastermain/wsgi.py new file mode 100644 index 0000000000..6277eb4d5e --- /dev/null +++ b/bitbake/lib/toaster/toastermain/wsgi.py | |||
@@ -0,0 +1,32 @@ | |||
1 | """ | ||
2 | WSGI config for Toaster project. | ||
3 | |||
4 | This module contains the WSGI application used by Django's development server | ||
5 | and any production WSGI deployments. It should expose a module-level variable | ||
6 | named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover | ||
7 | this application via the ``WSGI_APPLICATION`` setting. | ||
8 | |||
9 | Usually you will have the standard Django WSGI application here, but it also | ||
10 | might make sense to replace the whole Django WSGI application with a custom one | ||
11 | that later delegates to the Django one. For example, you could introduce WSGI | ||
12 | middleware here, or combine a Django application with an application of another | ||
13 | framework. | ||
14 | |||
15 | """ | ||
16 | import os | ||
17 | |||
18 | # We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks | ||
19 | # if running multiple sites in the same mod_wsgi process. To fix this, use | ||
20 | # mod_wsgi daemon mode with each site in its own daemon process, or use | ||
21 | # os.environ["DJANGO_SETTINGS_MODULE"] = "Toaster.settings" | ||
22 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "toastermain.settings") | ||
23 | |||
24 | # This application object is used by any WSGI server configured to use this | ||
25 | # file. This includes Django's development server, if the WSGI_APPLICATION | ||
26 | # setting points here. | ||
27 | from django.core.wsgi import get_wsgi_application | ||
28 | application = get_wsgi_application() | ||
29 | |||
30 | # Apply WSGI middleware here. | ||
31 | # from helloworld.wsgi import HelloWorldApplication | ||
32 | # application = HelloWorldApplication(application) | ||