]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/log
thirdparty/openembedded/openembedded-core-contrib.git
9 years agotaskdata.py: add RuntimeProviders to close matches
Robert Yang [Fri, 22 Jan 2016 08:53:16 +0000 (00:53 -0800)] 
taskdata.py: add RuntimeProviders to close matches

This is useful for newbie, for example:
$ bitbake rpm-build
ERROR: Nothing PROVIDES 'rpm-build'. Close matches:
  pm-utils
  rpm RPROVIDES rpm-build

[YOCTO #8881]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agodata_smart: Don't show exceptions for EOL literals
Richard Purdie [Thu, 21 Jan 2016 14:05:43 +0000 (14:05 +0000)] 
data_smart: Don't show exceptions for EOL literals

If variables are unset, the code simply doesn't expand them, there
aren't errors. If the code is a python expression, this can get a bit
messy, see the attached test case. The python expansion code sees the }
of the unexpanded value rather than the close of the python expression
and then raises a SyntaxError exception.

Ideally, we'd update the code to match pairs of brackets. I don't know
how to do that with the current regex and this is unfortunately a
performance sensitive piece of code. We also run the risk of breaking
existing code in OE-Core where there are "{" characters but not "}"
to close them (PKGE and PE).

Rather than raising the exception, matching the existing "just return
the expression" behaviour seems more consistent with the standard
variable behaviour.

This addresses an issue found in the recent image.bbclass code where
there are some variables we choose not to expand (TMPDIR/DATETIME).

This patch also adds a test case for this behaviour. It wouldn't preclude
improved bracket matching code in the future either.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotests/codeparser.py: Add filename/lineno flags to test variable
Olof Johansson [Tue, 19 Jan 2016 15:04:11 +0000 (16:04 +0100)] 
tests/codeparser.py: Add filename/lineno flags to test variable

A recent change in bitbake added filename/lineno information to the
parameters of bb.data.build_dependencies(). The codeparser tests
required a little adaption to the changes, adding the flags to the FOO
variable used in the tests.

The error seen when running the tests is a TypeError exception raised
in bb.codeparser:

  TypeError: int() argument must be a string or a number, not 'NoneType'

Signed-off-by: Olof Johansson <olof.johansson@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoaster: write variables to toaster.conf
Ed Bartosh [Tue, 19 Jan 2016 16:13:28 +0000 (16:13 +0000)] 
toaster: write variables to toaster.conf

With the resent change in rootfs creation code setVariable
rpc calls don't set variables for bitbake workers anymore.

Writen variables to toaster.conf should solve this issue.

[YOCTO #8910]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agoRevert "runqueue.py: Ensure one setscene function doesn't mask out another which...
Richard Purdie [Mon, 18 Jan 2016 18:05:21 +0000 (18:05 +0000)] 
Revert "runqueue.py: Ensure one setscene function doesn't mask out another which needs to run"

This reverts commit b22592af8145a8c7c4ada2fa7c1dee2e753eca46.

That commit isn't entirely clear about why this change is needed but
I do have a usecase where this breaks things. If for example you run
"bitbake X -c packagedata" and that packagedata is in sstate, you'd
expect this to work.

If sstate doesn't contain a do_populate_sysroot for a dependency, you
would still expect the command above to succeed and you would not
expect
it to rebuild that dependency. With the current code, this isn't what
happens. The code finds the sstate for do_populate_sysroot missing,
this makes the task "uncovered" and this in turn makes it unskippable.

The example I found with this was avahi-ui, where it would trigger
a build of libdaemon to obtain its populate_sysroot.

Since this behaviour seems completely incorrect, revert the older patch
and we'll address any issues that crop up as a result.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoastergui: make artifact download more robust
Elliot Smith [Mon, 18 Jan 2016 13:45:10 +0000 (15:45 +0200)] 
toastergui: make artifact download more robust

When an artifact download is requested, Toaster goes through a
convoluted series of conditions to decide which file to push
to the response. In the case of build artifact downloads for
command line builds, this caused an ugly exception, as command
line builds don't have a build request.

To simplify and catch more corner cases, remove the code which
fetches files via the build environment (we only support the local
build environment anyway). Then push all requests along a single
path, catching any missing file errors, missing object errors
or poorly-formed URLs in a single except clause which always returns
a valid response.

Also modify the text on the "unavailable artifact" page so it
says that the artifact doesn't exist, rather than it "no longer"
exists (exceptions may occur because an invalid artifact was
requested, rather than an artifact which was removed).

[YOCTO #7603]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoasterui: log OSErrorException metadata events
Elliot Smith [Mon, 18 Jan 2016 13:45:09 +0000 (15:45 +0200)] 
toasterui: log OSErrorException metadata events

OSErrors occurring in toaster.bbclass are converted to
OSErrorException metadata events. They were then being swallowed
as unprocessed events by toasterui, which made them difficult
to spot.

Explicitly catch OSErrorException events and log them so they
are easier to spot and debug.

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoasterui: listen for bb.event.MetadataEvent
Elliot Smith [Mon, 18 Jan 2016 13:45:08 +0000 (15:45 +0200)] 
toasterui: listen for bb.event.MetadataEvent

The event mask for toasterui doesn't include MetadataEvents.
This means that we're missing the ArtifactFileSize event
(among others), which is the one we use to populate the SDK
artifact table.

Add that event type to the toasterui event mask so we can
record SDK artifacts as they are created.

[YOCTO #7603]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoaster: increase timeout
Ed Bartosh [Fri, 15 Jan 2016 16:35:03 +0000 (16:35 +0000)] 
toaster: increase timeout

Sometimes Toaster connection to the bitbake server fails with
this error in the log:
   ERROR: Could not connect to server 0.0.0.0:46572
   : Could not register UI event handler
It happens more often on slow machines.

Increasing timeout after restarting bitbake should fix this issue.

[YOCTO #8776]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoastergui: code formatting and clean-up
Elliot Smith [Fri, 15 Jan 2016 11:01:06 +0000 (13:01 +0200)] 
toastergui: code formatting and clean-up

Minor fixes to code formatting and small improvements from
code review.

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoaster tests: fix Django tests for new ToasterTable pages
Elliot Smith [Fri, 15 Jan 2016 11:01:05 +0000 (13:01 +0200)] 
toaster tests: fix Django tests for new ToasterTable pages

The Django command-line tests can no longer test the content
of the projects/, builds/ and projectbuilds/ pages, as
ToasterTable pages are populated by JavaScript.

Fix/remove affected tests by converting them to tests on the
JSON returned by the ToasterTable.

[YOCTO #8738]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoastergui: remove unused views and template code
Elliot Smith [Fri, 15 Jan 2016 11:01:04 +0000 (13:01 +0200)] 
toastergui: remove unused views and template code

The code in views.py for setting up the template context for
old non-ToasterTable views is no longer necessary, as this
is now implemented in tables.py.

The template files for these views have also been removed.

[YOCTO #8738]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoastergui: fix error and warning counts for builds
Elliot Smith [Fri, 15 Jan 2016 11:01:03 +0000 (13:01 +0200)] 
toastergui: fix error and warning counts for builds

The error and warning counts displayed for builds were counts of
the errors and warnings objects associated with a build. Because these
values were being derived on the fly, it was not possible to sort by
them.

Previously, the 3rd party django-aggregate-if library was used to
add aggregate fields to Build objects and should then have been
used to populate the "all builds" and "project builds" tables. However,
at some point the templates had changed so that the error and warning
counts were coming from the properties on the Build model and not from
these aggregates. This meant that it was not possible to sort by these
fields.

Django 1.8 supports conditional aggregates in annotation fields on
querysets. This means we can remove django-aggregate-if, use the new Django
1.8 feature to derive errors_no and warnings_no fields as annotations,
then use those annotation fields in the templates. This makes the "builds"
tables sortable again.

[YOCTO #8738]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoastergui: make "Apply" button state depend on filter range
Elliot Smith [Fri, 15 Jan 2016 11:01:02 +0000 (13:01 +0200)] 
toastergui: make "Apply" button state depend on filter range

If a range filter action had an empty from/to field, the range
filter could still be applied. This was confusing, as an invalid
filter range caused all records to display, even though a filter
appeared to have been applied (by the highlighted state of
the filter button).

Change the state of the "Apply" button, disabling it if the radio
button for a range filter action is selected but the range is
incomplete (from or to field is empty).

When a non-range filter is selected, the "Apply" button always
enable the "Apply" button.

[YOCTO #8738]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoastergui: mute label for filter actions with no records
Elliot Smith [Fri, 15 Jan 2016 11:01:01 +0000 (13:01 +0200)] 
toastergui: mute label for filter actions with no records

The radio button for a filter action is disabled if that filter
action has no associated records. However, the label retains
the normal font styling, so it's unclear that the action is
not available.

Add the "muted" class to the label for a filter action (and still
disable its radio button) if it has no records associated with it.

[YOCTO #8738]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoastergui: set default visible and hideable columns
Elliot Smith [Fri, 15 Jan 2016 11:01:00 +0000 (13:01 +0200)] 
toastergui: set default visible and hideable columns

Incorrect columns were shown by default in the "all builds",
"project builds" and "all projects" pages.

Set the "hidden" property on columns in these tables to hide the
correct columns.

Add a set_column_hidden() method to ToasterTable so that the
"hidden" property can be overridden for the machines column
in the project builds page (it shares a superclass with
all builds).

Make the time column on all builds page hideable.

[YOCTO #8738]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoastergui: serialise decimals correctly
Elliot Smith [Fri, 15 Jan 2016 11:00:59 +0000 (13:00 +0200)] 
toastergui: serialise decimals correctly

The conversion of some ToasterTable Build object querysets to
JSON caused a serialisation error. This is because one of the
fields in the queryset was of type decimal.Decimal, and our
serialiser didn't know what to do with it.

Add a clause to check for decimal fields and serialise them
so that correct JSON can be generated.

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoastergui: streamline construction of filter objects
Elliot Smith [Fri, 15 Jan 2016 11:00:58 +0000 (13:00 +0200)] 
toastergui: streamline construction of filter objects

In line with comments from review, remove the QuerysetFilter
class (redundant) and convert ProjectFilters into a class
with static methods.

[YOCTO #8738]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoastergui: ensure filter_value updates
Elliot Smith [Fri, 15 Jan 2016 11:00:57 +0000 (13:00 +0200)] 
toastergui: ensure filter_value updates

Clicking on the radio button for a date range filter action
populates the from and to fields for that action if they are empty.

However, because this doesn't fire "change" events, clicking on
the radio button doesn't update the filter_value hidden field. This
means that the date range action's filter_value parameter isn't
set correctly when the filter popup is submitted.

Manually call the changeHandler() to set the filter_value whenever
the radio for a date range filter is clicked.

[YOCTO #8738]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoastergui: don't hide all elements with .col class
Elliot Smith [Fri, 15 Jan 2016 11:00:56 +0000 (13:00 +0200)] 
toastergui: don't hide all elements with .col class

Disabling the "project" column in a ToasterTable for builds
causes the recent builds area to be hidden. This is because
the column hiding code hides all elements with a class matching
".<column>", regardless of where they occur on the page; and
the recent builds area was using the ".project-name" class,
which means it is included in the set of elements which are hidden.

Scope the element search to the table so that only elements
within the table are hidden or shown.

[YOCTO #8792]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoastergui: convert project builds page to ToasterTable
Elliot Smith [Fri, 15 Jan 2016 11:00:55 +0000 (13:00 +0200)] 
toastergui: convert project builds page to ToasterTable

Use the all builds ToasterTable as the basis for the project builds
ToasterTable.

[YOCTO #8738]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoastergui: implement "today" and "yesterday" filters
Elliot Smith [Fri, 15 Jan 2016 11:00:54 +0000 (13:00 +0200)] 
toastergui: implement "today" and "yesterday" filters

Add the "today" and "yesterday" filters to the started_on
and completed_on columns in the builds table.

During this work, some minor adjustments were made to the
behaviour of the builds table:

* Amend filter action variable names so they're more succinct.
* Retain order in which actions are added to a filter, as this
ordering is used in the UI when displaying the filter actions.
* Always show the table chrome, otherwise it's not possible
to edit the columns shown until there are 10 or more results.
* Because date range searches may return no results, make sure
that the search bar and "show all results" link are visible
when the query returns no results.

[YOCTO #8738]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoastergui: implement date range filters for builds
Elliot Smith [Fri, 15 Jan 2016 11:00:53 +0000 (13:00 +0200)] 
toastergui: implement date range filters for builds

Implement the completed_on and started_on filtering for
builds.

Also separate the name of a filter ("filter" in the querystring)
from its value ("filter_value" in the querystring). This enables
filtering to be defined in the querystring more intuitively,
and also makes it easier to add other types of filter (e.g.
by day).

[YOCTO #8738]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoastergui: show recent builds on all builds page
Elliot Smith [Fri, 15 Jan 2016 11:00:52 +0000 (13:00 +0200)] 
toastergui: show recent builds on all builds page

The recent builds section was disabled while converting the
all builds page to ToasterTable.

Re-enable the recent builds area and add the data it requires
to the ToasterTable context.

[YOCTO #8738]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoastergui: switch off filter highlights when inactive
Elliot Smith [Fri, 15 Jan 2016 11:00:51 +0000 (13:00 +0200)] 
toastergui: switch off filter highlights when inactive

In ToasterTables with multiple columns which allow filtering
(e.g. all builds), selecting one filter, then a second filter
(e.g. selecting "failed builds" then "outcome" for all builds),
would result in both filters being highlighted at the same time.

Fix this by removing the "active" highlight on all column filter
buttons when a new filter value is submitted (via the filter modal).

NB to enable this, added a data-filter-on attribute to all
column filter buttons to make them easy to select.

[YOCTO #8738]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoastergui: refactor ToasterTable filtering
Elliot Smith [Fri, 15 Jan 2016 11:00:50 +0000 (13:00 +0200)] 
toastergui: refactor ToasterTable filtering

The filter code for ToasterTable was difficult to follow
and inflexible (not allowing different types of filter, for example).

Refactor to a set of filter classes to make the structure cleaner
and provide the flexibility needed for other filter types
(e.g. date range filter).

[YOCTO #8738]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoastergui: convert all builds page to ToasterTable
Elliot Smith [Fri, 15 Jan 2016 11:00:49 +0000 (13:00 +0200)] 
toastergui: convert all builds page to ToasterTable

For better long-term maintainability, use ToasterTable instead
of Django template and view code to display the all builds page.

NB the builds.html template has been left in, as this will
otherwise cause conflicts when merging the new theme.

[YOCTO #8738]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoastergui: use event delegates for hover help elements
Elliot Smith [Fri, 15 Jan 2016 11:00:48 +0000 (13:00 +0200)] 
toastergui: use event delegates for hover help elements

libtoaster.js binds to hover help elements via their hover() and
mouseout() methods. However, any elements added to the DOM after
libtoaster has initialised will not have these bindings added.
This causes a problem for ToasterTables which have hover-help
elements (e.g. the builds/ table).

Use the on() method instead. This uses event delegation to bind
a handler to any th or td elements already in the DOM, or
which will be added to the DOM in future. ToasterTables can
now reconstruct the table DOM and still have the correct handlers
attached once the table is done.

[YOCTO #8738]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoastergui: switch projects/ view to ToasterTable
Elliot Smith [Fri, 15 Jan 2016 11:00:47 +0000 (13:00 +0200)] 
toastergui: switch projects/ view to ToasterTable

Remove the old projects page and replace with the new
ToasterTable-based version.

NB although the projects.html template is no longer required,
it's been left in as there will be changes applied to it for
the new theme. These changes will have to then be transferred
from the projects.html template to projects-toastertable.html.

Similarly, the code for the projects page in views.py has been
retained.

[YOCTO #8738]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoaster: check inferred file suffixes against list of known types
Elliot Smith [Fri, 15 Jan 2016 11:00:46 +0000 (13:00 +0200)] 
toaster: check inferred file suffixes against list of known types

The algorithm for finding the suffix for image files produced by
the build doesn't reference a list of known file suffixes, so
could be prone to error.

Modify how file suffixes are parsed from the file path so that
they are compared against a list of known types; if this fails,
use the part of the basename of the file path after the first
'.' character.

Also rationalise the places in the views code where we
extract the file name extensions for builds, so they both use
the same algorithm (before, the same code was duplicated in
two places).

[YOCTO #8417]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoaster: move image file suffix list to model
Elliot Smith [Fri, 15 Jan 2016 11:00:45 +0000 (13:00 +0200)] 
toaster: move image file suffix list to model

Image file suffixes are used in the project configuration page to
show a list of available image file types. This list is stored
as a function in the views code.

However, this list is also needed when parsing image file paths,
so that the suffixes can be shown in the "all builds" and "project
builds" tables.

Move the list of valid image file suffixes to the Target_Image_File
class to make is accessible in other places where it may be needed.

[YOCTO #8738]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoastergui: use ToasterTable for projects page
Elliot Smith [Fri, 15 Jan 2016 11:00:44 +0000 (13:00 +0200)] 
toastergui: use ToasterTable for projects page

The projects page uses the old approach for showing tables,
which means a template for each table. This means that applying
changes to ToasterTable (which is used for most tables) has
no effect on the layout, styling and behaviour for these older
tables, and requires additional duplicated effort.

Move the projects page to use ToasterTable instead, to remove
the duplication of effort.

[YOCTO #8738]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agoRevert "fetch/git: Change to use clearer ssh url syntax for broken servers"
Richard Purdie [Fri, 15 Jan 2016 15:01:41 +0000 (15:01 +0000)] 
Revert "fetch/git: Change to use clearer ssh url syntax for broken servers"

This reverts commit 4193e99adce8e88f12ac88d7578ad39575f7e346.

It seems the underlying issue was caused by ":" in the url which isn't
supported. The patch was therefore incorrect.

9 years agoRevert "fetch2/local.py: avoid using PREMIRROR"
Richard Purdie [Mon, 11 Jan 2016 23:30:19 +0000 (23:30 +0000)] 
Revert "fetch2/local.py: avoid using PREMIRROR"

This reverts commit e130dca85bac82bd4d88f94a6bf9fe36e8ad4d7c.

This is in fact a valid use case, for example the sstate.bbclass code
sets up SSTATE_MIRRORS as PREMIRRORS. Its quite common to map those
file:// urls to remote http:// urls and with the above change, this
no longer works.

9 years agofetch2/git.py: Add missing "errno" module import.
Kristian Amlie [Mon, 11 Jan 2016 09:32:28 +0000 (10:32 +0100)] 
fetch2/git.py: Add missing "errno" module import.

This goes undetected most of the time, but when updating a repository,
if the ud.fullmirror file is not present, you end up getting an
exception instead of carrying on because the errno module is not
loaded (specifically "if exc.errno != errno.ENOENT").

Signed-off-by: Kristian Amlie <kristian.amlie@mender.io>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agobitbake: clean up stamp-base related codes
Chen Qi [Mon, 11 Jan 2016 10:27:26 +0000 (18:27 +0800)] 
bitbake: clean up stamp-base related codes

The 'stamp-base' and 'stamp-base-clean' related codes are no longer useful,
clean them up.

[YOCTO #8468]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agorunqueue: Fix setscene task dependencies
Richard Purdie [Sun, 10 Jan 2016 18:01:01 +0000 (18:01 +0000)] 
runqueue: Fix setscene task dependencies

Debugging suggests that setscene tasks are being a little greedy about their
dependencies, for example, lsof is insisting that gcc-runtime's do_package
is installed. If it isn't, its requiring gcc to rebuild.

If gcc-runtime do_package_write_xxx and do_packagedata is available, there
is no reason do_package should be needed.

The reason this is happening appears to be from the batching up of task
dependencies code, rather than setscene tasks stopping when passing over
a setscene task, they were being carried forward. This patch fixes it
so the data is 'zeroed' when passing over a setscene task boundary,
which gives the dependency graph that is expected.

After this patch, lsof will rebuild quite happily without
gcc-runtime:do_package being present, as expected. This should lead to
less dependencies being installed for builds from sstate and generally
better performance in general.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoaster: settings Add uid to the toaster cache dir
Michael Wood [Fri, 8 Jan 2016 11:26:19 +0000 (11:26 +0000)] 
toaster: settings Add uid to the toaster cache dir

Make the default toaster cache dir unique to the user running
toaster. If we have multiple users running toaster we previously
got a permission denied exception on saving a cache file.

[YOCTO #8782]

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoaster: show 'satisfied via' text for reverse deps
Ed Bartosh [Fri, 8 Jan 2016 11:17:22 +0000 (11:17 +0000)] 
toaster: show 'satisfied via' text for reverse deps

Showed '<dependency> satisfied via <provider>' text and
help tooltip for the reverse build dependencies provided
through 'PROVIDES' in the 'Reverse build dependencies' tab.

[YOCTO #6169]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoaster: show 'satisfied via' text for build deps
Ed Bartosh [Fri, 8 Jan 2016 11:17:21 +0000 (11:17 +0000)] 
toaster: show 'satisfied via' text for build deps

Showed '<dependency> satisfied via <provider>' text and
help tooltip for the build dependencies provided through
'PROVIDES' in the 'Build dependencies' tab.

[YOCTO #6169]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoaster: show list of provides for the recipe
Ed Bartosh [Fri, 8 Jan 2016 11:17:20 +0000 (11:17 +0000)] 
toaster: show list of provides for the recipe

Showed list of names that recipe provides.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agobuildinfohelper: add provides info to the db
Ed Bartosh [Fri, 8 Jan 2016 11:17:19 +0000 (11:17 +0000)] 
buildinfohelper: add provides info to the db

Added new entries to Provides model and link them to
Recipe_Dependency using 'via' field.

This data will be used by Toaster UI to show 'Provides:'
information for the recipes.

[YOCTO #6169]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotoaster: add Provider model
Ed Bartosh [Fri, 8 Jan 2016 11:17:18 +0000 (11:17 +0000)] 
toaster: add Provider model

Added new model Provider and a foreign key 'via' to link
Recipe_Dependency to it.

[YOCTO #6169]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agobuildinfohelper: use providermap
Ed Bartosh [Fri, 8 Jan 2016 11:17:17 +0000 (11:17 +0000)] 
buildinfohelper: use providermap

Used providermap in store_dependency_information function
to find virtual dependencies. This should fix annoying
warnings "stpd: KeyError saving recipe dependency"

[YOCTO #6169]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agocooker: add providermap to dep_tree
Ed Bartosh [Fri, 8 Jan 2016 11:17:16 +0000 (11:17 +0000)] 
cooker: add providermap to dep_tree

Added providermap information to the result of buildDependTree API.

This will be used by Toaster to map virtual dependencies to recipes.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agotaskdata: refactor get_providermap
Ed Bartosh [Fri, 8 Jan 2016 11:17:15 +0000 (11:17 +0000)] 
taskdata: refactor get_providermap

Added optional parameter 'prefix' to filter out names that
don't start with specified prefix. Changed existing call
of get_providermap according to changed API.

Optimized the code: got rid of extra loop and temporary
list variable virts.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agomain/runqueue: Add --setscene-only option to bitbake
Richard Purdie [Fri, 8 Jan 2016 18:25:55 +0000 (18:25 +0000)] 
main/runqueue: Add --setscene-only option to bitbake

Its turning out that we really need a way to have bitbake just run
the setscene tasks but not any real tasks, particularly for SDK
operations.

Add an option for this since its pretty straight forward. This allows
various nasty workarounds in OE-Core to be removed.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agofetch/git: Change to use clearer ssh url syntax for broken servers
Richard Purdie [Thu, 7 Jan 2016 13:18:52 +0000 (13:18 +0000)] 
fetch/git: Change to use clearer ssh url syntax for broken servers

Some servers, e.g. bitbucket.org can't cope with ssh:// as part of
the git url syntax. git itself is happy enough with this but you
get server side errors when using it.

This changes the git fetcher to use the more common ssh url format
which also means we need a : before the path.

Seems a shame to have to do this due to broken servers however
it should be safe enough since this other form is the one most people
use on the commandline so it should be safe enough.

[YOCTO #8864]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agoknotty: Use non-interactive mode as fallback for dumb terminals
Richard Purdie [Thu, 7 Jan 2016 13:18:20 +0000 (13:18 +0000)] 
knotty: Use non-interactive mode as fallback for dumb terminals

TERM=dumb bitbake X

shows no output for task status which is suboptimal. Use the non-interactive
mode if the terminal doesn't support what we need for interactive mode giving
a better user experience. Also print a note to the console to say this has
happened.

[YOCTO #8768]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agocooker: fix findFilesMatchingInDir documentation
Ross Burton [Fri, 18 Dec 2015 12:23:14 +0000 (12:23 +0000)] 
cooker: fix findFilesMatchingInDir documentation

The documentation for findFilesMatchingInDir() was inconsistant with the
implementation: the regex was escaped before searching so effectively it's a
pure textual substring, and the machine example was broken.

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agocooker: use in instead of count
Ross Burton [Wed, 9 Dec 2015 11:49:46 +0000 (11:49 +0000)] 
cooker: use in instead of count

No point counting all instances when we just want to know if there's any or not.

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agoast: Add filename/lineno to mapped functions
Richard Purdie [Tue, 5 Jan 2016 23:01:25 +0000 (23:01 +0000)] 
ast: Add filename/lineno to mapped functions

Where we add in mappings for EXPORT_FUNCTIONS, add dummy filename
and lineno data so ensure the assumption that all python functions
have this is correct.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agomain: kill server without queue setup
Ed Bartosh [Tue, 5 Jan 2016 13:45:38 +0000 (15:45 +0200)] 
main: kill server without queue setup

Setup of event queue includes registering of UI handler.
This operation can fail when cooker is busy. However, there is
no need in registering UI handler for terminating the server.

Moved the call of connection.terminateServer before setting up
of the event queue. This should make terminating server to work
more reliably as it doesn't depend on setting up the event queue
and registering UI handler anymore.

This should also help Toaster backend to restart bitbake server
and observer without getting "Could not register UI event handler"
errors.

[YOCTO #8776]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agoxmplrpc: split connect method
Ed Bartosh [Tue, 5 Jan 2016 13:45:37 +0000 (15:45 +0200)] 
xmplrpc: split connect method

Current code in connect method sets up event queue, which requires
registering UI handler. This functionality may not be needed for
some operations, e.g. for server termination.

Moved functionality of setting up event queue in from 'connect'
method to 'setupEventQueue' in BitBakeXMLRPCServerConnection class.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agouievent: refactor retry loop
Ed Bartosh [Mon, 4 Jan 2016 09:26:34 +0000 (11:26 +0200)] 
uievent: refactor retry loop

Replaced 'while' loop with 'for' loop.
Made the code more compact and hopefully more understandable.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agouievent: get rid of EventHandler attribute
Ed Bartosh [Thu, 31 Dec 2015 16:42:15 +0000 (18:42 +0200)] 
uievent: get rid of EventHandler attribute

This attribute was introduced by mistake. EventHandle is used in the
code for the same purpose.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agouievent: add error to registerEventHandler return
Ed Bartosh [Thu, 31 Dec 2015 16:42:14 +0000 (18:42 +0200)] 
uievent: add error to registerEventHandler return

Current code throws Exception("Could not register UI event handler")
if event handler can't be registered. The real reason of this is that
cooker is in busy state. Error message lacks information about this.

Added error message to the return value of registerEventHandler.
Included returned error message into the log message and exception
text.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agocooker: add state.get_name method
Ed Bartosh [Thu, 31 Dec 2015 16:42:13 +0000 (18:42 +0200)] 
cooker: add state.get_name method

Added method to convert state code into the human readable name.
It will be used in logging and error reporting.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agofetch2/__init__.py: Add support for 7-Zip
Juro Bystricky [Mon, 4 Jan 2016 18:51:43 +0000 (10:51 -0800)] 
fetch2/__init__.py: Add support for 7-Zip

7-Zip is a file archiver claiming the highest compression ratio.
This patch allows using 7-Zip commpressed files in bitbake recipes.
Two common formats are supported:

SRC_URI = "file://abc.tar.7z"
SRC_URI = "file://abc.7z"

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agoutils: Remove double compile from better_compile
Richard Purdie [Mon, 4 Jan 2016 17:34:02 +0000 (17:34 +0000)] 
utils: Remove double compile from better_compile

Poking around the ast to correct linenumbers works well for runtime failures
but not for parsing ones. We can use blank linefeeds to correct the line
numbers instead, with the advantage that we don't need to double compile.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agofetch2/local.py: avoid using PREMIRROR
Robert Yang [Mon, 4 Jan 2016 10:15:39 +0000 (02:15 -0800)] 
fetch2/local.py: avoid using PREMIRROR

The PREMIRROR isn't useful for "file://", so avoid using it, this is
good for searching speed and can reduce useless lines in log.do_fetch.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agosiggen: Change exception note into a warning
Richard Purdie [Mon, 4 Jan 2016 17:35:10 +0000 (17:35 +0000)] 
siggen: Change exception note into a warning

This makes no sense as just a note, its at least a warning and useful
to get an idea of which codepath is failing.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agodata: Drop misleading ExpansionError exception
Richard Purdie [Mon, 4 Jan 2016 17:33:26 +0000 (17:33 +0000)] 
data: Drop misleading ExpansionError exception

This codepath can be triggered by a python indentation error for example.
Showing it as an ExpansionError is misleading.

Change the code to add a warning about where the failure came from (in
particular giving the variable key name that triggered it) but raise the
proper exception.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agocooker: Drop useless parsing exception
Richard Purdie [Mon, 4 Jan 2016 17:32:45 +0000 (17:32 +0000)] 
cooker: Drop useless parsing exception

The SyntaxError exception simply shows the recipe that failed to parse
which is pretty useless without the actual exception. We could make it
print more info, however we can just use one of the more generic handlers
instead and remove this one.

For a python indentation error, this leads to a much more readable error
message.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agodata: Pass lineno/filename data from build_dependencies
Richard Purdie [Mon, 4 Jan 2016 17:31:58 +0000 (17:31 +0000)] 
data: Pass lineno/filename data from build_dependencies

If parse_python() fails, the output is confusing. Passing in the extra
file/line data isn't expensive and improves readability significantly.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 years agocodeparser: Add support for correct linenumbers
Richard Purdie [Mon, 4 Jan 2016 17:31:19 +0000 (17:31 +0000)] 
codeparser: Add support for correct linenumbers

Currently, if there is something like a python indentation error in a
python function, the linenumbers and even file aren't reported correctly.

This allows lineno and filename parameters to be passed in to correct this.

The lack of a lineno parameter to python's compile() function is worked
around by using empty linefeeds. Ugly, but effective and with minimal
performance overhead.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 years agoevent/utils/methodpool: Add a cache of compiled code objects
Richard Purdie [Sun, 20 Dec 2015 13:22:19 +0000 (13:22 +0000)] 
event/utils/methodpool: Add a cache of compiled code objects

With the addition of function line number handling, the overhead of
the compile functions is no longer negligible. We tend to compile
the same pieces of code over and over again so wrapping a cache around
this is beneficial and removes the overhead of line numbered functions.

Life cycle of a cache using a global like this is in theory problematic
although in reality unlikely to be an issue. It can be dealt with
if/as/when we deal with the other global caches.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 years agoBBHandler: Improve IN_PYTHON_EOF handling
Richard Purdie [Sun, 20 Dec 2015 13:21:14 +0000 (13:21 +0000)] 
BBHandler: Improve IN_PYTHON_EOF handling

Now we're actively using the line numbers for other thins, having
magic values like IN_PYTHON_EOF causes problems, in particular, 32
bit overflow on 32 bit machines.

There is a neater way to signal eof to feeder(), just using an extra
parameter so use this instead and drop the IN_PYTHON_EOF magic values.

This has the added bonus that line numbers are then correct for
python functions at the end of files.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 years agotoaster: remove 2 confusing parameters
Ed Bartosh [Thu, 17 Dec 2015 16:48:56 +0000 (16:48 +0000)] 
toaster: remove 2 confusing parameters

Removed nobrowser and brbe script parameters as both
are confusing and nobrowser is not used anywhere.

brbe parameter usage can only be justified if toaster
doesn't work properly and user has to manually connect
toaster to running bitbake server. Even in this scenario
it's very unlikely to achieve as toaster script is not
designed for this kind of usage.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 years agotoaster: move setting of default values
Ed Bartosh [Thu, 17 Dec 2015 16:48:55 +0000 (16:48 +0000)] 
toaster: move setting of default values

Set default values of script parameters just before
they are parsed to increase readability.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 years agotoaster: move startup checks to a better place
Ed Bartosh [Thu, 17 Dec 2015 16:48:54 +0000 (16:48 +0000)] 
toaster: move startup checks to a better place

Moved addr:port, bitbake.lock and toastermain.pid checks
to the place where the rest of Toaster starting happens.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 years agotoaster: remove 2 unused functions
Ed Bartosh [Thu, 17 Dec 2015 16:48:53 +0000 (16:48 +0000)] 
toaster: remove 2 unused functions

Removed check_pidbyfile and notify_chldexit functions from
toaster script as they're not called in the script.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 years agotoaster: remove addtoConfiguration function
Ed Bartosh [Thu, 17 Dec 2015 16:48:52 +0000 (16:48 +0000)] 
toaster: remove addtoConfiguration function

This function is useless as it's called just once
and makes code less readable.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 years agotoaster: updated header of the toaster script
Ed Bartosh [Thu, 17 Dec 2015 16:48:51 +0000 (16:48 +0000)] 
toaster: updated header of the toaster script

Updated GPL information, years of development and
usage information. Removed outdated information about
2 ways of starting Toaster.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 years agotoaster: add MANAGE variable
Ed Bartosh [Thu, 17 Dec 2015 16:48:50 +0000 (16:48 +0000)] 
toaster: add MANAGE variable

Used MANAGE variable to avoid repeating path to
manage.py in many places in toaster script.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 years agotoaster: remove unused variable
Ed Bartosh [Thu, 17 Dec 2015 16:48:49 +0000 (16:48 +0000)] 
toaster: remove unused variable

Removed unused variable RUNNING from the toaster script.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 years agotoaster: split long lines, add/remove whitespace
Ed Bartosh [Thu, 17 Dec 2015 16:48:48 +0000 (16:48 +0000)] 
toaster: split long lines, add/remove whitespace

Made toaster script more readable by splitting long lines and
removing and adding whitespace.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 years agotoaster: check if address:port is in use
Ed Bartosh [Thu, 17 Dec 2015 16:48:47 +0000 (16:48 +0000)] 
toaster: check if address:port is in use

Used new management command checksocket to check if
Toaster can listen on address:port.

[YOCTO #8775]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 years agotoaster: implement checksocket command
Ed Bartosh [Thu, 17 Dec 2015 16:48:46 +0000 (16:48 +0000)] 
toaster: implement checksocket command

Implemented new management command to check if it's
possible to listen on specified address:port.

[YOCTO #8775]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 years agoknotty: Improve exception error message
Richard Purdie [Fri, 18 Dec 2015 11:03:20 +0000 (11:03 +0000)] 
knotty: Improve exception error message

Instead of:
"""
can only concatenate tuple (not "int") to tuple
"""
we now see:

"""
Traceback (most recent call last):
  File "/media/build1/poky/bitbake/lib/bb/ui/knotty.py", line 324, in main
    termfilter.updateFooter()
  File "/media/build1/poky/bitbake/lib/bb/ui/knotty.py", line 210, in updateFooter
    lines = 1 + int(len(content) / (self.columns + 1))
TypeError: can only concatenate tuple (not "int") to tuple
"""

which makes tacking down and fixing the problem much easier.

Also ensure we set an error exit code.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 years agoknotty: Fix row/column function return value issue
Richard Purdie [Fri, 18 Dec 2015 11:02:41 +0000 (11:02 +0000)] 
knotty: Fix row/column function return value issue

When the row handling was introduced, one of the callbacks was
missed resulting in:

TypeError: can only concatenate tuple (not "int") to tuple

Fix it.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 years agobuildinfohelper: Update for buildstats layout change
Richard Purdie [Thu, 17 Dec 2015 14:54:55 +0000 (14:54 +0000)] 
buildinfohelper: Update for buildstats layout change

This updates buildinfo helper for the recent buildstats layout change

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 years agofetch: use orig localpath when calling orig method
Christopher Larson [Thu, 10 Dec 2015 18:57:23 +0000 (23:57 +0500)] 
fetch: use orig localpath when calling orig method

When a mirror tarball is fetched, the original fetch method is called, which
unpacks the mirror tarball. After the original method is called, it checks the
localpath of the mirror tarball rather than the clone path, which isn't ideal,
particularly if the mirror tarball was removed due to being out of date. We
know the original fetch method will do what it needs to do to get its content
in the form it needs from the mirror tarball, so we can use its localpath
instead.

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Awais Belal <awais_belal@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 years agoutils: Improve traceback from better_exec internal errors
Richard Purdie [Tue, 15 Dec 2015 17:42:40 +0000 (17:42 +0000)] 
utils: Improve traceback from better_exec internal errors

If you break the internals of better_exec(), you get a very weird
error about tb_next not being a method of None. Fix this by checking
we can step back a trace level.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 years agoast/event/utils: Improve tracebacks to include file and line numbers more correctly
Richard Purdie [Tue, 15 Dec 2015 17:41:12 +0000 (17:41 +0000)] 
ast/event/utils: Improve tracebacks to include file and line numbers more correctly

Currently bitbake tracebacks can have places where the line numbers are
inaccurate and filenames may be missing. These changes start to try and
correct this.

The only way I could find to correct line numbers was to compile as a
python ast, tweak the line numbers then compile to bytecode. I'm open
to better ways of doing this if anyone knows of any.

This does mean passing a few more parameters into functions, and putting
more data into the data store about functions (i.e. their filenames
and line numbers) but the improvement in debugging is more than worthwhile).

Before:
----------------
ERROR: Execution of event handler 'run_buildstats' failed
Traceback (most recent call last):
  File "run_buildstats(e)", line 43, in run_buildstats(e=<bb.build.TaskStarted object at 0x7f7b7c57a590>)
NameError: global name 'notexist' is not defined

ERROR: Build of do_patch failed
ERROR: Traceback (most recent call last):
  File "/media/build1/poky/bitbake/lib/bb/build.py", line 560, in exec_task
    return _exec_task(fn, task, d, quieterr)
  File "/media/build1/poky/bitbake/lib/bb/build.py", line 497, in _exec_task
    event.fire(TaskStarted(task, logfn, flags, localdata), localdata)
  File "/media/build1/poky/bitbake/lib/bb/event.py", line 170, in fire
    fire_class_handlers(event, d)
  File "/media/build1/poky/bitbake/lib/bb/event.py", line 109, in fire_class_handlers
    execute_handler(name, handler, event, d)
  File "/media/build1/poky/bitbake/lib/bb/event.py", line 81, in execute_handler
    ret = handler(event)
  File "run_buildstats(e)", line 43, in run_buildstats
NameError: global name 'notexist' is not defined

----------------

After:
----------------
ERROR: Execution of event handler 'run_buildstats' failed
Traceback (most recent call last):
  File "/media/build1/poky/meta/classes/buildstats.bbclass", line 143, in run_buildstats(e=<bb.build.TaskStarted object at 0x7efe89284e10>):
         if isinstance(e, bb.build.TaskStarted):
    >        trigger = notexist
             pn = d.getVar("PN", True)
NameError: global name 'notexist' is not defined

ERROR: Build of do_package failed
ERROR: Traceback (most recent call last):
  File "/media/build1/poky/bitbake/lib/bb/build.py", line 560, in exec_task
    return _exec_task(fn, task, d, quieterr)
  File "/media/build1/poky/bitbake/lib/bb/build.py", line 497, in _exec_task
    event.fire(TaskStarted(task, logfn, flags, localdata), localdata)
  File "/media/build1/poky/bitbake/lib/bb/event.py", line 170, in fire
    fire_class_handlers(event, d)
  File "/media/build1/poky/bitbake/lib/bb/event.py", line 109, in fire_class_handlers
    execute_handler(name, handler, event, d)
  File "/media/build1/poky/bitbake/lib/bb/event.py", line 81, in execute_handler
    ret = handler(event)
  File "/media/build1/poky/meta/classes/buildstats.bbclass", line 143, in run_buildstats
    trigger = notexist
NameError: global name 'notexist' is not defined
----------------

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 years agorunqueue: Add support for <task>- syntax
Richard Purdie [Tue, 15 Dec 2015 16:42:18 +0000 (16:42 +0000)] 
runqueue: Add support for <task>- syntax

It can be useful to run all tasks up to but not including a specific task. The
main reason this was never added was the lack of a good syntax. This patch
uses the syntax <taskname>- to denote this behaviour which is simple, not
invasive and fits what we need from good syntax IMO, hence we can add this.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 years agotoaster: tables Set a default order for the software recipes table
Belen Barros Pena [Mon, 14 Dec 2015 22:50:47 +0000 (22:50 +0000)] 
toaster: tables Set a default order for the software recipes table

Add default order by recipe name, so that the table content is sorted
when the page loads.

[YOCTO #8791]

Signed-off-by: Belen Barros Pena <belen.barros.pena@intel.com>
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 years agotoaster: tests Remove symlinks from toasteruitest folder
Mihail Stanciu [Fri, 11 Dec 2015 10:01:59 +0000 (10:01 +0000)] 
toaster: tests Remove symlinks from toasteruitest folder

Remove symlinks in the UI tests folder as they are causing
problems for bitbake upstream.

[YOCTO #8787]

Signed-off-by: Mihail Stanciu <stanciux.mihail@intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 years agotoaster: rework checking of Django version
Ed Bartosh [Thu, 10 Dec 2015 03:56:43 +0000 (19:56 -0800)] 
toaster: rework checking of Django version

Checked django version considering information from
toaster-requirements.txt, e.g. if requirements file contains
line "Django>1.8,<1.9" toaster should be able to check that
requirement correctly.

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>
10 years agotoaster: monkey patch Queryset
Ed Bartosh [Thu, 10 Dec 2015 03:56:42 +0000 (19:56 -0800)] 
toaster: monkey patch Queryset

Fixed 'database is locked' issue by monkey patching django QuerySet
methods.

The actual patching places were found by bisecting Django codebase.

This commit should be removed after Django is fixed if it's fixed
at all.

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>
10 years agotoaster: removed extra calls of migrate
Ed Bartosh [Thu, 10 Dec 2015 03:56:41 +0000 (19:56 -0800)] 
toaster: removed extra calls of migrate

One manage.py migrate should be enough to apply migrations for
all applications. Extra calls just slow toaster script down.

Removed calls of migrate for orm and bldcontrol apps.

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>
10 years agotoaster: work around 'database is locked' error
Ed Bartosh [Thu, 10 Dec 2015 03:56:40 +0000 (19:56 -0800)] 
toaster: work around 'database is locked' error

When sqlite can not cope with a stream of 'insert' queries it throws
'database is locked' exception.

Wrapping model.save in transaction.atomic context and repeating the call
should solve this issue.

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>
10 years agotoaster: fixed format strings
Ed Bartosh [Thu, 10 Dec 2015 03:56:39 +0000 (19:56 -0800)] 
toaster: fixed format strings

Printing id as a number breaks toaster if object is not saved
yet as id/pk is None in this case.

Changed format spec to print id as a string in __str__
and __unicode__ methods of Build, Task and LayerVersion models.

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>
10 years agotoaster: use OneToOneField instead of ForeignKey
Ed Bartosh [Thu, 10 Dec 2015 03:56:38 +0000 (19:56 -0800)] 
toaster: use OneToOneField instead of ForeignKey

Used OneToOneField to reference BuildRequest in BRBitbake model.

Fixed django warning:
WARNINGS: Setting unique=True on a ForeignKey has the same effect
          as using a OneToOneField.

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
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>
10 years agotoaster: Amend regex for MySQL database URLs
Elliot Smith [Thu, 10 Dec 2015 03:56:37 +0000 (19:56 -0800)] 
toaster: Amend regex for MySQL database URLs

The database URL detection doesn't admit a MySQL URL without a port.

As this is a common case (e.g. you would set the HOST to a mysql.sock
path if pointing at a local MySQL server, with no port setting),
amend the regex so it will correctly recognise paths, as well
as HOST:PORT URLs.

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 years agotoaster: Remove compatible_layerversions() method
Elliot Smith [Thu, 10 Dec 2015 03:56:36 +0000 (19:56 -0800)] 
toaster: Remove compatible_layerversions() method

Remove compatible_layerversions() and replace calls to it with
calls to get_all_compatible_layer_versions().

The sorting done in compatible_layerversions() is not relevant,
and the code can be simplified by using get_all_compatible_layer_versions().

[YOCTO #8364]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
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>
10 years agotoaster: Check Django version against toaster-requirements.txt
Elliot Smith [Thu, 10 Dec 2015 03:56:35 +0000 (19:56 -0800)] 
toaster: Check Django version against toaster-requirements.txt

Instead of hard-coding the required Django version in the start
script, look it up from the toaster-requirements.txt file.

[YOCTO #8364]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
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>
10 years agotoaster: Update deprecated manage.py command
Elliot Smith [Thu, 10 Dec 2015 03:56:34 +0000 (19:56 -0800)] 
toaster: Update deprecated manage.py command

syncdb is deprecated in favour of migrate in Django 1.7:
https://docs.djangoproject.com/en/1.8/releases/1.7/#schema-migrations

Update to the "migrate" command in Toaster's start script.

[YOCTO #8364]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
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>
10 years agotoaster: Prevent deprecation warnings for RedirectView
Elliot Smith [Thu, 10 Dec 2015 03:56:33 +0000 (19:56 -0800)] 
toaster: Prevent deprecation warnings for RedirectView

The API for RedirectView is due to change in Django 1.9, which
means that Toaster generates deprecation warnings.

Set the "permanent" flag when constructing RedirectView instances
to prevent this warning.

[YOCTO #8364]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
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>
10 years agotoaster: Update API used to make runbuilds methods run in transactions
Elliot Smith [Thu, 10 Dec 2015 03:56:32 +0000 (19:56 -0800)] 
toaster: Update API used to make runbuilds methods run in transactions

runbuilds previously had its methods decorated with
transaction.commit_on_success, which is now deprecated. transaction.atomic
is an (almost) drop-in replacement for this, so use this instead.

[YOCTO #8364]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
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>