diff options
Diffstat (limited to 'bitbake/lib/toaster/toastermain')
8 files changed, 356 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/management/__init__.py b/bitbake/lib/toaster/toastermain/management/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/bitbake/lib/toaster/toastermain/management/__init__.py | |||
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 --- /dev/null +++ b/bitbake/lib/toaster/toastermain/management/commands/__init__.py | |||
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 @@ | |||
1 | from django.core.management.base import BaseCommand, CommandError | ||
2 | from orm.models import Build | ||
3 | import os | ||
4 | |||
5 | |||
6 | |||
7 | class Command(BaseCommand): | ||
8 | args = "buildId" | ||
9 | help = "Deletes selected build" | ||
10 | |||
11 | def handle(self, buildId, *args, **options): | ||
12 | b = Build.objects.get(pk = buildId) | ||
13 | # theoretically, just b.delete() would suffice | ||
14 | # however SQLite runs into problems when you try to | ||
15 | # delete too many rows at once, so we delete some direct | ||
16 | # relationships from Build manually. | ||
17 | |||
18 | for t in b.target_set.all(): | ||
19 | t.delete() | ||
20 | for t in b.task_build.all(): | ||
21 | t.delete() | ||
22 | for p in b.package_set.all(): | ||
23 | p.delete() | ||
24 | for lv in b.layer_version_build.all(): | ||
25 | lv.delete() | ||
26 | for v in b.variable_build.all(): | ||
27 | v.delete() | ||
28 | for l in b.logmessage_set.all(): | ||
29 | l.delete() | ||
30 | |||
31 | # this should take care of the rest | ||
32 | b.delete() | ||
33 | |||
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 @@ | |||
1 | from django.core.management.base import NoArgsCommand, CommandError | ||
2 | from orm.models import Build | ||
3 | import os | ||
4 | |||
5 | |||
6 | |||
7 | class Command(NoArgsCommand): | ||
8 | args = "" | ||
9 | help = "Lists current builds" | ||
10 | |||
11 | def handle_noargs(self,**options): | ||
12 | for b in Build.objects.all(): | ||
13 | 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 @@ | |||
1 | # | ||
2 | # ex:ts=4:sw=4:sts=4:et | ||
3 | # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- | ||
4 | # | ||
5 | # BitBake Toaster Implementation | ||
6 | # | ||
7 | # Copyright (C) 2013 Intel Corporation | ||
8 | # | ||
9 | # This program is free software; you can redistribute it and/or modify | ||
10 | # it under the terms of the GNU General Public License version 2 as | ||
11 | # published by the Free Software Foundation. | ||
12 | # | ||
13 | # This program is distributed in the hope that it will be useful, | ||
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | # GNU General Public License for more details. | ||
17 | # | ||
18 | # You should have received a copy of the GNU General Public License along | ||
19 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
20 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
21 | |||
22 | # Django settings for Toaster project. | ||
23 | |||
24 | DEBUG = True | ||
25 | TEMPLATE_DEBUG = DEBUG | ||
26 | |||
27 | ADMINS = ( | ||
28 | # ('Your Name', 'your_email@example.com'), | ||
29 | ) | ||
30 | |||
31 | MANAGERS = ADMINS | ||
32 | |||
33 | DATABASES = { | ||
34 | 'default': { | ||
35 | 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. | ||
36 | 'NAME': 'toaster.sqlite', # Or path to database file if using sqlite3. | ||
37 | 'USER': '', | ||
38 | 'PASSWORD': '', | ||
39 | 'HOST': '127.0.0.1', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. | ||
40 | 'PORT': '3306', # Set to empty string for default. | ||
41 | } | ||
42 | } | ||
43 | |||
44 | # Hosts/domain names that are valid for this site; required if DEBUG is False | ||
45 | # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts | ||
46 | ALLOWED_HOSTS = [] | ||
47 | |||
48 | # Local time zone for this installation. Choices can be found here: | ||
49 | # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name | ||
50 | # although not all choices may be available on all operating systems. | ||
51 | # In a Windows environment this must be set to your system time zone. | ||
52 | |||
53 | # Always use local computer's time zone, find | ||
54 | import os, hashlib | ||
55 | if 'TZ' in os.environ: | ||
56 | TIME_ZONE = os.environ['TZ'] | ||
57 | else: | ||
58 | # need to read the /etc/localtime file which is the libc standard | ||
59 | # and do a reverse-mapping to /usr/share/zoneinfo/; | ||
60 | # since the timezone may match any number of identical timezone definitions, | ||
61 | |||
62 | zonefilelist = {} | ||
63 | ZONEINFOPATH = '/usr/share/zoneinfo/' | ||
64 | for dirpath, dirnames, filenames in os.walk(ZONEINFOPATH): | ||
65 | for fn in filenames: | ||
66 | filepath = os.path.join(dirpath, fn) | ||
67 | zonename = filepath.lstrip(ZONEINFOPATH).strip() | ||
68 | try: | ||
69 | import pytz | ||
70 | from pytz.exceptions import UnknownTimeZoneError | ||
71 | pass | ||
72 | try: | ||
73 | if pytz.timezone(zonename) is not None: | ||
74 | zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename | ||
75 | except UnknownTimeZoneError, ValueError: | ||
76 | # we expect timezone failures here, just move over | ||
77 | pass | ||
78 | except ImportError: | ||
79 | zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename | ||
80 | |||
81 | TIME_ZONE = zonefilelist[hashlib.md5(open('/etc/localtime').read()).hexdigest()] | ||
82 | |||
83 | # Language code for this installation. All choices can be found here: | ||
84 | # http://www.i18nguy.com/unicode/language-identifiers.html | ||
85 | LANGUAGE_CODE = 'en-us' | ||
86 | |||
87 | SITE_ID = 1 | ||
88 | |||
89 | # If you set this to False, Django will make some optimizations so as not | ||
90 | # to load the internationalization machinery. | ||
91 | USE_I18N = True | ||
92 | |||
93 | # If you set this to False, Django will not format dates, numbers and | ||
94 | # calendars according to the current locale. | ||
95 | USE_L10N = True | ||
96 | |||
97 | # If you set this to False, Django will not use timezone-aware datetimes. | ||
98 | USE_TZ = True | ||
99 | |||
100 | # Absolute filesystem path to the directory that will hold user-uploaded files. | ||
101 | # Example: "/var/www/example.com/media/" | ||
102 | MEDIA_ROOT = '' | ||
103 | |||
104 | # URL that handles the media served from MEDIA_ROOT. Make sure to use a | ||
105 | # trailing slash. | ||
106 | # Examples: "http://example.com/media/", "http://media.example.com/" | ||
107 | MEDIA_URL = '' | ||
108 | |||
109 | # Absolute path to the directory static files should be collected to. | ||
110 | # Don't put anything in this directory yourself; store your static files | ||
111 | # in apps' "static/" subdirectories and in STATICFILES_DIRS. | ||
112 | # Example: "/var/www/example.com/static/" | ||
113 | STATIC_ROOT = '' | ||
114 | |||
115 | # URL prefix for static files. | ||
116 | # Example: "http://example.com/static/", "http://static.example.com/" | ||
117 | STATIC_URL = '/static/' | ||
118 | |||
119 | # Additional locations of static files | ||
120 | STATICFILES_DIRS = ( | ||
121 | # Put strings here, like "/home/html/static" or "C:/www/django/static". | ||
122 | # Always use forward slashes, even on Windows. | ||
123 | # Don't forget to use absolute paths, not relative paths. | ||
124 | ) | ||
125 | |||
126 | # List of finder classes that know how to find static files in | ||
127 | # various locations. | ||
128 | STATICFILES_FINDERS = ( | ||
129 | 'django.contrib.staticfiles.finders.FileSystemFinder', | ||
130 | 'django.contrib.staticfiles.finders.AppDirectoriesFinder', | ||
131 | # 'django.contrib.staticfiles.finders.DefaultStorageFinder', | ||
132 | ) | ||
133 | |||
134 | # Make this unique, and don't share it with anybody. | ||
135 | SECRET_KEY = 'NOT_SUITABLE_FOR_HOSTED_DEPLOYMENT' | ||
136 | |||
137 | # List of callables that know how to import templates from various sources. | ||
138 | TEMPLATE_LOADERS = ( | ||
139 | 'django.template.loaders.filesystem.Loader', | ||
140 | 'django.template.loaders.app_directories.Loader', | ||
141 | # 'django.template.loaders.eggs.Loader', | ||
142 | ) | ||
143 | |||
144 | MIDDLEWARE_CLASSES = ( | ||
145 | 'django.middleware.common.CommonMiddleware', | ||
146 | 'django.contrib.sessions.middleware.SessionMiddleware', | ||
147 | 'django.middleware.csrf.CsrfViewMiddleware', | ||
148 | 'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
149 | 'django.contrib.messages.middleware.MessageMiddleware', | ||
150 | # Uncomment the next line for simple clickjacking protection: | ||
151 | # 'django.middleware.clickjacking.XFrameOptionsMiddleware', | ||
152 | ) | ||
153 | |||
154 | ROOT_URLCONF = 'toastermain.urls' | ||
155 | |||
156 | # Python dotted path to the WSGI application used by Django's runserver. | ||
157 | WSGI_APPLICATION = 'toastermain.wsgi.application' | ||
158 | |||
159 | TEMPLATE_DIRS = ( | ||
160 | # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". | ||
161 | # Always use forward slashes, even on Windows. | ||
162 | # Don't forget to use absolute paths, not relative paths. | ||
163 | ) | ||
164 | |||
165 | TEMPLATE_CONTEXT_PROCESSORS = ('django.contrib.auth.context_processors.auth', | ||
166 | 'django.core.context_processors.debug', | ||
167 | 'django.core.context_processors.i18n', | ||
168 | 'django.core.context_processors.media', | ||
169 | 'django.core.context_processors.static', | ||
170 | 'django.core.context_processors.tz', | ||
171 | 'django.contrib.messages.context_processors.messages', | ||
172 | "django.core.context_processors.request") | ||
173 | |||
174 | INSTALLED_APPS = ( | ||
175 | #'django.contrib.auth', | ||
176 | #'django.contrib.contenttypes', | ||
177 | #'django.contrib.sessions', | ||
178 | #'django.contrib.sites', | ||
179 | #'django.contrib.messages', | ||
180 | 'django.contrib.staticfiles', | ||
181 | # Uncomment the next line to enable the admin: | ||
182 | # 'django.contrib.admin', | ||
183 | # Uncomment the next line to enable admin documentation: | ||
184 | # 'django.contrib.admindocs', | ||
185 | 'django.contrib.humanize', | ||
186 | 'orm', | ||
187 | 'toastermain', | ||
188 | 'toastergui', | ||
189 | 'bldviewer', | ||
190 | 'south', | ||
191 | ) | ||
192 | |||
193 | # A sample logging configuration. The only tangible logging | ||
194 | # performed by this configuration is to send an email to | ||
195 | # the site admins on every HTTP 500 error when DEBUG=False. | ||
196 | # See http://docs.djangoproject.com/en/dev/topics/logging for | ||
197 | # more details on how to customize your logging configuration. | ||
198 | LOGGING = { | ||
199 | 'version': 1, | ||
200 | 'disable_existing_loggers': False, | ||
201 | 'filters': { | ||
202 | 'require_debug_false': { | ||
203 | '()': 'django.utils.log.RequireDebugFalse' | ||
204 | } | ||
205 | }, | ||
206 | 'handlers': { | ||
207 | 'mail_admins': { | ||
208 | 'level': 'ERROR', | ||
209 | 'filters': ['require_debug_false'], | ||
210 | 'class': 'django.utils.log.AdminEmailHandler' | ||
211 | } | ||
212 | }, | ||
213 | 'loggers': { | ||
214 | 'django.request': { | ||
215 | 'handlers': ['mail_admins'], | ||
216 | 'level': 'ERROR', | ||
217 | 'propagate': True, | ||
218 | }, | ||
219 | } | ||
220 | } | ||
221 | |||
222 | # If we're using sqlite, we need to tweak the performance a bit | ||
223 | from django.db.backends.signals import connection_created | ||
224 | def activate_synchronous_off(sender, connection, **kwargs): | ||
225 | if connection.vendor == 'sqlite': | ||
226 | cursor = connection.cursor() | ||
227 | cursor.execute('PRAGMA synchronous = 0;') | ||
228 | connection_created.connect(activate_synchronous_off) | ||
229 | # | ||
230 | |||
231 | |||
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 @@ | |||
1 | # | ||
2 | # ex:ts=4:sw=4:sts=4:et | ||
3 | # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- | ||
4 | # | ||
5 | # BitBake Toaster Implementation | ||
6 | # | ||
7 | # Copyright (C) 2013 Intel Corporation | ||
8 | # | ||
9 | # This program is free software; you can redistribute it and/or modify | ||
10 | # it under the terms of the GNU General Public License version 2 as | ||
11 | # published by the Free Software Foundation. | ||
12 | # | ||
13 | # This program is distributed in the hope that it will be useful, | ||
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | # GNU General Public License for more details. | ||
17 | # | ||
18 | # You should have received a copy of the GNU General Public License along | ||
19 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
20 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
21 | |||
22 | from django.conf.urls import patterns, include, url | ||
23 | from django.views.generic import RedirectView | ||
24 | from django.views.decorators.cache import never_cache | ||
25 | |||
26 | |||
27 | # Uncomment the next two lines to enable the admin: | ||
28 | # from django.contrib import admin | ||
29 | # admin.autodiscover() | ||
30 | |||
31 | urlpatterns = patterns('', | ||
32 | url(r'^simple/', include('bldviewer.urls')), | ||
33 | url(r'^api/1.0/', include('bldviewer.api')), | ||
34 | url(r'^gui/', include('toastergui.urls')), | ||
35 | url(r'^$', never_cache(RedirectView.as_view(url='/gui/'))), | ||
36 | # Examples: | ||
37 | # url(r'^toaster/', include('toaster.foo.urls')), | ||
38 | |||
39 | # Uncomment the admin/doc line below to enable admin documentation: | ||
40 | # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), | ||
41 | |||
42 | # Uncomment the next line to enable the admin: | ||
43 | # url(r'^admin/', include(admin.site.urls)), | ||
44 | ) | ||
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 @@ | |||
1 | """ | ||
2 | # ex:ts=4:sw=4:sts=4:et | ||
3 | # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- | ||
4 | # | ||
5 | WSGI config for Toaster project. | ||
6 | |||
7 | This module contains the WSGI application used by Django's development server | ||
8 | and any production WSGI deployments. It should expose a module-level variable | ||
9 | named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover | ||
10 | this application via the ``WSGI_APPLICATION`` setting. | ||
11 | |||
12 | Usually you will have the standard Django WSGI application here, but it also | ||
13 | might make sense to replace the whole Django WSGI application with a custom one | ||
14 | that later delegates to the Django one. For example, you could introduce WSGI | ||
15 | middleware here, or combine a Django application with an application of another | ||
16 | framework. | ||
17 | |||
18 | """ | ||
19 | import os | ||
20 | |||
21 | # We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks | ||
22 | # if running multiple sites in the same mod_wsgi process. To fix this, use | ||
23 | # mod_wsgi daemon mode with each site in its own daemon process, or use | ||
24 | # os.environ["DJANGO_SETTINGS_MODULE"] = "Toaster.settings" | ||
25 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "toastermain.settings") | ||
26 | |||
27 | # This application object is used by any WSGI server configured to use this | ||
28 | # file. This includes Django's development server, if the WSGI_APPLICATION | ||
29 | # setting points here. | ||
30 | from django.core.wsgi import get_wsgi_application | ||
31 | application = get_wsgi_application() | ||
32 | |||
33 | # Apply WSGI middleware here. | ||
34 | # from helloworld.wsgi import HelloWorldApplication | ||
35 | # application = HelloWorldApplication(application) | ||