summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2013-10-11 13:46:23 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-10-18 11:13:49 +0100
commit164ab730ccb504b823f43b48de282de702ccf71b (patch)
tree3f8331f10df8fadab7b761f2a90416aa08507697 /bitbake/lib
parentd0072fc1391eda890268a91d692075b876f85914 (diff)
downloadpoky-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')
-rw-r--r--bitbake/lib/toaster/__init__.py0
-rw-r--r--bitbake/lib/toaster/bldviewer/__init__.py0
-rw-r--r--bitbake/lib/toaster/bldviewer/api.py37
-rw-r--r--bitbake/lib/toaster/bldviewer/templates/base.html30
-rw-r--r--bitbake/lib/toaster/bldviewer/templates/basebuildpage.html17
-rw-r--r--bitbake/lib/toaster/bldviewer/templates/basetable.html46
-rw-r--r--bitbake/lib/toaster/bldviewer/templates/bfile.html24
-rw-r--r--bitbake/lib/toaster/bldviewer/templates/bpackage.html44
-rw-r--r--bitbake/lib/toaster/bldviewer/templates/build.html43
-rw-r--r--bitbake/lib/toaster/bldviewer/templates/configuration.html20
-rw-r--r--bitbake/lib/toaster/bldviewer/templates/layer.html34
-rw-r--r--bitbake/lib/toaster/bldviewer/templates/package.html36
-rw-r--r--bitbake/lib/toaster/bldviewer/templates/recipe.html54
-rw-r--r--bitbake/lib/toaster/bldviewer/templates/task.html63
-rw-r--r--bitbake/lib/toaster/bldviewer/templatetags/__init__.py0
-rw-r--r--bitbake/lib/toaster/bldviewer/templatetags/projecttags.py26
-rw-r--r--bitbake/lib/toaster/bldviewer/urls.py32
-rw-r--r--bitbake/lib/toaster/bldviewer/views.py260
-rwxr-xr-xbitbake/lib/toaster/manage.py10
-rw-r--r--bitbake/lib/toaster/orm/__init__.py0
-rw-r--r--bitbake/lib/toaster/orm/models.py258
-rw-r--r--bitbake/lib/toaster/toastergui/__init__.py0
-rw-r--r--bitbake/lib/toaster/toastergui/static/images/yocto.jpgbin0 -> 6582 bytes
-rw-r--r--bitbake/lib/toaster/toastergui/templates/index.html13
-rw-r--r--bitbake/lib/toaster/toastergui/urls.py27
-rw-r--r--bitbake/lib/toaster/toastergui/views.py26
-rw-r--r--bitbake/lib/toaster/toastermain/__init__.py0
-rw-r--r--bitbake/lib/toaster/toastermain/settings.py190
-rw-r--r--bitbake/lib/toaster/toastermain/urls.py41
-rw-r--r--bitbake/lib/toaster/toastermain/wsgi.py32
30 files changed, 1363 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/__init__.py b/bitbake/lib/toaster/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/bitbake/lib/toaster/__init__.py
diff --git a/bitbake/lib/toaster/bldviewer/__init__.py b/bitbake/lib/toaster/bldviewer/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/bitbake/lib/toaster/bldviewer/__init__.py
diff --git a/bitbake/lib/toaster/bldviewer/api.py b/bitbake/lib/toaster/bldviewer/api.py
new file mode 100644
index 0000000000..f761ba65a9
--- /dev/null
+++ b/bitbake/lib/toaster/bldviewer/api.py
@@ -0,0 +1,37 @@
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
19from django.conf.urls import patterns, include, url
20
21
22urlpatterns = patterns('bldviewer.views',
23 url(r'^builds$', 'model_explorer', {'model_name':'build'}, name='builds'),
24 url(r'^targets$', 'model_explorer', {'model_name':'target'}, name='targets'),
25 url(r'^tasks$', 'model_explorer', {'model_name':'task'}, name='task'),
26 url(r'^task_dependencies$', 'model_explorer', {'model_name':'task_dependency'}, name='task_dependencies'),
27 url(r'^packages$', 'model_explorer', {'model_name':'build_package'}, name='build_packages'),
28 url(r'^package_dependencies$', 'model_explorer', {'model_name':'build_package_dependency'}, name='build_package_dependencies'),
29 url(r'^target_packages$', 'model_explorer', {'model_name':'target_package'}, name='target_packages'),
30 url(r'^package_files$', 'model_explorer', {'model_name':'build_file'}, name='build_files'),
31 url(r'^layers$', 'model_explorer', {'model_name':'layer'}, name='layer'),
32 url(r'^layerversions$', 'model_explorer', {'model_name':'layerversion'}, name='layerversion'),
33 url(r'^recipes$', 'model_explorer', {'model_name':'recipe'}, name='recipe'),
34 url(r'^recipe_dependencies$', 'model_explorer', {'model_name':'recipe_dependency'}, name='recipe_dependencies'),
35 url(r'^variables$', 'model_explorer', {'model_name':'variable'}, name='variables'),
36 url(r'^logmessages$', 'model_explorer', {'model_name':'logmessage'}, name='logmessages'),
37)
diff --git a/bitbake/lib/toaster/bldviewer/templates/base.html b/bitbake/lib/toaster/bldviewer/templates/base.html
new file mode 100644
index 0000000000..101880d3ea
--- /dev/null
+++ b/bitbake/lib/toaster/bldviewer/templates/base.html
@@ -0,0 +1,30 @@
1<!DOCTYPE html>
2{% load static %}
3<html>
4 <head>
5 <title>Toaster Simple Explorer</title>
6<script src="{% static 'js/jquery-2.0.3.js' %}">
7</script>
8<script src="{% static 'js/bootstrap.js' %}">
9</script>
10<link href="{% static 'css/bootstrap.css' %}" rel="stylesheet" type="text/css">
11 </head>
12
13<body style="height: 100%">
14<div style="width:100%; height: 100%; position:absolute">
15<div style="width: 100%; height: 3em" class="nav">
16 <ul class="nav nav-tabs">
17 <li><a href="{% url all-builds %}">All Builds</a></li>
18 <li><a href="{% url all-layers %}">All Layers</a></li>
19 </ul>
20</div>
21
22<div style="overflow-y:scroll; width: 100%; position: absolute; top: 3em; bottom:70px ">
23{% block pagecontent %}
24{% endblock %}
25</div>
26<div class="navbar" style="position: absolute; bottom: 0; width:100%"><br/>About Toaster | Yocto Project </div>
27</div>
28</body>
29</html>
30
diff --git a/bitbake/lib/toaster/bldviewer/templates/basebuildpage.html b/bitbake/lib/toaster/bldviewer/templates/basebuildpage.html
new file mode 100644
index 0000000000..873f271bab
--- /dev/null
+++ b/bitbake/lib/toaster/bldviewer/templates/basebuildpage.html
@@ -0,0 +1,17 @@
1{% extends "basetable.html" %}
2
3{% block pagename %}
4<ul class="nav nav-tabs" style="display: inline-block">
5 <li><a>Build {{build.target_set.all|join:"&nbsp;"}} at {{build.started_on}} : </a></li>
6 <li><a href="{% url task build.id %}"> Tasks </a></li>
7 <li><a href="{% url bpackage build.id %}"> Build Packages </a></li>
8 {% for t in build.target_set.all %}
9 {% if t.is_image %}
10 <li><a href="{% url tpackage build.id t.pk %}"> Packages for {{t.target}} </a> </li>
11 {% endif %}
12 {% endfor %}
13 <li><a href="{% url configuration build.id %}"> Configuration </a> </li>
14</ul>
15 <h1>Toaster - Build {% block pagetitle %} {% endblock %}</h1>
16{% endblock %}
17
diff --git a/bitbake/lib/toaster/bldviewer/templates/basetable.html b/bitbake/lib/toaster/bldviewer/templates/basetable.html
new file mode 100644
index 0000000000..083bcb82e9
--- /dev/null
+++ b/bitbake/lib/toaster/bldviewer/templates/basetable.html
@@ -0,0 +1,46 @@
1{% extends "base.html" %}
2
3{% block pagecontent %}
4<script>
5function showhideTableColumn(i, sh) {
6 if (sh)
7 $('td:nth-child('+i+'),th:nth-child('+i+')').show();
8 else
9 $('td:nth-child('+i+'),th:nth-child('+i+')').hide();
10}
11
12
13function filterTableRows(test) {
14 if (test.length > 0) {
15 var r = test.split(/[ ,]+/).map(function (e) { return new RegExp(e, 'i') });
16 $('tr.data').map( function (i, el) {
17 (! r.map(function (j) { return j.test($(el).html())}).reduce(function (c, p) { return c && p;} )) ? $(el).hide() : $(el).show();
18 });
19 } else
20 {
21 $('tr.data').show();
22 }
23}
24</script>
25<div style="margin-bottom: 0.5em">
26
27 {% block pagename %}
28 {% endblock %}
29 <div align="left" style="display:inline-block; width: 40%; margin-left: 2em"> Search: <input type="search" id="filterstring" style="width: 80%" onkeyup="filterTableRows($('#filterstring').val())" autocomplete="off">
30 </div>
31 {% if hideshowcols %}
32 <div align="right" style="display: inline-block; width: 40%">Show/Hide columns:
33 {% for i in hideshowcols %}
34 <span>{{i.name}} <input type="checkbox" id="ct{{i.name}}" onchange="showhideTableColumn({{i.order}}, $('#ct{{i.name}}').is(':checked'))" checked autocomplete="off"></span> |
35 {% endfor %}
36 </div>
37 {% endif %}
38</div>
39<div>
40 <table class="table table-striped table-condensed" style="width:95%">
41{% block pagetable %}
42{% endblock %}
43 </table>
44</div>
45
46{% endblock %}
diff --git a/bitbake/lib/toaster/bldviewer/templates/bfile.html b/bitbake/lib/toaster/bldviewer/templates/bfile.html
new file mode 100644
index 0000000000..d90f4fbddb
--- /dev/null
+++ b/bitbake/lib/toaster/bldviewer/templates/bfile.html
@@ -0,0 +1,24 @@
1{% extends "basebuildpage.html" %}
2
3{% block pagetitle %}Files for package {{files.0.bpackage.name}} {% endblock %}
4{% block pagetable %}
5 {% if not files %}
6 <p>No files were recorded for this package!</p>
7 {% else %}
8
9 <tr>
10 <th>Name</th>
11 <th>Size (Bytes)</th>
12 </tr>
13
14 {% for file in files %}
15
16 <tr class="data">
17 <td>{{file.path}}</td>
18 <td>{{file.size}}</td>
19
20 {% endfor %}
21
22 {% endif %}
23
24{% endblock %}
diff --git a/bitbake/lib/toaster/bldviewer/templates/bpackage.html b/bitbake/lib/toaster/bldviewer/templates/bpackage.html
new file mode 100644
index 0000000000..2e254dbad6
--- /dev/null
+++ b/bitbake/lib/toaster/bldviewer/templates/bpackage.html
@@ -0,0 +1,44 @@
1{% extends "basebuildpage.html" %}
2
3{% block pagetitle %}Packages{% endblock %}
4{% block pagetable %}
5 {% if not packages %}
6 <p>No packages were recorded for this target!</p>
7 {% else %}
8
9 <tr>
10 <th>Name</th>
11 <th>Version</th>
12 <th>Recipe</th>
13 <th>Summary</th>
14 <th>Section</th>
15 <th>Description</th>
16 <th>Size on host disk (KBytes)</th>
17 <th>License</th>
18 <th>Dependencies List (all)</th>
19 </tr>
20
21 {% for package in packages %}
22
23 <tr class="data">
24 <td><a name="#{{package.name}}" href="{% url bfile build.pk package.pk %}">{{package.name}} ({{package.filelist_bpackage.count}} files)</a></td>
25 <td>{{package.version}}-{{package.revision}}</td>
26 <td><a href="{% url layer_versions_recipes package.recipe.layer_version_id %}#{{package.recipe.name}}">{{package.recipe.name}}</a>{{package.package_name}}</a></td>
27
28 <td>{{package.summary}}</td>
29 <td>{{package.section}}</td>
30 <td>{{package.description}}</td>
31 <td>{{package.size}}</td>
32 <td>{{package.license}}</td>
33 <td>
34 <div style="height: 3em; overflow:auto">
35 {% for bpd in package.bpackage_dependencies_package.all %}
36 {{bpd.dep_type}}: {{bpd.depends_on}} <br/>
37 {% endfor %}
38 </div>
39 </td>
40 {% endfor %}
41
42 {% endif %}
43
44{% endblock %}
diff --git a/bitbake/lib/toaster/bldviewer/templates/build.html b/bitbake/lib/toaster/bldviewer/templates/build.html
new file mode 100644
index 0000000000..ab6e19643b
--- /dev/null
+++ b/bitbake/lib/toaster/bldviewer/templates/build.html
@@ -0,0 +1,43 @@
1{% extends "basetable.html" %}
2
3{% block pagename %}
4 <h1>Toaster - Builds</h1>
5{% endblock %}
6
7{% block pagetable %}
8
9 {% load projecttags %}
10 <tr>
11 <th>Outcome</th>
12 <th>Started On</th>
13 <th>Completed On</th>
14 <th>Target</th>
15 <th>Machine</th>
16 <th>Time</th>
17 <th>Errors</th>
18 <th>Warnings</th>
19 <th>Output</th>
20 <th>Log</th>
21 <th>Bitbake Version</th>
22 <th>Build Name</th>
23 </tr>
24 {% for build in builds %}
25 <tr class="data">
26 <td><a href="{% url configuration build.id %}">{{build.get_outcome_display}}</a></td>
27 <td>{{build.started_on}}</td>
28 <td>{{build.completed_on}}</td>
29 <td>{% for t in build.target_set.all %}<a href="{% url tpackage build.id t.id %}">{{t.target}}</a>{% if t.is_image %} (Img){% endif %}<br/>{% endfor %}</td>
30 <td>{{build.machine}}</td>
31 <td>{% time_difference build.started_on build.completed_on %}</td>
32 <td>{{build.errors_no}}:{% if build.errors_no %}{% for error in logs %}{% if error.build == build %}{% if error.level == 2 %}<p>{{error.message}}</p>{% endif %}{% endif %}{% endfor %}{% else %}None{% endif %}</td>
33 <td>{{build.warnings_no}}:{% if build.warnings_no %}{% for warning in logs %}{% if warning.build == build %}{% if warning.level == 1 %}<p>{{warning.message}}</p>{% endif %}{% endif %}{% endfor %}{% else %}None{% endif %}</td>
34 <td>{% if build.outcome == 0 %}{% for t in build.target_set.all %}{% if t.is_image %}{{build.image_fstypes}}{% endif %}{% endfor %}{% endif %}</td>
35 <td>{{build.cooker_log_path}}</td>
36 <td>{{build.bitbake_version}}</td>
37 <td>{{build.build_name}}</td>
38 </tr>
39
40 {% endfor %}
41{% endblock %}
42
43
diff --git a/bitbake/lib/toaster/bldviewer/templates/configuration.html b/bitbake/lib/toaster/bldviewer/templates/configuration.html
new file mode 100644
index 0000000000..052c37c4e8
--- /dev/null
+++ b/bitbake/lib/toaster/bldviewer/templates/configuration.html
@@ -0,0 +1,20 @@
1{% extends "basebuildpage.html" %}
2
3{% block pagetitle %}Configuration{% endblock %}
4{% block pagetable %}
5
6 <tr>
7 <th>Name</th>
8 <th>Value</th>
9 <th>Description</th>
10 </tr>
11
12 {% for variable in configuration %}
13
14 <tr class="data">
15 <td>{{variable.variable_name}}</td>
16 <td>{{variable.variable_value}}</td>
17 <td>{% if variable.description %}{{variable.description}}{% endif %}</td>
18 {% endfor %}
19
20{% endblock %}
diff --git a/bitbake/lib/toaster/bldviewer/templates/layer.html b/bitbake/lib/toaster/bldviewer/templates/layer.html
new file mode 100644
index 0000000000..fa4fd9bde8
--- /dev/null
+++ b/bitbake/lib/toaster/bldviewer/templates/layer.html
@@ -0,0 +1,34 @@
1{% extends "basetable.html" %}
2
3{% block pagename %}
4 <h1>Toaster - Layers</h1>
5{% endblock %}
6
7{% block pagetable %}
8 {% load projecttags %}
9
10 <tr>
11 <th>Name</th>
12 <th>Local Path</th>
13 <th>Layer Index URL</th>
14 <th>Known Versions</th>
15 </tr>
16
17 {% for layer in layers %}
18
19 <tr class="data">
20 <td>{{layer.name}}</td>
21 <td>{{layer.local_path}}</td>
22 <td><a href='{{layer.layer_index_url}}'>{{layer.layer_index_url}}</a></td>
23 <td><table>
24 {% for lv in layer.versions %}
25 <tr><td>
26 <a href="{% url layer_versions_recipes lv.id %}">({{lv.priority}}){{lv.branch}}:{{lv.commit}} ({{lv.count}} recipes)</a>
27 </td></tr>
28 {% endfor %}
29 </table></td>
30 </tr>
31
32 {% endfor %}
33
34{% endblock %}
diff --git a/bitbake/lib/toaster/bldviewer/templates/package.html b/bitbake/lib/toaster/bldviewer/templates/package.html
new file mode 100644
index 0000000000..642fcab9a1
--- /dev/null
+++ b/bitbake/lib/toaster/bldviewer/templates/package.html
@@ -0,0 +1,36 @@
1{% extends "basebuildpage.html" %}
2
3{% block pagetable %}
4 {% if not packages %}
5 <p>No packages were recorded for this target!</p>
6 {% else %}
7
8 <tr>
9 <th>Name</th>
10 <th>Version</th>
11 <th>Size (Bytes)</th>
12 <th>Recipe</th>
13 <th>Depends on</th>
14 </tr>
15
16 {% for package in packages %}
17
18 <tr class="data">
19 <td><a name="#{{package.name}}">{{package.name}}</a></td>
20 <td>{{package.version}}</td>
21 <td>{{package.size}}</td>
22 <td><a name="{{package.recipe.name}}.{{package.package_name}}">
23 <a href="{% url layer_versions_recipes package.recipe.layer_version_id %}#{{package.recipe.name}}">{{package.recipe.name}}</a>{{package.package_name}}</a></td>
24 <td>
25 <div style="height: 3em; overflow:auto">
26 {% for d in package.depends_on %}
27 <a href="#{{d.name}}">{{d.name}}</a><br/>
28 {% endfor %}
29 </div>
30 </td>
31
32 {% endfor %}
33
34 {% endif %}
35
36{% endblock %}
diff --git a/bitbake/lib/toaster/bldviewer/templates/recipe.html b/bitbake/lib/toaster/bldviewer/templates/recipe.html
new file mode 100644
index 0000000000..a62437066d
--- /dev/null
+++ b/bitbake/lib/toaster/bldviewer/templates/recipe.html
@@ -0,0 +1,54 @@
1{% extends "basetable.html" %}
2
3{% block pagename %}
4<ul class="nav nav-tabs" style="display: inline-block">
5 <li><a>Layer {{layer_version.layer.name}}&nbsp;:&nbsp;{{layer_version.branch}}&nbsp;:&nbsp;{{layer_version.commit}}&nbsp;:&nbsp;{{layer_version.priority}}</a></li>
6</ul>
7 <h1>Toaster - Recipes for a Layer</h1>
8{% endblock %}
9
10{% block pagetable %}
11 {% load projecttags %}
12
13 <tr>
14 </tr>
15 <th>Name</th>
16 <th>Version</th>
17 <th>Summary</th>
18 <th>Description</th>
19 <th>Section</th>
20 <th>License</th>
21 <th>License file</th>
22 <th>Homepage</th>
23 <th>Bugtracker</th>
24 <th>Author</th>
25 <th>File_path</th>
26 <th style="width: 30em">Recipe Dependency</th>
27
28
29 {% for recipe in recipes %}
30
31 <tr class="data">
32 <td><a name="{{recipe.name}}">{{recipe.name}}</a></td>
33 <td>{{recipe.version}}</td>
34 <td>{{recipe.summary}}</td>
35 <td>{{recipe.description}}</td>
36 <td>{{recipe.section}}</td>
37 <td>{{recipe.license}}</td>
38 <td>{{recipe.licensing_info}}</td>
39 <td>{{recipe.homepage}}</td>
40 <td>{{recipe.bugtracker}}</td>
41 <td>{{recipe.author}}</td>
42 <td>{{recipe.file_path}}</td>
43 <td>
44 <div style="height: 5em; overflow:auto">
45 {% for rr in recipe.r_dependencies_recipe.all %}
46 <a href="#{{rr.depends_on.name}}">{{rr.depends_on.name}}</a><br/>
47 {% endfor %}
48 </div>
49 </td>
50 </tr>
51
52 {% endfor %}
53
54{% endblock %}
diff --git a/bitbake/lib/toaster/bldviewer/templates/task.html b/bitbake/lib/toaster/bldviewer/templates/task.html
new file mode 100644
index 0000000000..e7253698cd
--- /dev/null
+++ b/bitbake/lib/toaster/bldviewer/templates/task.html
@@ -0,0 +1,63 @@
1{% extends "basebuildpage.html" %}
2
3{% block pagetitle %}Tasks{% endblock %}
4{% block pagetable %}
5 {% if not tasks %}
6 <p>No tasks were executed in this build!</p>
7 {% else %}
8
9 <tr>
10 <th>Order</th>
11 <th>Task</th>
12 <th>Recipe Version</th>
13 <th>Task Type</th>
14 <th>Checksum</th>
15 <th>Outcome</th>
16 <th>Message</th>
17 <th>Logfile</th>
18 <th>Time</th>
19 <th>CPU usage</th>
20 <th>Disk I/O</th>
21 <th>Script type</th>
22 <th>File path</th>
23 <th>Depends</th>
24 </tr>
25
26 {% for task in tasks %}
27
28 <tr class="data">
29 <td>{{task.order}}</td>
30 <td><a name="{{task.recipe.name}}.{{task.task_name}}">
31 <a href="{% url layer_versions_recipes task.recipe.layer_version_id %}#{{task.recipe.name}}">{{task.recipe.name}}</a>.{{task.task_name}}</a></td>
32 <td>{{task.recipe.version}}</td>
33
34 {% if task.task_executed %}
35 <td>Executed</td>
36 {% else %}
37 <td>Prebuilt</td>
38 {% endif %}
39
40 <td>{{task.sstate_checksum}}</td>
41 <td>{{task.get_outcome_display}}{% if task.provider %}</br>(by <a href="#{{task.provider.recipe.name}}.{{task.provider.task_name}}">{{task.provider.recipe.name}}.{{task.provider.task_name}}</a>){% endif %}</td>
42 <td><p>{{task.message}}</td>
43 <td><a target="_fileview" href="file:///{{task.logfile}}">{{task.logfile}}</a></td>
44 <td>{{task.elapsed_time}}</td>
45 <td>{{task.cpu_usage}}</td>
46 <td>{{task.disk_io}}</td>
47 <td>{{task.get_script_type_display}}</td>
48 <td><a target="_fileview" href="file:///{{task.recipe.file_path}}">{{task.recipe.file_path}}</a></td>
49 <td>
50 <div style="height: 3em; overflow:auto">
51 {% for tt in task.task_dependencies_task.all %}
52 <a href="#{{tt.depends_on.recipe.name}}.{{tt.depends_on.task_name}}">
53 {{tt.depends_on.recipe.name}}.{{tt.depends_on.task_name}}</a><br/>
54 {% endfor %}
55 </div>
56 </td>
57 </tr>
58
59 {% endfor %}
60
61 {% endif %}
62
63{% endblock %}
diff --git a/bitbake/lib/toaster/bldviewer/templatetags/__init__.py b/bitbake/lib/toaster/bldviewer/templatetags/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/bitbake/lib/toaster/bldviewer/templatetags/__init__.py
diff --git a/bitbake/lib/toaster/bldviewer/templatetags/projecttags.py b/bitbake/lib/toaster/bldviewer/templatetags/projecttags.py
new file mode 100644
index 0000000000..0c0d804c0c
--- /dev/null
+++ b/bitbake/lib/toaster/bldviewer/templatetags/projecttags.py
@@ -0,0 +1,26 @@
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
19from datetime import datetime
20from django import template
21
22register = template.Library()
23
24@register.simple_tag
25def time_difference(start_time, end_time):
26 return end_time - start_time
diff --git a/bitbake/lib/toaster/bldviewer/urls.py b/bitbake/lib/toaster/bldviewer/urls.py
new file mode 100644
index 0000000000..becc679203
--- /dev/null
+++ b/bitbake/lib/toaster/bldviewer/urls.py
@@ -0,0 +1,32 @@
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
19from django.conf.urls import patterns, include, url
20from django.views.generic.simple import redirect_to
21
22urlpatterns = patterns('bldviewer.views',
23 url(r'^builds/$', 'build', name='all-builds'),
24 url(r'^build/(?P<build_id>\d+)/task/$', 'task', name='task'),
25 url(r'^build/(?P<build_id>\d+)/packages/$', 'bpackage', name='bpackage'),
26 url(r'^build/(?P<build_id>\d+)/package/(?P<package_id>\d+)/files/$', 'bfile', name='bfile'),
27 url(r'^build/(?P<build_id>\d+)/target/(?P<target_id>\d+)/packages/$', 'tpackage', name='tpackage'),
28 url(r'^build/(?P<build_id>\d+)/configuration/$', 'configuration', name='configuration'),
29 url(r'^layers/$', 'layer', name='all-layers'),
30 url(r'^layerversions/(?P<layerversion_id>\d+)/recipes/.*$', 'layer_versions_recipes', name='layer_versions_recipes'),
31 url(r'^$', redirect_to, {'url': 'builds/'}),
32)
diff --git a/bitbake/lib/toaster/bldviewer/views.py b/bitbake/lib/toaster/bldviewer/views.py
new file mode 100644
index 0000000000..7be4d4b899
--- /dev/null
+++ b/bitbake/lib/toaster/bldviewer/views.py
@@ -0,0 +1,260 @@
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
19import operator
20
21from django.db.models import Q
22from django.shortcuts import render
23from orm.models import Build, Target, Task, Layer, Layer_Version, Recipe, Target_Package, LogMessage, Variable
24from orm.models import Task_Dependency, Recipe_Dependency, Build_Package, Build_File, Build_Package_Dependency
25from django.views.decorators.cache import cache_control
26
27@cache_control(no_store=True)
28def build(request):
29 template = 'build.html'
30 build_info = Build.objects.all()
31
32 logs = LogMessage.objects.all()
33
34 context = {'builds': build_info, 'logs': logs ,
35 'hideshowcols' : [
36 {'name': 'Output', 'order':10},
37 {'name': 'Log', 'order':11},
38 ]}
39
40 return render(request, template, context)
41
42
43def _find_task_revdep(task):
44 tp = []
45 for p in Task_Dependency.objects.filter(depends_on=task):
46 tp.append(p.task);
47 return tp
48
49def _find_task_provider(task):
50 task_revdeps = _find_task_revdep(task)
51 for tr in task_revdeps:
52 if tr.outcome != Task.OUTCOME_COVERED:
53 return tr
54 for tr in task_revdeps:
55 trc = _find_task_provider(tr)
56 if trc is not None:
57 return trc
58 return None
59
60def task(request, build_id):
61 template = 'task.html'
62
63 tasks = Task.objects.filter(build=build_id)
64
65 for t in tasks:
66 if t.outcome == Task.OUTCOME_COVERED:
67 t.provider = _find_task_provider(t)
68
69 context = {'build': Build.objects.filter(pk=build_id)[0], 'tasks': tasks}
70
71 return render(request, template, context)
72
73def configuration(request, build_id):
74 template = 'configuration.html'
75 variables = Variable.objects.filter(build=build_id)
76 context = {'build': Build.objects.filter(pk=build_id)[0], 'configuration' : variables}
77 return render(request, template, context)
78
79def bpackage(request, build_id):
80 template = 'bpackage.html'
81 packages = Build_Package.objects.filter(build = build_id)
82 context = {'build': Build.objects.filter(pk=build_id)[0], 'packages' : packages}
83 return render(request, template, context)
84
85def bfile(request, build_id, package_id):
86 template = 'bfile.html'
87 files = Build_File.objects.filter(bpackage = package_id)
88 context = {'build': Build.objects.filter(pk=build_id)[0], 'files' : files}
89 return render(request, template, context)
90
91def tpackage(request, build_id, target_id):
92 template = 'package.html'
93
94 packages = Target_Package.objects.filter(target=target_id)
95
96 context = {'build' : Build.objects.filter(pk=build_id)[0],'packages': packages}
97
98 return render(request, template, context)
99
100def layer(request):
101 template = 'layer.html'
102 layer_info = Layer.objects.all()
103
104 for li in layer_info:
105 li.versions = Layer_Version.objects.filter(layer = li)
106 for liv in li.versions:
107 liv.count = Recipe.objects.filter(layer_version__id = liv.id).count()
108
109 context = {'layers': layer_info}
110
111 return render(request, template, context)
112
113
114def layer_versions_recipes(request, layerversion_id):
115 template = 'recipe.html'
116 recipes = Recipe.objects.filter(layer_version__id = layerversion_id)
117
118 context = {'recipes': recipes,
119 'layer_version' : Layer_Version.objects.filter( id = layerversion_id )[0]
120 }
121
122 return render(request, template, context)
123
124#### API
125
126import json
127from django.core import serializers
128from django.http import HttpResponse, HttpResponseBadRequest
129
130
131def model_explorer(request, model_name):
132
133 DESCENDING = 'desc'
134 response_data = {}
135 model_mapping = {
136 'build': Build,
137 'target': Target,
138 'target_package': Target_Package,
139 'task': Task,
140 'task_dependency': Task_Dependency,
141 'package': Build_Package,
142 'layer': Layer,
143 'layerversion': Layer_Version,
144 'recipe': Recipe,
145 'recipe_dependency': Recipe_Dependency,
146 'build_package': Build_Package,
147 'build_package_dependency': Build_Package_Dependency,
148 'build_file': Build_File,
149 'variable': Variable,
150 'logmessage': LogMessage,
151 }
152
153 if model_name not in model_mapping.keys():
154 return HttpResponseBadRequest()
155
156 model = model_mapping[model_name]
157
158 try:
159 limit = int(request.GET.get('limit', 0))
160 except ValueError:
161 limit = 0
162
163 try:
164 offset = int(request.GET.get('offset', 0))
165 except ValueError:
166 offset = 0
167
168 ordering_string, invalid = _validate_input(request.GET.get('orderby', ''),
169 model)
170 if invalid:
171 return HttpResponseBadRequest()
172
173 filter_string, invalid = _validate_input(request.GET.get('filter', ''),
174 model)
175 if invalid:
176 return HttpResponseBadRequest()
177
178 search_term = request.GET.get('search', '')
179
180 if filter_string:
181 filter_terms = _get_filtering_terms(filter_string)
182 try:
183 queryset = model.objects.filter(**filter_terms)
184 except ValueError:
185 queryset = []
186 else:
187 queryset = model.objects.all()
188
189 if search_term:
190 queryset = _get_search_results(search_term, queryset, model)
191
192 if ordering_string and queryset:
193 column, order = ordering_string.split(':')
194 if order.lower() == DESCENDING:
195 queryset = queryset.order_by('-' + column)
196 else:
197 queryset = queryset.order_by(column)
198
199 if offset and limit:
200 queryset = queryset[offset:(offset+limit)]
201 elif offset:
202 queryset = queryset[offset:]
203 elif limit:
204 queryset = queryset[:limit]
205
206 if queryset:
207 response_data['count'] = queryset.count()
208 else:
209 response_data['count'] = 0
210
211 response_data['list'] = serializers.serialize('json', queryset)
212
213 return HttpResponse(json.dumps(response_data),
214 content_type='application/json')
215
216def _get_filtering_terms(filter_string):
217
218 search_terms = filter_string.split(":")
219 keys = search_terms[0].split(',')
220 values = search_terms[1].split(',')
221
222 return dict(zip(keys, values))
223
224def _validate_input(input, model):
225
226 invalid = 0
227
228 if input:
229 input_list = input.split(":")
230
231 # Check we have only one colon
232 if len(input_list) != 2:
233 invalid = 1
234 return None, invalid
235
236 # Check we have an equal number of terms both sides of the colon
237 if len(input_list[0].split(',')) != len(input_list[1].split(',')):
238 invalid = 1
239 return None, invalid
240
241 # Check we are looking for a valid field
242 valid_fields = model._meta.get_all_field_names()
243 for field in input_list[0].split(','):
244 if field not in valid_fields:
245 invalid = 1
246 return None, invalid
247
248 return input, invalid
249
250def _get_search_results(search_term, queryset, model):
251 search_objects = []
252 for st in search_term.split(" "):
253 q_map = map(lambda x: Q(**{x+'__icontains': st}),
254 model.search_allowed_fields)
255
256 search_objects.append(reduce(operator.or_, q_map))
257 search_object = reduce(operator.and_, search_objects)
258 queryset = queryset.filter(search_object)
259
260 return queryset
diff --git a/bitbake/lib/toaster/manage.py b/bitbake/lib/toaster/manage.py
new file mode 100755
index 0000000000..ceaa11bfc5
--- /dev/null
+++ b/bitbake/lib/toaster/manage.py
@@ -0,0 +1,10 @@
1#!/usr/bin/env python
2import os
3import sys
4
5if __name__ == "__main__":
6 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "toastermain.settings")
7
8 from django.core.management import execute_from_command_line
9
10 execute_from_command_line(sys.argv)
diff --git a/bitbake/lib/toaster/orm/__init__.py b/bitbake/lib/toaster/orm/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/bitbake/lib/toaster/orm/__init__.py
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
new file mode 100644
index 0000000000..cb6581c9e1
--- /dev/null
+++ b/bitbake/lib/toaster/orm/models.py
@@ -0,0 +1,258 @@
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
19from django.db import models
20from django.utils.encoding import python_2_unicode_compatible
21
22
23class Build(models.Model):
24 SUCCEEDED = 0
25 FAILED = 1
26 IN_PROGRESS = 2
27
28 BUILD_OUTCOME = (
29 (SUCCEEDED, 'Succeeded'),
30 (FAILED, 'Failed'),
31 (IN_PROGRESS, 'In Progress'),
32 )
33
34 search_allowed_fields = ['machine',
35 'cooker_log_path']
36
37 machine = models.CharField(max_length=100)
38 image_fstypes = models.CharField(max_length=100)
39 distro = models.CharField(max_length=100)
40 distro_version = models.CharField(max_length=100)
41 started_on = models.DateTimeField()
42 completed_on = models.DateTimeField()
43 outcome = models.IntegerField(choices=BUILD_OUTCOME, default=IN_PROGRESS)
44 errors_no = models.IntegerField(default=0)
45 warnings_no = models.IntegerField(default=0)
46 cooker_log_path = models.CharField(max_length=500)
47 build_name = models.CharField(max_length=100)
48 bitbake_version = models.CharField(max_length=50)
49
50@python_2_unicode_compatible
51class Target(models.Model):
52 search_allowed_fields = ['target', 'image_fstypes', 'file_name']
53 build = models.ForeignKey(Build)
54 target = models.CharField(max_length=100)
55 is_image = models.BooleanField(default = False)
56 file_name = models.CharField(max_length=100)
57 file_size = models.IntegerField()
58
59 def __str__(self):
60 return self.target
61
62
63class Task(models.Model):
64
65 SSTATE_NA = 0
66 SSTATE_MISS = 1
67 SSTATE_FAILED = 2
68 SSTATE_RESTORED = 3
69
70 SSTATE_RESULT = (
71 (SSTATE_NA, 'Not Applicable'), # For rest of tasks, but they still need checking.
72 (SSTATE_MISS, 'Missing'), # it is a miss
73 (SSTATE_FAILED, 'Failed'), # there was a pkg, but the script failed
74 (SSTATE_RESTORED, 'Restored'), # succesfully restored
75 )
76
77 CODING_PYTHON = 0
78 CODING_SHELL = 1
79
80 TASK_CODING = (
81 (CODING_PYTHON, 'Python'),
82 (CODING_SHELL, 'Shell'),
83 )
84
85 OUTCOME_SUCCESS = 0
86 OUTCOME_COVERED = 1
87 OUTCOME_SSTATE = 2
88 OUTCOME_EXISTING = 3
89 OUTCOME_FAILED = 4
90 OUTCOME_NA = 5
91
92 TASK_OUTCOME = (
93 (OUTCOME_SUCCESS, 'Succeeded'),
94 (OUTCOME_COVERED, 'Covered'),
95 (OUTCOME_SSTATE, 'Sstate'),
96 (OUTCOME_EXISTING, 'Existing'),
97 (OUTCOME_FAILED, 'Failed'),
98 (OUTCOME_NA, 'Not Available'),
99 )
100
101 build = models.ForeignKey(Build, related_name='task_build')
102 order = models.IntegerField(null=True)
103 task_executed = models.BooleanField(default=False) # True means Executed, False means Prebuilt
104 outcome = models.IntegerField(choices=TASK_OUTCOME, default=OUTCOME_NA)
105 sstate_checksum = models.CharField(max_length=100, blank=True)
106 path_to_sstate_obj = models.FilePathField(max_length=500, blank=True)
107 recipe = models.ForeignKey('Recipe', related_name='build_recipe')
108 task_name = models.CharField(max_length=100)
109 source_url = models.FilePathField(max_length=255, blank=True)
110 work_directory = models.FilePathField(max_length=255, blank=True)
111 script_type = models.IntegerField(choices=TASK_CODING, default=CODING_PYTHON)
112 line_number = models.IntegerField(default=0)
113 disk_io = models.IntegerField(null=True)
114 cpu_usage = models.DecimalField(max_digits=6, decimal_places=2, null=True)
115 elapsed_time = models.CharField(max_length=50, default=0)
116 sstate_result = models.IntegerField(choices=SSTATE_RESULT, default=SSTATE_NA)
117 message = models.CharField(max_length=240)
118 logfile = models.FilePathField(max_length=255, blank=True)
119
120 class Meta:
121 ordering = ('order', 'recipe' ,)
122
123
124class Task_Dependency(models.Model):
125 task = models.ForeignKey(Task, related_name='task_dependencies_task')
126 depends_on = models.ForeignKey(Task, related_name='task_dependencies_depends')
127
128
129class Build_Package(models.Model):
130 build = models.ForeignKey('Build')
131 recipe = models.ForeignKey('Recipe', null=True)
132 name = models.CharField(max_length=100)
133 version = models.CharField(max_length=100, blank=True)
134 revision = models.CharField(max_length=32, blank=True)
135 summary = models.CharField(max_length=200, blank=True)
136 description = models.CharField(max_length=200, blank=True)
137 size = models.IntegerField(default=0)
138 section = models.CharField(max_length=80, blank=True)
139 license = models.CharField(max_length=80, blank=True)
140
141class Build_Package_Dependency(models.Model):
142 TYPE_RDEPENDS = 0
143 TYPE_RPROVIDES = 1
144 TYPE_RRECOMMENDS = 2
145 TYPE_RSUGGESTS = 3
146 TYPE_RREPLACES = 4
147 TYPE_RCONFLICTS = 5
148 DEPENDS_TYPE = (
149 (TYPE_RDEPENDS, "rdepends"),
150 (TYPE_RPROVIDES, "rprovides"),
151 (TYPE_RRECOMMENDS, "rrecommends"),
152 (TYPE_RSUGGESTS, "rsuggests"),
153 (TYPE_RREPLACES, "rreplaces"),
154 (TYPE_RCONFLICTS, "rconflicts"),
155 )
156 package = models.ForeignKey(Build_Package, related_name='bpackage_dependencies_package')
157 depends_on = models.CharField(max_length=100) # soft dependency
158 dep_type = models.IntegerField(choices=DEPENDS_TYPE)
159
160
161class Target_Package(models.Model):
162 target = models.ForeignKey('Target')
163 recipe = models.ForeignKey('Recipe', null=True)
164 name = models.CharField(max_length=100)
165 version = models.CharField(max_length=100, blank=True)
166 size = models.IntegerField()
167
168
169class Target_Package_Dependency(models.Model):
170 TYPE_DEPENDS = 0
171 TYPE_RDEPENDS = 1
172 TYPE_RECOMMENDS = 2
173
174 DEPENDS_TYPE = (
175 (TYPE_DEPENDS, "depends"),
176 (TYPE_RDEPENDS, "rdepends"),
177 (TYPE_RECOMMENDS, "recommends"),
178 )
179 package = models.ForeignKey(Target_Package, related_name='tpackage_dependencies_package')
180 depends_on = models.ForeignKey(Target_Package, related_name='tpackage_dependencies_depends')
181 dep_type = models.IntegerField(choices=DEPENDS_TYPE)
182
183
184class Build_File(models.Model):
185 bpackage = models.ForeignKey(Build_Package, related_name='filelist_bpackage')
186 path = models.FilePathField(max_length=255, blank=True)
187 size = models.IntegerField()
188
189class Target_File(models.Model):
190 tpackage = models.ForeignKey(Target_Package, related_name='filelist_tpackage')
191 path = models.FilePathField(max_length=255, blank=True)
192 size = models.IntegerField()
193
194
195class Recipe(models.Model):
196 name = models.CharField(max_length=100, blank=True)
197 version = models.CharField(max_length=100, blank=True)
198 layer_version = models.ForeignKey('Layer_Version', related_name='recipe_layer_version')
199 summary = models.CharField(max_length=100, blank=True)
200 description = models.CharField(max_length=100, blank=True)
201 section = models.CharField(max_length=100, blank=True)
202 license = models.CharField(max_length=200, blank=True)
203 licensing_info = models.TextField(blank=True)
204 homepage = models.URLField(blank=True)
205 bugtracker = models.URLField(blank=True)
206 author = models.CharField(max_length=100, blank=True)
207 file_path = models.FilePathField(max_length=255)
208
209
210class Recipe_Dependency(models.Model):
211 TYPE_DEPENDS = 0
212 TYPE_RDEPENDS = 1
213
214 DEPENDS_TYPE = (
215 (TYPE_DEPENDS, "depends"),
216 (TYPE_RDEPENDS, "rdepends"),
217 )
218 recipe = models.ForeignKey(Recipe, related_name='r_dependencies_recipe')
219 depends_on = models.ForeignKey(Recipe, related_name='r_dependencies_depends')
220 dep_type = models.IntegerField(choices=DEPENDS_TYPE)
221
222class Layer(models.Model):
223 name = models.CharField(max_length=100)
224 local_path = models.FilePathField(max_length=255)
225 layer_index_url = models.URLField()
226
227
228class Layer_Version(models.Model):
229 layer = models.ForeignKey(Layer, related_name='layer_version_layer')
230 branch = models.CharField(max_length=50)
231 commit = models.CharField(max_length=100)
232 priority = models.IntegerField()
233
234
235class Variable(models.Model):
236 build = models.ForeignKey(Build, related_name='variable_build')
237 variable_name = models.CharField(max_length=100)
238 variable_value = models.TextField(blank=True)
239 file = models.FilePathField(max_length=255)
240 changed = models.BooleanField(default=False)
241 human_readable_name = models.CharField(max_length=200)
242 description = models.TextField(blank=True)
243
244
245class LogMessage(models.Model):
246 INFO = 0
247 WARNING = 1
248 ERROR = 2
249
250 LOG_LEVEL = ( (INFO, "info"),
251 (WARNING, "warn"),
252 (ERROR, "error") )
253
254 build = models.ForeignKey(Build)
255 level = models.IntegerField(choices=LOG_LEVEL, default=INFO)
256 message=models.CharField(max_length=240)
257 pathname = models.FilePathField(max_length=255, blank=True)
258 lineno = models.IntegerField(null=True)
diff --git a/bitbake/lib/toaster/toastergui/__init__.py b/bitbake/lib/toaster/toastergui/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/bitbake/lib/toaster/toastergui/__init__.py
diff --git a/bitbake/lib/toaster/toastergui/static/images/yocto.jpg b/bitbake/lib/toaster/toastergui/static/images/yocto.jpg
new file mode 100644
index 0000000000..5de4b7693a
--- /dev/null
+++ b/bitbake/lib/toaster/toastergui/static/images/yocto.jpg
Binary files differ
diff --git a/bitbake/lib/toaster/toastergui/templates/index.html b/bitbake/lib/toaster/toastergui/templates/index.html
new file mode 100644
index 0000000000..80b02d94a9
--- /dev/null
+++ b/bitbake/lib/toaster/toastergui/templates/index.html
@@ -0,0 +1,13 @@
1<html>
2<head>
3 <title>GUI Page</title>
4</head>
5<body>
6{% load staticfiles %}
7
8<img src="{% static "/static/images/yocto.jpg" %}" alt="Yocto"/>
9
10This is your basic index page!
11</body>
12
13</html> \ No newline at end of file
diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py
new file mode 100644
index 0000000000..6dbf0c5a56
--- /dev/null
+++ b/bitbake/lib/toaster/toastergui/urls.py
@@ -0,0 +1,27 @@
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
19import os
20
21from django.conf import settings
22from django.conf.urls import patterns, include, url
23
24
25urlpatterns = patterns('toastergui.views',
26 url(r'^$', 'guihome', name='guihome'),
27)
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
new file mode 100644
index 0000000000..ecb2f7e82f
--- /dev/null
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -0,0 +1,26 @@
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
19from django.shortcuts import render
20from orm.models import Build, Task
21
22
23def guihome(request):
24 template = 'index.html'
25
26 return render(request, template)
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
21DEBUG = True
22TEMPLATE_DEBUG = DEBUG
23
24ADMINS = (
25 # ('Your Name', 'your_email@example.com'),
26)
27
28MANAGERS = ADMINS
29
30DATABASES = {
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
43ALLOWED_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
55LANGUAGE_CODE = 'en-us'
56
57SITE_ID = 1
58
59# If you set this to False, Django will make some optimizations so as not
60# to load the internationalization machinery.
61USE_I18N = True
62
63# If you set this to False, Django will not format dates, numbers and
64# calendars according to the current locale.
65USE_L10N = True
66
67# If you set this to False, Django will not use timezone-aware datetimes.
68USE_TZ = False
69
70# Absolute filesystem path to the directory that will hold user-uploaded files.
71# Example: "/var/www/example.com/media/"
72MEDIA_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/"
77MEDIA_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/"
83STATIC_ROOT = ''
84
85# URL prefix for static files.
86# Example: "http://example.com/static/", "http://static.example.com/"
87STATIC_URL = '/static/'
88
89# Additional locations of static files
90STATICFILES_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.
98STATICFILES_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.
105SECRET_KEY = 'NOT_SUITABLE_FOR_HOSTED_DEPLOYMENT'
106
107# List of callables that know how to import templates from various sources.
108TEMPLATE_LOADERS = (
109 'django.template.loaders.filesystem.Loader',
110 'django.template.loaders.app_directories.Loader',
111# 'django.template.loaders.eggs.Loader',
112)
113
114MIDDLEWARE_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
124ROOT_URLCONF = 'toastermain.urls'
125
126# Python dotted path to the WSGI application used by Django's runserver.
127WSGI_APPLICATION = 'toastermain.wsgi.application'
128
129TEMPLATE_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
135INSTALLED_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.
157LOGGING = {
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
182from django.db.backends.signals import connection_created
183def activate_synchronous_off(sender, connection, **kwargs):
184 if connection.vendor == 'sqlite':
185 cursor = connection.cursor()
186 cursor.execute('PRAGMA synchronous = 0;')
187connection_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
19from django.conf.urls import patterns, include, url
20from django.views.generic.simple import redirect_to
21from 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
28urlpatterns = 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"""
2WSGI config for Toaster project.
3
4This module contains the WSGI application used by Django's development server
5and any production WSGI deployments. It should expose a module-level variable
6named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
7this application via the ``WSGI_APPLICATION`` setting.
8
9Usually you will have the standard Django WSGI application here, but it also
10might make sense to replace the whole Django WSGI application with a custom one
11that later delegates to the Django one. For example, you could introduce WSGI
12middleware here, or combine a Django application with an application of another
13framework.
14
15"""
16import 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"
22os.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.
27from django.core.wsgi import get_wsgi_application
28application = get_wsgi_application()
29
30# Apply WSGI middleware here.
31# from helloworld.wsgi import HelloWorldApplication
32# application = HelloWorldApplication(application)