summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-12-02 10:02:50 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-12-07 17:37:10 +0000
commit4c1e5ec29ace325d03a5a1386e384201a00f15cf (patch)
treeeafadc88924ac99464de68d1ab2108808cec41d0
parent990289511b7dc56580f2cecdda75fa14f436966d (diff)
downloadpoky-4c1e5ec29ace325d03a5a1386e384201a00f15cf.tar.gz
bitbake: toaster: remove usage of BUILD_MODE variable
As both modes can be used at the same time we can't have any difference in UI between modes. Removed all conditional statements that used BUILD_MODE. (Bitbake rev: 4ce1559c2558bd0fd278ff02a1a93bec03c4156b) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/toaster/toastergui/templates/base.html9
-rw-r--r--bitbake/lib/toaster/toastergui/templates/landing.html10
-rw-r--r--bitbake/lib/toaster/toastergui/tests.py4
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py20
-rw-r--r--bitbake/lib/toaster/toastermain/settings.py3
-rw-r--r--bitbake/lib/toaster/toastermain/urls.py9
6 files changed, 5 insertions, 50 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/base.html b/bitbake/lib/toaster/toastergui/templates/base.html
index e0b15cef12..8081f069f4 100644
--- a/bitbake/lib/toaster/toastergui/templates/base.html
+++ b/bitbake/lib/toaster/toastergui/templates/base.html
@@ -79,7 +79,7 @@
79 <i class="icon-info-sign" title="<strong>Toaster version information</strong>" data-content="<dl><dt>Branch</dt><dd>{{TOASTER_BRANCH}}</dd><dt>Revision</dt><dd>{{TOASTER_REVISION}}</dd></dl>"></i> 79 <i class="icon-info-sign" title="<strong>Toaster version information</strong>" data-content="<dl><dt>Branch</dt><dd>{{TOASTER_BRANCH}}</dd><dt>Revision</dt><dd>{{TOASTER_REVISION}}</dd></dl>"></i>
80 {% endif %} 80 {% endif %}
81 </span> 81 </span>
82 {% if BUILD_MODE and request.resolver_match.url_name != 'landing' and request.resolver_match.url_name != 'newproject' %} 82 {% if request.resolver_match.url_name != 'landing' and request.resolver_match.url_name != 'newproject' %}
83 <ul class="nav"> 83 <ul class="nav">
84 <li {% if request.resolver_match.url_name == 'all-builds' %} 84 <li {% if request.resolver_match.url_name == 'all-builds' %}
85 class="active" 85 class="active"
@@ -108,13 +108,6 @@
108 </li> 108 </li>
109 </ul> 109 </ul>
110 <span class="pull-right divider-vertical"></span> 110 <span class="pull-right divider-vertical"></span>
111
112 <!-- new project button; only show in build mode -->
113 {% if BUILD_MODE %}
114 <div class="btn-group pull-right">
115 <a class="btn" id="new-project-button" href="{% url 'newproject' %}">New project</a>
116 </div>
117 {% endif %}
118 </div> 111 </div>
119 </div> 112 </div>
120 </div> 113 </div>
diff --git a/bitbake/lib/toaster/toastergui/templates/landing.html b/bitbake/lib/toaster/toastergui/templates/landing.html
index cafaa1afad..a1b5cdce75 100644
--- a/bitbake/lib/toaster/toastergui/templates/landing.html
+++ b/bitbake/lib/toaster/toastergui/templates/landing.html
@@ -6,9 +6,6 @@
6 6
7{% block title %} Welcome to Toaster {% endblock %} 7{% block title %} Welcome to Toaster {% endblock %}
8{% block pagecontent %} 8{% block pagecontent %}
9
10 {% if BUILD_MODE %}
11 <!-- build mode -->
12 <div class="container-fluid"> 9 <div class="container-fluid">
13 <div class="row-fluid"> 10 <div class="row-fluid">
14 <div class="hero-unit span12 well-transparent"> 11 <div class="hero-unit span12 well-transparent">
@@ -62,11 +59,4 @@
62 </div> 59 </div>
63 </div> 60 </div>
64 </div> 61 </div>
65 {% else %}
66 <!-- analysis mode -->
67 <div class="alert alert-info lead top-air">
68 Toaster has not recorded any builds yet. Run a build from the command line to see it here.
69 </div>
70 {% endif %}
71
72{% endblock %} 62{% endblock %}
diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py
index a6312034a8..c927fe1d8d 100644
--- a/bitbake/lib/toaster/toastergui/tests.py
+++ b/bitbake/lib/toaster/toastergui/tests.py
@@ -45,10 +45,6 @@ import string
45PROJECT_NAME = "test project" 45PROJECT_NAME = "test project"
46CLI_BUILDS_PROJECT_NAME = 'Command line builds' 46CLI_BUILDS_PROJECT_NAME = 'Command line builds'
47 47
48# by default, tests are run in build mode; to run in analysis mode,
49# set this to False in individual test cases
50toastermain.settings.BUILD_MODE = True
51
52class ViewTests(TestCase): 48class ViewTests(TestCase):
53 """Tests to verify view APIs.""" 49 """Tests to verify view APIs."""
54 50
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 0e255f1b86..69f5af0f3a 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -76,10 +76,6 @@ def landing(request):
76 default_project = Project.objects.get_default_project() 76 default_project = Project.objects.get_default_project()
77 default_project_builds = Build.objects.filter(project = default_project) 77 default_project_builds = Build.objects.filter(project = default_project)
78 78
79 if (not toastermain.settings.BUILD_MODE) and default_project_builds.count() > 0:
80 args = (default_project.id,)
81 return redirect(reverse('projectbuilds', args = args), permanent = False)
82
83 # we only redirect to projects page if there is a user-generated project 79 # we only redirect to projects page if there is a user-generated project
84 num_builds = Build.objects.all().count() 80 num_builds = Build.objects.all().count()
85 user_projects = Project.objects.filter(is_default = False) 81 user_projects = Project.objects.filter(is_default = False)
@@ -102,9 +98,6 @@ def _get_latest_builds(prj=None):
102 if prj is not None: 98 if prj is not None:
103 queryset = queryset.filter(project = prj) 99 queryset = queryset.filter(project = prj)
104 100
105 if not toastermain.settings.BUILD_MODE:
106 queryset = queryset.exclude(project__is_default=False)
107
108 return list(itertools.chain( 101 return list(itertools.chain(
109 queryset.filter(outcome=Build.IN_PROGRESS).order_by("-started_on"), 102 queryset.filter(outcome=Build.IN_PROGRESS).order_by("-started_on"),
110 queryset.filter(outcome__lt=Build.IN_PROGRESS).order_by("-started_on")[:3] )) 103 queryset.filter(outcome__lt=Build.IN_PROGRESS).order_by("-started_on")[:3] ))
@@ -1893,10 +1886,6 @@ def managedcontextprocessor(request):
1893 "projects": projects, 1886 "projects": projects,
1894 "non_cli_projects": projects.exclude(is_default=True), 1887 "non_cli_projects": projects.exclude(is_default=True),
1895 "DEBUG" : toastermain.settings.DEBUG, 1888 "DEBUG" : toastermain.settings.DEBUG,
1896
1897 # True if Toaster is in build mode, False otherwise
1898 "BUILD_MODE": toastermain.settings.BUILD_MODE,
1899
1900 "CUSTOM_IMAGE" : toastermain.settings.CUSTOM_IMAGE, 1889 "CUSTOM_IMAGE" : toastermain.settings.CUSTOM_IMAGE,
1901 "TOASTER_BRANCH": toastermain.settings.TOASTER_BRANCH, 1890 "TOASTER_BRANCH": toastermain.settings.TOASTER_BRANCH,
1902 "TOASTER_REVISION" : toastermain.settings.TOASTER_REVISION, 1891 "TOASTER_REVISION" : toastermain.settings.TOASTER_REVISION,
@@ -1939,11 +1928,6 @@ if True:
1939 1928
1940 queryset = Build.objects.all() 1929 queryset = Build.objects.all()
1941 1930
1942 # if in analysis mode, exclude builds for all projects except
1943 # command line builds
1944 if not toastermain.settings.BUILD_MODE:
1945 queryset = queryset.exclude(project__is_default=False)
1946
1947 redirect_page = resolve(request.path_info).url_name 1931 redirect_page = resolve(request.path_info).url_name
1948 1932
1949 context, pagesize, orderby = _build_list_helper(request, 1933 context, pagesize, orderby = _build_list_helper(request,
@@ -3048,10 +3032,6 @@ if True:
3048 queryset_all = queryset_all.filter(Q(is_default=False) | 3032 queryset_all = queryset_all.filter(Q(is_default=False) |
3049 q_default_with_builds) 3033 q_default_with_builds)
3050 3034
3051 # if in BUILD_MODE, exclude everything but the command line builds project
3052 if not toastermain.settings.BUILD_MODE:
3053 queryset_all = queryset_all.exclude(is_default=False)
3054
3055 # boilerplate code that takes a request for an object type and returns a queryset 3035 # boilerplate code that takes a request for an object type and returns a queryset
3056 # for that object type. copypasta for all needed table searches 3036 # for that object type. copypasta for all needed table searches
3057 (filter_string, search_term, ordering_string) = _search_tuple(request, Project) 3037 (filter_string, search_term, ordering_string) = _search_tuple(request, Project)
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py
index b28ddb2b0d..de686b2edc 100644
--- a/bitbake/lib/toaster/toastermain/settings.py
+++ b/bitbake/lib/toaster/toastermain/settings.py
@@ -92,9 +92,6 @@ if 'DATABASE_URL' in os.environ:
92 else: 92 else:
93 raise Exception("FIXME: Please implement missing database url schema for url: %s" % dburl) 93 raise Exception("FIXME: Please implement missing database url schema for url: %s" % dburl)
94 94
95BUILD_MODE = False
96if 'TOASTER_MANAGED' in os.environ and os.environ['TOASTER_MANAGED'] == "1":
97 BUILD_MODE = True
98 95
99# Allows current database settings to be exported as a DATABASE_URL environment variable value 96# Allows current database settings to be exported as a DATABASE_URL environment variable value
100 97
diff --git a/bitbake/lib/toaster/toastermain/urls.py b/bitbake/lib/toaster/toastermain/urls.py
index 6c4a953b41..5ce5a924d8 100644
--- a/bitbake/lib/toaster/toastermain/urls.py
+++ b/bitbake/lib/toaster/toastermain/urls.py
@@ -59,12 +59,11 @@ if toastermain.settings.DEBUG_PANEL_ENABLED:
59 urlpatterns.insert(1, url(r'', include(debug_toolbar.urls))) 59 urlpatterns.insert(1, url(r'', include(debug_toolbar.urls)))
60 #logger.info("Enabled django_toolbar extension") 60 #logger.info("Enabled django_toolbar extension")
61 61
62urlpatterns = [
63 # Uncomment the next line to enable the admin:
64 url(r'^admin/', include(admin.site.urls)),
65] + urlpatterns
62 66
63if toastermain.settings.BUILD_MODE:
64 urlpatterns = [
65 # Uncomment the next line to enable the admin:
66 url(r'^admin/', include(admin.site.urls)),
67 ] + urlpatterns
68# Automatically discover urls.py in various apps, beside our own 67# Automatically discover urls.py in various apps, beside our own
69# and map module directories to the patterns 68# and map module directories to the patterns
70 69