event: Fix event handlers to raise SkipPackage

If an event handler triggers a SkipPackage event, we really want that
event to be received and processed by the higher code levels. Currently
it was getting caught and ignored which was leading to recipes
being present when they clearly shouldn't have been.

In general this exception catching looks to be doing the wrong thing. It
was introduced in
http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/bitbake/lib/bb/event.py?id=37cb4cc02b2e2b6c338c5943747e0a1ef15176b3
but we likely want exceptions to pass through to the higher layers.

This patch therefore removes that code.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
cookerdata: Improve error handling

If we see errors during parsing, firstly its bad to show a traceback
for an expansion error so lets suppress this.

Secondly, raise a BBHandledException instead of a SystemExit to show
we've informed the user about the condition (printing a traceback in the
default unknown case).

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
event.py: Allow passthrough of BBHandledException events

We need BBHandledException events to be passed through to the higher
layers, they don't need addition of any traceback since they've already
been reported to the user.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
event: Add SkipRecipe event to replace SkipPackage

In the depths of time we were rather confused about naming. bb files
are recipes, the event to skip parsing them should be SkipRecipe,
not SkipPackage. This changes bitbake to use the better name but
leaves the other around for now. We can therefore start removing
references to it from the metadata.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bb.fatal: Raise a BBHandledException instead of exiting

With new bitbake UIs having the cooker exit at 'random' points
in the codebase is problematic. This patch raises an exception
which matches the situation instead.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
build/utils: Fix broken exception handling

Checking for explicit exception names is bad, we also want to be able top
rely on inheritance. Fix these checks to be part of the real except clauses
so SkipPackage is recognised as being inherited from SkipRecipe.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
siggen: Print warning about tainted tasks

The big warning printed when people use -f is easily ignored/forgotten.
To raise user awareness, print a warning any time we include a tainted
stamp file into a build instead.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake: move configuration reading code

The configuration reading code should live in the
main bitbake entry point, and the server modules should
be supplied with correct configuration instead of attempting
to parse from configuration files.

This patch moves the endpoint address reading from XMLRPC
to the bitbake main script.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
xmlrpc: client - remove fatal errors

When we use the XMLRPC client API to connect to a bitbake server,
we want to receive errors from the API instead of having the
API exiting without warning.

Thus the "bb.fatal" calls have been replaced with "bb.warn" calls,
and we re-raise the original exception for handling by the
original caller.

The bitbake starting script has been modified to properly test
for failures in calling the client API and handle them.

Additional error handling added in the client, as to prevent
fatal crashes.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
uievent: retry on handler registration failure

The registration of a remote UI event handler may fail
if the server cooker is currently in some certain states.
This may happen, for example, when a remote UI is started
very fast after the bitbake server is started, and the
server hadn't time to finish initial configuration parsing.

Rather than fail outright, we have the remote UI event retry
registration for five time at one-second intervals,
in the hope it will succeed.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
toaster: read database settings from the environment

We add the capability to read the database settings for
Toaster from the environment. The DATABASE_URL is intepreted
and used to override the default settings.

This capability is essential for easy deployment of Toaster
in a managed hosted environment, and for creating
build environments with custom database settings.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
toaster: startup script noweb mode

We add an option to the startup script, named "noweb" that
will start toaster without the embedded web server.

This is useful to start the system for build-only environments,
where the web server code is running on a different machine.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
toaster: startup script standalone mode

The toaster starter script was designed to be sourced in
a build environment and set up the build recording environment
to be used in an interactive mode.

For the standalone web server mode, we modify the toaster
script to be run directly from the checked-out sources,
without a build environment set up, and run the web server
alone. In the standalone mode, the build environemnts and
all build activities are controled through the web interface.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
toaster: update toaster to run in managed mode

We disable bitbake self start to prevent race condition.

ToasterUI will shutdown the server when the build is done
if running in managed mode.

We fix usage of kill server flag in the bitbake binary.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
toaster: add project related models

We introduce the notion of a project in Toaster as the item
that holds the specification for triggering a build: the set
of layers used, the set of configuration variable values, and
the set of targets to be build.

Builds triggered through Toaster will be associated with a
Project, and they will be configured based on the project
settings at the moment when the build is ordered.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
toasterui: fix django settings environment value

Previously, the buildinfohelper only set a django settings module
environment variable if none were set.

This may lead to problems when the starting the toasterui
from an already existing Django environment.

As such, we always override the variable to provide the
correct name for the local Django settings module.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake: show wildcard appends for bitbake-layers

The 'bitbake-layers show-appends' command can use the built-in
get_file_appends() method which correctly identifies bbappends that
include a '%' wildcard in their filename.

Signed-off-by: Ash Charles <ashcharles@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
toaster: comment out bldcontrol migration command

This fixes toaster startup failing after the preparatory patches
for bldcontrol application have been merged.

I slipped a bldcontrol-specific line into the toaster startup
script and this prevents toaster from starting. We comment
out this line until the bldcontrol application have been merged.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
toaster: add Project class models to orm

This patch adds the Project class models to the
toaster GUI data model. There is no specified use,
and the link in the Build class is optional.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
cache.py: print debug info when EXCLUDE_FROM_WORLD

This gives us an easy way to find out which recipes have been excluded
from world when there are many layers.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>