All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ed Bartosh <ed.bartosh@linux.intel.com>
To: toaster@yoctoproject.org
Subject: [PATCH 18/26] toaster: remove usage of BUILD_MODE variable
Date: Thu, 12 Nov 2015 14:04:41 +0200	[thread overview]
Message-ID: <2eaa6f39ef383d002b1984a626489dddba06e47a.1447328915.git.ed.bartosh@linux.intel.com> (raw)
In-Reply-To: <cover.1447328915.git.ed.bartosh@linux.intel.com>
In-Reply-To: <cover.1447328915.git.ed.bartosh@linux.intel.com>

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.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 bitbake/lib/toaster/toastergui/templates/base.html   | 13 +++++--------
 .../lib/toaster/toastergui/templates/landing.html    | 10 ----------
 bitbake/lib/toaster/toastergui/tests.py              |  4 ----
 bitbake/lib/toaster/toastergui/views.py              | 20 --------------------
 bitbake/lib/toaster/toastermain/settings.py          |  3 ---
 bitbake/lib/toaster/toastermain/urls.py              |  9 ++++-----
 6 files changed, 9 insertions(+), 50 deletions(-)

diff --git a/bitbake/lib/toaster/toastergui/templates/base.html b/bitbake/lib/toaster/toastergui/templates/base.html
index 11ac2a0..45367d5 100644
--- a/bitbake/lib/toaster/toastergui/templates/base.html
+++ b/bitbake/lib/toaster/toastergui/templates/base.html
@@ -93,7 +93,7 @@
             <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>
             {% endif %}
           </span>
-          {% if BUILD_MODE and request.resolver_match.url_name != 'landing' and request.resolver_match.url_name != 'newproject' %}
+          {% if request.resolver_match.url_name != 'landing' and request.resolver_match.url_name != 'newproject' %}
           <ul class="nav">
             <li {% if request.resolver_match.url_name == 'all-builds' %}
                 class="active"
@@ -123,18 +123,15 @@
           </ul>
           <span class="pull-right divider-vertical"></span>
 
-          <!-- new project button; only show in build mode -->
-          {% if BUILD_MODE %}
-            <div class="btn-group pull-right">
-              <a class="btn" id="new-project-button" href="{% url 'newproject' %}">New project</a>
-            </div>
-          {% endif %}
+          <div class="btn-group pull-right">
+            <a class="btn" id="new-project-button" href="{% url 'newproject' %}">New project</a>
+          </div>
 
           <!--
           New build popover; only shown if there is at least one user-created project
           and we're in build mode
           -->
-          {% if BUILD_MODE and non_cli_projects.count > 0 %}
+          {% if non_cli_projects.count > 0 %}
             <div class="btn-group pull-right" id="new-build-button" style="display:none">
               <button class="btn dropdown-toggle" data-toggle="dropdown">
                 New build
diff --git a/bitbake/lib/toaster/toastergui/templates/landing.html b/bitbake/lib/toaster/toastergui/templates/landing.html
index cafaa1a..a1b5cdc 100644
--- a/bitbake/lib/toaster/toastergui/templates/landing.html
+++ b/bitbake/lib/toaster/toastergui/templates/landing.html
@@ -6,9 +6,6 @@
 
 {% block title %} Welcome to Toaster {% endblock %}
 {% block pagecontent %}
-
-  {% if BUILD_MODE %}
-    <!-- build mode -->
     <div class="container-fluid">
       <div class="row-fluid">
         <div class="hero-unit span12 well-transparent">
@@ -62,11 +59,4 @@
         </div>
       </div>
     </div>
-  {% else %}
-    <!-- analysis mode -->
-    <div class="alert alert-info lead top-air">
-      Toaster has not recorded any builds yet. Run a build from the command line to see it here.
-    </div>
-  {% endif %}
-
 {% endblock %}
diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py
index 9e6c46a..3685fd8 100644
--- a/bitbake/lib/toaster/toastergui/tests.py
+++ b/bitbake/lib/toaster/toastergui/tests.py
@@ -42,10 +42,6 @@ import re
 PROJECT_NAME = "test project"
 CLI_BUILDS_PROJECT_NAME = 'Command line builds'
 
-# by default, tests are run in build mode; to run in analysis mode,
-# set this to False in individual test cases
-toastermain.settings.BUILD_MODE = True
-
 class ViewTests(TestCase):
     """Tests to verify view APIs."""
 
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 0e255f1..69f5af0 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -76,10 +76,6 @@ def landing(request):
     default_project = Project.objects.get_default_project()
     default_project_builds = Build.objects.filter(project = default_project)
 
-    if (not toastermain.settings.BUILD_MODE) and default_project_builds.count() > 0:
-        args = (default_project.id,)
-        return redirect(reverse('projectbuilds', args = args), permanent = False)
-
     # we only redirect to projects page if there is a user-generated project
     num_builds = Build.objects.all().count()
     user_projects = Project.objects.filter(is_default = False)
@@ -102,9 +98,6 @@ def _get_latest_builds(prj=None):
     if prj is not None:
         queryset = queryset.filter(project = prj)
 
-    if not toastermain.settings.BUILD_MODE:
-        queryset = queryset.exclude(project__is_default=False)
-
     return list(itertools.chain(
         queryset.filter(outcome=Build.IN_PROGRESS).order_by("-started_on"),
         queryset.filter(outcome__lt=Build.IN_PROGRESS).order_by("-started_on")[:3] ))
@@ -1893,10 +1886,6 @@ def managedcontextprocessor(request):
         "projects": projects,
         "non_cli_projects": projects.exclude(is_default=True),
         "DEBUG" : toastermain.settings.DEBUG,
-
-        # True if Toaster is in build mode, False otherwise
-        "BUILD_MODE": toastermain.settings.BUILD_MODE,
-
         "CUSTOM_IMAGE" : toastermain.settings.CUSTOM_IMAGE,
         "TOASTER_BRANCH": toastermain.settings.TOASTER_BRANCH,
         "TOASTER_REVISION" : toastermain.settings.TOASTER_REVISION,
@@ -1939,11 +1928,6 @@ if True:
 
         queryset = Build.objects.all()
 
-        # if in analysis mode, exclude builds for all projects except
-        # command line builds
-        if not toastermain.settings.BUILD_MODE:
-            queryset = queryset.exclude(project__is_default=False)
-
         redirect_page = resolve(request.path_info).url_name
 
         context, pagesize, orderby = _build_list_helper(request,
@@ -3048,10 +3032,6 @@ if True:
         queryset_all = queryset_all.filter(Q(is_default=False) |
                                            q_default_with_builds)
 
-        # if in BUILD_MODE, exclude everything but the command line builds project
-        if not toastermain.settings.BUILD_MODE:
-            queryset_all = queryset_all.exclude(is_default=False)
-
         # boilerplate code that takes a request for an object type and returns a queryset
         # for that object type. copypasta for all needed table searches
         (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 b28ddb2..de686b2 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:
     else:
         raise Exception("FIXME: Please implement missing database url schema for url: %s" % dburl)
 
-BUILD_MODE = False
-if 'TOASTER_MANAGED' in os.environ and os.environ['TOASTER_MANAGED'] == "1":
-    BUILD_MODE = True
 
 # Allows current database settings to be exported as a DATABASE_URL environment variable value
 
diff --git a/bitbake/lib/toaster/toastermain/urls.py b/bitbake/lib/toaster/toastermain/urls.py
index 6c4a953..5ce5a92 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:
     urlpatterns.insert(1, url(r'', include(debug_toolbar.urls)))
     #logger.info("Enabled django_toolbar extension")
 
+urlpatterns = [
+    # Uncomment the next line to enable the admin:
+    url(r'^admin/', include(admin.site.urls)),
+] + urlpatterns
 
-if toastermain.settings.BUILD_MODE:
-    urlpatterns = [
-        # Uncomment the next line to enable the admin:
-        url(r'^admin/', include(admin.site.urls)),
-    ] + urlpatterns
 # Automatically discover urls.py in various apps, beside our own
 # and map module directories to the patterns
 
-- 
2.1.4



  parent reply	other threads:[~2015-11-12 12:39 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-12 11:55 [PATCH v4 00/26] toaster: 8279: Provide a single way of starting Toaster Ed Bartosh
2015-11-12 11:55 ` [PATCH 01/26] toaster: don't allow to run toaster as a script Ed Bartosh
2015-11-12 11:55 ` [PATCH 02/26] toaster: implement get-dburl command Ed Bartosh
2015-11-12 11:55 ` [PATCH 03/26] toaster: set DATABASE_URL in toaster script Ed Bartosh
2015-11-12 11:55 ` [PATCH 04/26] toaster: run bitbake the same way Ed Bartosh
2015-11-12 11:55 ` [PATCH 05/26] toaster: remove unused variable Ed Bartosh
2015-11-12 11:55 ` [PATCH 06/26] toaster: check for toaster configuration later Ed Bartosh
2015-11-12 11:55 ` [PATCH 07/26] toaster: use parent of the build dir Ed Bartosh
2015-11-12 11:55 ` [PATCH 08/26] toaster: make runbuilds to loop Ed Bartosh
2015-11-12 12:04 ` [PATCH 09/26] toaster: start 'manage.py runbuilds' in the script Ed Bartosh
2015-11-12 12:04 ` [PATCH 10/26] toaster: update brbe and project attributes Ed Bartosh
2015-11-12 12:04 ` [PATCH 11/26] toaster: implement stop_bitbake function Ed Bartosh
2015-11-12 12:04 ` [PATCH 12/26] toaster: implement start_bitbake function Ed Bartosh
2015-11-12 12:04 ` [PATCH 13/26] toaster: implement 'toaster restart-bitbake' Ed Bartosh
2015-11-12 12:04 ` [PATCH 14/26] toaster: remove _setupBE function Ed Bartosh
2015-11-12 12:04 ` [PATCH 15/26] toaster: reimplemented startBBServer method Ed Bartosh
2015-11-12 12:04 ` [PATCH 16/26] toaster: remove stopBBServer API Ed Bartosh
2015-11-12 12:04 ` [PATCH 17/26] toaster: do not terminate bb server Ed Bartosh
2015-11-12 12:04 ` Ed Bartosh [this message]
2015-11-12 12:04 ` [PATCH 19/26] toaster: do not create duplicate HelpText objects Ed Bartosh
2015-11-12 12:04 ` [PATCH 20/26] toaster: buildinfohelper Broaden the toaster created recipe data case Ed Bartosh
2015-11-12 12:04 ` [PATCH 21/26] toaster: implement BitbakeController.getVariable Ed Bartosh
2015-11-12 12:04 ` [PATCH 22/26] toaster: set varibales on bitbake server Ed Bartosh
2015-11-12 12:04 ` [PATCH 23/26] toaster: remove writeConfFile API Ed Bartosh
2015-11-12 12:04 ` [PATCH 24/26] toaster: stop using toaster-pre.conf Ed Bartosh
2015-11-12 12:04 ` [PATCH 25/26] toaster: remove SDKMACHINE from project variables Ed Bartosh
2015-11-12 12:04 ` [PATCH 26/26] toaster: get rid of complicated heuristics Ed Bartosh
2015-11-16 18:40 ` [PATCH v4 00/26] toaster: 8279: Provide a single way of starting Toaster Brian Avery

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2eaa6f39ef383d002b1984a626489dddba06e47a.1447328915.git.ed.bartosh@linux.intel.com \
    --to=ed.bartosh@linux.intel.com \
    --cc=toaster@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.