Skip to contentSkip to conversation

toaster: cummulative 11202017 patch

PATCH New David Reyna 1 participant 7 messages Dec 1, 2017

lore
Share & tools
lore
#0 lore raw

cover toaster: cummulative 11202017 patch

From: David Reyna <[email protected]>

1) This patch is intended for both YP-2.4.1 (Rocko branch)

I have sent the master version of this patch (v2) already.

2) This patch contains the following:
* 12363: this is a Medium+ defect to fix broken master Toaster builds to Rocko projects
* 12316,12315: these resolve issues from the ELCE-Prague BoF meeting
* 12192,12204,12193: these resolve forward going issues

3) There are no new files

The following changes since commit f7b90ab3eaf832bd81f3efc1dab4dcf6863ac284:

bitbake: main: Give a user readable error if we can't locate topdir (2017-10-31 09:09:27 +0000)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib dreyna/submit/dreyna/toaster/cummulative_112017_patch_rocko
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=dreyna/submit/dreyna/toaster/cummulative_112017_patch_rocko

David Reyna (6):
toaster: unset BBPATH before starting bbserver for backwards
compatibility
toaster: update Toaster for Django 1.11
toaster: some recipe events do not include packages
toaster: enable custom env support for shell calls
toaster: landing page show cmdline capture
toaster: add 'nobuild' option to Toaster

 bin/toaster                                     | 19 +++++---
 lib/bb/ui/buildinfohelper.py                    |  6 ++-
 lib/toaster/bldcollector/urls.py                |  2 +-
 lib/toaster/bldcontrol/localhostbecontroller.py | 44 +++++++++++-------
 lib/toaster/toastergui/templates/base.html      |  4 ++
 lib/toaster/toastergui/templates/landing.html   | 10 ++++-
 lib/toaster/toastergui/urls.py                  |  2 +-
 lib/toaster/toastergui/views.py                 | 59 +++++++++++++++----------
 lib/toaster/toastergui/widgets.py               |  4 ++
 lib/toaster/toastermain/settings.py             |  2 +-
 lib/toaster/toastermain/urls.py                 |  2 +-
 toaster-requirements.txt                        |  2 +-
 12 files changed, 103 insertions(+), 53 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/6 toaster: unset BBPATH before starting bbserver for backwards compatibility

From: David Reyna <[email protected]>

The latest build enviroment script is now setting BBPATH. This breaks building previous releases from a master-based Toaster, because with this newly inherited BBPATH value the 'bitbake.lock' file ends up in the Toaster build directory instead of the project's build directory.

Toaster should always clear BBPATH so that the bbserver's environment is clean (enough).

[YOCTO #12363]

---
 lib/toaster/bldcontrol/localhostbecontroller.py | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
lib/toaster/bldcontrol/localhostbecontroller.py +12 -6
index 83cb703..23b2792 100644
@@ -332,15 +332,18 @@ class LocalhostBEController(BuildEnvironmentController):
                 conf.write('%s="%s"\n' % (var.name, var.value))
             conf.write('INHERIT+="toaster buildhistory"')
 
+        # clean the Toaster to build environment
+        env_clean = 'unset BBPATH;' # clean BBPATH for <= YP-2.4.0
+
         # run bitbake server from the clone
         bitbake = os.path.join(self.pokydirname, 'bitbake', 'bin', 'bitbake')
         toasterlayers = os.path.join(builddir,"conf/toaster-bblayers.conf")
-        self._shellcmd('bash -c \"source %s %s; BITBAKE_UI="knotty" %s --read %s --read %s '
-                       '--server-only -B 0.0.0.0:0\"' % (oe_init,
+        self._shellcmd('%s bash -c \"source %s %s; BITBAKE_UI="knotty" %s --read %s --read %s '
+                       '--server-only -B 0.0.0.0:0\"' % (env_clean, oe_init,
                        builddir, bitbake, confpath, toasterlayers), self.be.sourcedir)
 
         # read port number from bitbake.lock
-        self.be.bbport = ""
+        self.be.bbport = -1
         bblock = os.path.join(builddir, 'bitbake.lock')
         # allow 10 seconds for bb lock file to appear but also be populated
         for lock_check in range(10):
@@ -352,6 +355,9 @@ class LocalhostBEController(BuildEnvironmentController):
                 break
             logger.debug("localhostbecontroller: waiting for bblock content to appear")
             time.sleep(1)
+        else:
+            raise BuildSetupException("Cannot find bitbake server lock file '%s'. Aborting." % bblock)
+
         with open(bblock) as fplock:
             for line in fplock:
                 if ":" in line:
@@ -359,7 +365,7 @@ class LocalhostBEController(BuildEnvironmentController):
                     logger.debug("localhostbecontroller: bitbake port %s", self.be.bbport)
                     break
 
-        if not self.be.bbport:
+        if -1 == self.be.bbport:
             raise BuildSetupException("localhostbecontroller: can't read bitbake port from %s" % bblock)
 
         self.be.bbaddress = "localhost"
@@ -380,10 +386,10 @@ class LocalhostBEController(BuildEnvironmentController):
         log = os.path.join(builddir, 'toaster_ui.log')
         local_bitbake = os.path.join(os.path.dirname(os.getenv('BBBASEDIR')),
                                      'bitbake')
-        self._shellcmd(['bash -c \"(TOASTER_BRBE="%s" BBSERVER="0.0.0.0:%s" '
+        self._shellcmd(['%s bash -c \"(TOASTER_BRBE="%s" BBSERVER="0.0.0.0:%s" '
                         '%s %s -u toasterui  --read %s --read %s --token="" >>%s 2>&1;'
                         'BITBAKE_UI="knotty" BBSERVER=0.0.0.0:%s %s -m)&\"' \
-                        % (brbe, self.be.bbport, local_bitbake, bbtargets, confpath, toasterlayers, log,
+                        % (env_clean, brbe, self.be.bbport, local_bitbake, bbtargets, confpath, toasterlayers, log,
                         self.be.bbport, bitbake,)],
                         builddir, nowait=True)
 
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/6 toaster: update Toaster for Django 1.11

In reply to David Reyna

From: David Reyna <[email protected]>

Toaster needs to accomodate API changes in Django 1.11.

[YOCTO #12192]

---
 lib/toaster/bldcollector/urls.py    | 2 +-
 lib/toaster/toastergui/urls.py      | 2 +-
 lib/toaster/toastergui/views.py     | 2 +-
 lib/toaster/toastermain/settings.py | 2 +-
 lib/toaster/toastermain/urls.py     | 2 +-
 toaster-requirements.txt            | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
lib/toaster/bldcollector/urls.py +1 -1
index 076afdb..888175d 100644
@@ -17,7 +17,7 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 
-from django.conf.urls import patterns, include, url
+from django.conf.urls import include, url
 
 import bldcollector.views
 
lib/toaster/toastergui/urls.py +1 -1
index 3ad5566..e07b0ef 100644
@@ -16,7 +16,7 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-from django.conf.urls import patterns, include, url
+from django.conf.urls import include, url
 from django.views.generic import RedirectView, TemplateView
 
 from django.http import HttpResponseBadRequest
lib/toaster/toastergui/views.py +1 -1
index 334bb4a..209b07d 100755
@@ -277,7 +277,7 @@ def _validate_input(field_input, model):
             return None, invalid + str(field_input_list)
 
         # Check we are looking for a valid field
-        valid_fields = model._meta.get_all_field_names()
+        valid_fields = [f.name for f in model._meta.get_fields()]
         for field in field_input_list[0].split(AND_VALUE_SEPARATOR):
             if True in [field.startswith(x) for x in valid_fields]:
                 break
lib/toaster/toastermain/settings.py +1 -1
index 54ab31f..13541d3 100644
@@ -186,7 +186,7 @@ TEMPLATES = [
                 'django.template.context_processors.tz',
                 'django.contrib.messages.context_processors.messages',
                 # Custom
-                'django.core.context_processors.request',
+                'django.template.context_processors.request',
                 'toastergui.views.managedcontextprocessor',
 
             ],
lib/toaster/toastermain/urls.py +1 -1
index 6750bdf..e2fb0ae 100644
@@ -19,7 +19,7 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-from django.conf.urls import patterns, include, url
+from django.conf.urls import include, url
 from django.views.generic import RedirectView, TemplateView
 from django.views.decorators.cache import never_cache
 import bldcollector.views
toaster-requirements.txt +1 -1
index 3f47650..c0ec368 100644
@@ -1,3 +1,3 @@
-Django>1.8,<1.9.9
+Django>1.8,<1.11.9
 beautifulsoup4>=4.4.0
 pytz
Signature · 1 line
1.9.1
#3 lore raw

PATCH 3/6 toaster: some recipe events do not include packages

In reply to David Reyna

From: David Reyna <[email protected]>

Allow for "SinglePackageInfo" events that do not include package data, for example OPKGN equal 'lib32-*' or 'lib64-*'.

[YOCTO #12204]

---
 lib/bb/ui/buildinfohelper.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
lib/bb/ui/buildinfohelper.py +5 -1
index e451c63..524a5b0 100644
@@ -719,7 +719,11 @@ class ORMWrapper(object):
 
     def save_build_package_information(self, build_obj, package_info, recipes,
                                        built_package):
-       # assert isinstance(build_obj, Build)
+        # assert isinstance(build_obj, Build)
+
+        if not 'PN' in package_info.keys():
+            # no package data to save (e.g. 'OPKGN'="lib64-*"|"lib32-*")
+            return None
 
         # create and save the object
         pname = package_info['PKG']
Signature · 1 line
1.9.1
#4 lore raw

PATCH 4/6 toaster: enable custom env support for shell calls

In reply to David Reyna

From: David Reyna <[email protected]>

Allow for custom environment additions for git cloning, for example for anspass support.

[YOCTO #12193]

---
 lib/toaster/bldcontrol/localhostbecontroller.py | 26 ++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)
lib/toaster/bldcontrol/localhostbecontroller.py +15 -11
index 23b2792..4c17562 100644
@@ -52,12 +52,14 @@ class LocalhostBEController(BuildEnvironmentController):
         self.pokydirname = None
         self.islayerset = False
 
-    def _shellcmd(self, command, cwd=None, nowait=False):
+    def _shellcmd(self, command, cwd=None, nowait=False,env=None):
         if cwd is None:
             cwd = self.be.sourcedir
+        if env is None:
+            env=os.environ.copy()
 
-        logger.debug("lbc_shellcmmd: (%s) %s" % (cwd, command))
-        p = subprocess.Popen(command, cwd = cwd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        logger.debug("lbc_shellcmd: (%s) %s" % (cwd, command))
+        p = subprocess.Popen(command, cwd = cwd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
         if nowait:
             return
         (out,err) = p.communicate()
@@ -98,6 +100,8 @@ class LocalhostBEController(BuildEnvironmentController):
 
         layerlist = []
         nongitlayerlist = []
+        git_env = os.environ.copy()
+        # (note: add custom environment settings here)
 
         # set layers in the layersource
 
@@ -138,7 +142,7 @@ class LocalhostBEController(BuildEnvironmentController):
         cached_layers = {}
 
         try:
-            for remotes in self._shellcmd("git remote -v", self.be.sourcedir).split("\n"):
+            for remotes in self._shellcmd("git remote -v", self.be.sourcedir,env=git_env).split("\n"):
                 try:
                     remote = remotes.split("\t")[1].split(" ")[0]
                     if remote not in cached_layers:
@@ -167,7 +171,7 @@ class LocalhostBEController(BuildEnvironmentController):
             if os.path.exists(localdirname):
                 try:
                     localremotes = self._shellcmd("git remote -v",
-                                                  localdirname)
+                                                  localdirname,env=git_env)
                     if not giturl in localremotes and commit != 'HEAD':
                         raise BuildSetupException("Existing git repository at %s, but with different remotes ('%s', expected '%s'). Toaster will not continue out of fear of damaging something." % (localdirname, ", ".join(localremotes.split("\n")), giturl))
                 except ShellCmdException:
@@ -177,18 +181,18 @@ class LocalhostBEController(BuildEnvironmentController):
             else:
                 if giturl in cached_layers:
                     logger.debug("localhostbecontroller git-copying %s to %s" % (cached_layers[giturl], localdirname))
-                    self._shellcmd("git clone \"%s\" \"%s\"" % (cached_layers[giturl], localdirname))
-                    self._shellcmd("git remote remove origin", localdirname)
-                    self._shellcmd("git remote add origin \"%s\"" % giturl, localdirname)
+                    self._shellcmd("git clone \"%s\" \"%s\"" % (cached_layers[giturl], localdirname),env=git_env)
+                    self._shellcmd("git remote remove origin", localdirname,env=git_env)
+                    self._shellcmd("git remote add origin \"%s\"" % giturl, localdirname,env=git_env)
                 else:
                     logger.debug("localhostbecontroller: cloning %s in %s" % (giturl, localdirname))
-                    self._shellcmd('git clone "%s" "%s"' % (giturl, localdirname))
+                    self._shellcmd('git clone "%s" "%s"' % (giturl, localdirname),env=git_env)
 
             # branch magic name "HEAD" will inhibit checkout
             if commit != "HEAD":
                 logger.debug("localhostbecontroller: checking out commit %s to %s " % (commit, localdirname))
                 ref = commit if re.match('^[a-fA-F0-9]+$', commit) else 'origin/%s' % commit
-                self._shellcmd('git fetch --all && git reset --hard "%s"' % ref, localdirname)
+                self._shellcmd('git fetch --all && git reset --hard "%s"' % ref, localdirname,env=git_env)
 
             # take the localdirname as poky dir if we can find the oe-init-build-env
             if self.pokydirname is None and os.path.exists(os.path.join(localdirname, "oe-init-build-env")):
@@ -198,7 +202,7 @@ class LocalhostBEController(BuildEnvironmentController):
                 # make sure we have a working bitbake
                 if not os.path.exists(os.path.join(self.pokydirname, 'bitbake')):
                     logger.debug("localhostbecontroller: checking bitbake into the poky dirname %s " % self.pokydirname)
-                    self._shellcmd("git clone -b \"%s\" \"%s\" \"%s\" " % (bitbake.commit, bitbake.giturl, os.path.join(self.pokydirname, 'bitbake')))
+                    self._shellcmd("git clone -b \"%s\" \"%s\" \"%s\" " % (bitbake.commit, bitbake.giturl, os.path.join(self.pokydirname, 'bitbake')),env=git_env)
 
             # verify our repositories
             for name, dirpath in gitrepos[(giturl, commit)]:
Signature · 1 line
1.9.1
#5 lore raw

PATCH 5/6 toaster: landing page show cmdline capture

In reply to David Reyna

From: David Reyna <[email protected]>

The Toaster initial landing page needs to show that it still has the command line build capture support in addition to the new project support.

[YOCTO #12316]

---
 lib/toaster/toastergui/templates/landing.html | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
lib/toaster/toastergui/templates/landing.html +7 -1
index 4986632..cf7516d 100644
@@ -14,10 +14,16 @@
 
               <p>A web interface to <a href="http://www.openembedded.org">OpenEmbedded</a> and <a href="http://www.yoctoproject.org/tools-resources/projects/bitbake">BitBake</a>, the <a href="http://www.yoctoproject.org">Yocto Project</a> build system.</p>
 
+		          <p class="top-air">
+		            <a class="btn btn-info btn-lg" href="http://www.yoctoproject.org/docs/latest/toaster-manual/toaster-manual.html#toaster-manual-setup-and-use">
+			            Toaster is ready to capture your command line builds
+		            </a>
+		          </p>
+
 		          {% if lvs_nos %}
 		            <p class="top-air">
 		              <a class="btn btn-primary btn-lg" href="{% url 'newproject' %}">
-			              To start building, create your first Toaster project
+			              Create your first Toaster project to run manage builds
 		              </a>
 		            </p>
 		          {% else %}
Signature · 1 line
1.9.1
#6 lore raw

PATCH 6/6 toaster: add 'nobuild' option to Toaster

In reply to David Reyna

From: David Reyna <[email protected]>

Add a 'nobuild' option for starting Toaster without the project and hosted builds support. This allows a Toaster host to provide local build statistics without opening the host to external users building projects.

[YOCTO #12315]

---
 bin/toaster                                   | 19 ++++++---
 lib/toaster/toastergui/templates/base.html    |  4 ++
 lib/toaster/toastergui/templates/landing.html |  2 +
 lib/toaster/toastergui/views.py               | 57 ++++++++++++++++-----------
 lib/toaster/toastergui/widgets.py             |  4 ++
 5 files changed, 58 insertions(+), 28 deletions(-)
bin/toaster +14 -5
index 762451d..4036f0a 100755
@@ -18,9 +18,10 @@
 # along with this program. If not, see http://www.gnu.org/licenses/.
 
 HELP="
-Usage: source toaster start|stop [webport=<address:port>] [noweb]
+Usage: source toaster start|stop [webport=<address:port>] [noweb] [nobuild]
     Optional arguments:
-        [noweb] Setup the environment for building with toaster but don't start the development server
+        [nobuild] Setup the environment for capturing builds with toaster but disable managed builds
+        [noweb] Setup the environment for capturing builds with toaster but don't start the web server
         [webport] Set the development server (default: localhost:8000)
 "
 
@@ -183,6 +184,7 @@ unset OE_ROOT
 
 
 WEBSERVER=1
+export TOASTER_BUILDSERVER=1
 ADDR_PORT="localhost:8000"
 unset CMD
 for param in $*; do
@@ -190,6 +192,9 @@ for param in $*; do
     noweb )
             WEBSERVER=0
     ;;
+    nobuild )
+            TOASTER_BUILDSERVER=0
+    ;;
     start )
             CMD=$param
     ;;
@@ -286,9 +291,13 @@ case $CMD in
             return 4
         fi
         export BITBAKE_UI='toasterui'
-        $MANAGE runbuilds \
-           </dev/null >>${BUILDDIR}/toaster_runbuilds.log 2>&1 \
-           & echo $! >${BUILDDIR}/.runbuilds.pid
+        if [ $TOASTER_BUILDSERVER -eq 1 ] ; then
+            $MANAGE runbuilds \
+               </dev/null >>${BUILDDIR}/toaster_runbuilds.log 2>&1 \
+               & echo $! >${BUILDDIR}/.runbuilds.pid
+        else
+            echo "Toaster build server not started."
+        fi
 
         # set fail safe stop system on terminal exit
         trap stop_system SIGHUP
lib/toaster/toastergui/templates/base.html +4 -0
index edbd110..4f72064 100644
@@ -110,6 +110,7 @@
                 All builds
               </a>
               </li>
+              {% if project_enable %}
               <li id="navbar-all-projects"
               {% if request.resolver_match.url_name == 'all-projects'  %}
               class="active"
@@ -119,6 +120,7 @@
                 All projects
               </a>
               </li>
+              {% endif %}
             {% endif %}
               <li id="navbar-docs">
               <a target="_blank" href="http://www.yoctoproject.org/docs/latest/toaster-manual/toaster-manual.html">
@@ -127,7 +129,9 @@
               </a>
               </li>
             </ul>
+            {% if project_enable %}
             <a class="btn btn-default navbar-btn navbar-right" id="new-project-button" href="{% url 'newproject' %}">New project</a>
+            {% endif %}
           </div>
       </div>
     </nav>
lib/toaster/toastergui/templates/landing.html +2 -0
index cf7516d..70c7359 100644
@@ -21,11 +21,13 @@
 		          </p>
 
 		          {% if lvs_nos %}
+                    {% if project_enable %}
 		            <p class="top-air">
 		              <a class="btn btn-primary btn-lg" href="{% url 'newproject' %}">
 			              Create your first Toaster project to run manage builds
 		              </a>
 		            </p>
+                    {% endif %}
 		          {% else %}
                 <div class="alert alert-info lead top-air">
                   Toaster has no layer information. Without layer information, you cannot run builds. To generate layer information you can:
lib/toaster/toastergui/views.py +34 -23

206 lines not on this page · raw message

lib/toaster/toastergui/widgets.py +4 -0
index 67c1ff9..a1792d9 100644
@@ -41,6 +41,7 @@ import types
 import json
 import collections
 import re
+import os
 
 from toastergui.tablefilter import TableFilterMap
 
@@ -86,6 +87,9 @@ class ToasterTable(TemplateView):
         context['table_name'] = type(self).__name__.lower()
         context['empty_state'] = self.empty_state
 
+        # global variables
+        context['project_enable'] = ('1' == os.environ.get('TOASTER_BUILDSERVER'))
+
         return context
 
     def get(self, request, *args, **kwargs):
Signature · 1 line
1.9.1