[bitbake-devel] [PATCH 09/27] toaster: display Toaster mode and version in debug mode

Alex DAMIAN alexandru.damian at intel.com
Mon Feb 9 18:01:39 UTC 2015


From: Alexandru DAMIAN <alexandru.damian at intel.com>

This patch displays the current running mode and checked-out git branch
as Toaster version when running in debug mode.

Signed-off-by: Alexandru DAMIAN <alexandru.damian at intel.com>
---
 lib/toaster/toastergui/static/css/default.css | 19 +++++++++++++++++++
 lib/toaster/toastergui/templates/base.html    |  6 ++++++
 lib/toaster/toastergui/views.py               |  8 ++++++--
 lib/toaster/toastermain/settings.py           |  5 +++--
 4 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/lib/toaster/toastergui/static/css/default.css b/lib/toaster/toastergui/static/css/default.css
index 1095254..a866773 100644
--- a/lib/toaster/toastergui/static/css/default.css
+++ b/lib/toaster/toastergui/static/css/default.css
@@ -2,6 +2,25 @@
 .logo img { height: 30px; width: auto !important; }
 .logo { padding-top: 4px !important; padding-bottom:0px !important; }
 
+/* style the version text */
+.version-text {
+	color: #AAA;
+	font-size: 0.6em;
+	display: table-footer-group;
+	padding: 0px;
+	margin: 1px 1px 1px 1px;
+}
+
+.version-brand, .version-brand:hover, a.version-brand:focus  {
+    color: #777;
+    display: block;
+    float: left;
+    font-size: 20px;
+    font-weight: 200;
+    padding: 00px 0px;
+    text-shadow: 0 1px 0 #fff;
+}
+
 /* Style the breadcrumb */
 .breadcrumb { display: inline-block; background-color: transparent; }
 .section { margin: 20px 0; }
diff --git a/lib/toaster/toastergui/templates/base.html b/lib/toaster/toastergui/templates/base.html
index e95b5e0..6f249bc 100644
--- a/lib/toaster/toastergui/templates/base.html
+++ b/lib/toaster/toastergui/templates/base.html
@@ -59,6 +59,12 @@
     <div class="navbar-inner">
             <a class="brand logo" href="#"><img src="{% static 'img/logo.png' %}" class="" alt="Yocto logo project"/></a>
             <a class="brand" href="/">Toaster</a>
+            {% if DEBUG %}
+            <div style="display: inline;" class="version-brand">
+              <p class="version-text">version {{TOASTER_VERSION}}</p>
+              <p class="version-text">{%if MANAGED%}managed{%else%}interactive{%endif%} mode</p>
+            </div>
+            {% endif %}
             <a class="pull-right manual" target="_blank" href="http://www.yoctoproject.org/documentation/toaster-manual">
                 <i class="icon-book"></i>
                 Toaster manual
diff --git a/lib/toaster/toastergui/views.py b/lib/toaster/toastergui/views.py
index b67a676..4b770ff 100755
--- a/lib/toaster/toastergui/views.py
+++ b/lib/toaster/toastergui/views.py
@@ -1709,10 +1709,12 @@ if toastermain.settings.MANAGED:
 
     # the context processor that supplies data used across all the pages
     def managedcontextprocessor(request):
+        import subprocess
         ret = {
             "projects": Project.objects.all(),
             "MANAGED" : toastermain.settings.MANAGED,
-            "DEBUG" : toastermain.settings.DEBUG
+            "DEBUG" : toastermain.settings.DEBUG,
+            "TOASTER_VERSION": toastermain.settings.TOASTER_VERSION,
         }
         if 'project_id' in request.session:
             try:
@@ -3057,7 +3059,9 @@ else:
         return {
             "projects": [],
             "MANAGED" : toastermain.settings.MANAGED,
-            "DEBUG" : toastermain.settings.DEBUG
+            "DEBUG" : toastermain.settings.DEBUG,
+            "TOASTER_VERSION": toastermain.settings.TOASTER_VERSION,
+
         }
 
 
diff --git a/lib/toaster/toastermain/settings.py b/lib/toaster/toastermain/settings.py
index ea7c353..b6a42c0 100644
--- a/lib/toaster/toastermain/settings.py
+++ b/lib/toaster/toastermain/settings.py
@@ -211,8 +211,6 @@ MIDDLEWARE_CLASSES = (
     'django.middleware.csrf.CsrfViewMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
     'django.contrib.messages.middleware.MessageMiddleware',
-    'django.middleware.cache.UpdateCacheMiddleware',
-    'django.middleware.cache.FetchFromCacheMiddleware',
     # Uncomment the next line for simple clickjacking protection:
     # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 )
@@ -233,6 +231,9 @@ CACHES = {
 from os.path import dirname as DN
 SITE_ROOT=DN(DN(os.path.abspath(__file__)))
 
+import subprocess
+TOASTER_VERSION = subprocess.Popen('cd %s; git branch | grep "^* " | tr -d "* "' % SITE_ROOT, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0]
+
 ROOT_URLCONF = 'toastermain.urls'
 
 # Python dotted path to the WSGI application used by Django's runserver.
-- 
1.9.1




More information about the bitbake-devel mailing list