Commit Graph

5311 Commits

Author SHA1 Message Date
David Reyna 35ce834167 bitbake: toaster: resolve missing 'native[sdk]:' prefixes
Some task events are missing the 'virtual:native[sdk]:' prefixes.
The Toaster has code to help match missing prefixes, but needs
additional help resolving between 'native:' and 'nativesdk:', by
way of the '_package' event field.

[YOCTO #10849]

(Bitbake rev: e455e40ba309837903b9e2d5f1dff55cce1135de)

Signed-off-by: David Reyna <David.Reyna@windriver.com>
Signed-off-by: brian avery <brian.avery@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-07 22:21:47 +00:00
Andre McCurdy c225f0fdb5 bitbake: fetch2: pass --no-same-owner when extracting tar files compressed with 7-Zip
Treat tar files compressed with 7-Zip in the same way as tar files
compressed with other compression formats.

(Bitbake rev: 363a0f54dc7d9930537f0df25173fa31ca1f98ac)

Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-04 23:18:46 +00:00
Andre McCurdy 0788007ccf bitbake: fetch2: remove last remaining usage of deprecated bb.data APIs
(Bitbake rev: 62dc3c3b40a95f9df31f5c917574c3822fb8bb64)

Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-04 23:18:46 +00:00
Andre McCurdy 8f1ed17587 bitbake: fetch2: add initial Amazon AWS S3 fetcher
Class for fetching files from Amazon S3 using the AWS Command Line
Interface. The aws tool must be correctly installed and configured
prior to use.

The class supports both download() and checkstatus(), which therefore
allows S3 mirrors to be used for SSTATE_MIRRORS.

(Bitbake rev: 6fe07ed25457dd7952b60f4b2153d56b15d5eea6)

Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-03 00:19:37 +00:00
Richard Purdie da6652b526 bitbake: fetch2: Allow whitespace only mirror entries
Forcing the use of "\n" in mirror variables is pointless, we can just require that
there are pairs of values.

(Bitbake rev: 044fb04dbe69313ee6908bf4d3cee7f797d0c41c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-03 00:19:37 +00:00
Scott Rifenbark 7abb5b7206 bitbake: bitbake-user-manual: Added "path_spec" parameter to SVN Fetcher
Fixes [YOCTO #10405]

The section on the SVN Fetcher was missing information on the
"path_spec" option.  I added this option and also updated the
examples at the bottom of the section to include that parameter.
Also, made the other two examples consistent.
I also removed the "date" parameter.

Also, updated the "protocol" parameter as well as the "modify"
parameter.  For "modify" I removed the reference to "rsh". I
applied a small wording change to the "protocol" parameter.

Finally, I added a new "ssh" parameter.

(Bitbake rev: 3ce6169afa646ef2b847e5fbabfe0191c93928b7)

Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-01 15:46:59 +00:00
Scott Rifenbark bcfb0da4fe bitbake: bitbake-user-manual: Rewrite dependency dot file generation
The package-depends.dot and pn-depends.dot files are inaccurate,
missing out key dependencies such those made via the [depends]
flags. As such they can be misleading to the user.

They mainly exist for historical reasons, coming from a time
before we had task based execution.

This commit removes the two dated file formats and replaces
them with a recipe-depends.dot which is a flattened version
of task-depends.dot.

The old format files are removed if present so that the user
can't get confused about why data might not match between files.

The code is also rewritten to use 'with f: f.write()' syntax as
is more commonly used now. Also update the docs to match the change.

(Bitbake rev: f82537d27f2a5bf9d576aa841593db9ec0985ea8)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-01 15:46:59 +00:00
Andre McCurdy b16192c938 bitbake: fetch2: don't use deprecated bb.data APIs
Cleanup some more usage of bb.data APIs in the fetchers.

(Bitbake rev: 9752fd1c10b8fcc819822fa6eabc2c1050fcc03b)

Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-01 11:16:07 +00:00
Richard Purdie b1c48fb646 bitbake: bitbake: Update version to 1.33.2
(Bitbake rev: f5ab65610d6d6c0587948b644292f57c07dece0c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-01 11:16:07 +00:00
Peter Kjellerstedt 3004f57a25 bitbake: lib/bb/utils: Add filter()
The bb.utils.filter() function can be used to filter a variable
containing whitespace separated words based on another set of words.
It has been modeled after the bb.utils.contains_any() function.

A typical example of how it can be used is to simplify constructs for
PACKAGECONFIG that depend on DISTRO_FEATURES:

-PACKAGECONFIG ?= "\
-    ${@bb.utils.contains('DISTRO_FEATURES', 'acl', 'acl', '', d)} \
-    ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)} \
-"
+PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'acl selinux', d)}"

(Bitbake rev: 03ae490366d2046f5b5c185fe4ec2adf1b0a902e)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-01 11:16:07 +00:00
Alexander Kanavin 8dd99c15af bitbake: wget.py: match .lz tarballs as well when determining latest version
(Bitbake rev: c55e09fbd2b64a2b909d9992350b6b2e26e5e86d)

Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-01 11:16:07 +00:00
Mike Crowe 7b75bf8505 bitbake: process: stop bb.process.communicate mixing bytes and str return types
Python3 regards b"" as False so it is not being converted to a string by
d0f904d407f57998419bd9c305ce53e5eaa36b24. This confusingly causes three
different potential types for each member of the returned tuple.

Let's just assume that everything that's not None is a bytes object and
convert it to a string.

(Bitbake rev: 0cf5589b7fb3582a6caca5014c4d8152347df545)

Signed-off-by: Mike Crowe <mac@mcrowe.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-01 11:16:07 +00:00
Anders Darander 3242826304 bitbake: lib/bb/fetch2: rewrite / to - in package names
Most angular2 packages have names of the form @angular/xxx.
The / obviously can't be used in a file name, replace it with -.

(Bitbake rev: d3bd41d0ec9621307c362b394872b18b8b7ed8d6)

Signed-off-by: Anders Darander <anders@chargestorm.se>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-01 11:16:07 +00:00
Anders Darander 4b70f27173 bitbake: fetch2/__init__: handle @ in package names
A number of npm packages use @ as a leading chararacter.
Examples are most of the angular2 packages.

(Bitbake rev: 628c4bf6c89b3d62c9b864380b5c8e131a899bff)

Signed-off-by: Anders Darander <anders@chargestorm.se>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-01 11:16:07 +00:00
Markus Lehtonen 3c83b56309 bitbake: fetch2/svn: change 'rsh' parameter to 'ssh'
The functionality around the 'rsh' parameter seemed to be broken. The
'rsh' parameter was only used when 'protocol' was set to 'svn+ssh' which
is confusing. The 'rsh' parameter was used for setting the value of
'svn_RSH' environment variable, which however, is not supported by svn
(not at least according to SVN documentation).

This patch removes the 'rsh' parameter and replaces it with 'ssh'. This
new (optional) parameter is used when svn+ssh protocol is used and it
can be used to specify the ssh program used by svn. This is achieved by
setting the SVN_SSH environment variable which is mentioned in SVN
documentation.

(Bitbake rev: 5b364b02270b0d7c2b7ca8d67fa2731bf93720ee)

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-23 12:50:17 -08:00
Richard Purdie ff734f0560 bitbake: runqueue: Fix collapsed setscene dependency tree
When we removed the postinst sstate dependency handling code from
setscene_depvalid, we noticed things being installed into the old
style sysroot for rootfs tasks which should not have been there,
causing a performance regression.

Analysis revealed that setscene dependencies were "bubbling" over
sstate tasks when they should have been stopping there. The
'continue' added by this patch avoids this issue and eusures
sstate tasks remain contained to their specific chains.

There was another bug in the code this exposed where the acconting
for tasks as they were removed from sq_revdeps was not correct. In
fixing this, what looks like a workaround in another test can then
be simplified.

After this change, populate_sysroot tasks are no longer depending
on package_write_rpm tasks for example, which would make no sense.

A before/after analysis of image dependencies only revealed improved
dependencies after this change.

Recipe specific sysroots did highlight the issue here since the
behaviour of the sysroot dependencies (and processing with depvalid)
was not matching what bitbake itself was doing, with bitbake being
incorrect. Failures were 'safe' in that too many dependencies would
get installed.

(Bitbake rev: 5ef2cb50041fa7106c8de170af73d2a54cb0b1f0)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-19 06:28:47 -08:00
Aníbal Limón 10968b4266 bitbake: bitbake-layers: Handle exception raised bytinfoil.prepare()
The tinfoil.prepare method can raise Exceptions when is parsing initial
 data so add this call inside try, finally to avoid get blocked for
don't call tinfoil.shutdown().

The tinfoil_init function was remove because isn't make sense now since
 tinfoil.prepare() needs to be inside try, finally closures.

Example of raised exception and gets blocked:

$ bitbake-layers add-layer ~/repos/meta-openembedded/meta-python/

Traceback (most recent call last):
  File "/home/alimon/repos/poky/bitbake/bin/bitbake-layers", line 83, in
main
    tinfoil.prepare(True)
...
  File "/home/alimon/repos/poky/bitbake/lib/bb/tinfoil.py", line 268, in
run_command
    raise TinfoilCommandFailed(result[1])
bb.tinfoil.TinfoilCommandFailed: Traceback (most recent call last):
  File "/home/alimon/repos/poky/bitbake/lib/bb/command.py", line 81, in
runCommand
    result = command_method(self, commandline)
...
  File "/home/alimon/repos/poky/bitbake/lib/bb/cooker.py", line 1314, in
handleCollections
    raise CollectionError("Errors during parsing layer configuration")
bb.cooker.CollectionError: Errors during parsing layer configuration

(Bitbake rev: 61ebe9a026652e32f9482f66fc3fe7a8672fc093)

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-19 06:28:47 -08:00
Paul Eggleton 157d9d92a0 bitbake: tinfoil: ensure PATH includes bitbake's bin directory
The runqueue expects to be able to run 'bitbake-worker' from PATH, but
for example in the OE extensible SDK, tinfoil is used within devtool
where this isn't the case (we're not exposing bitbake to the user, thus
bitbake's bin directory isn't in PATH).

This fixes devtool modify usage within the extensible SDK which has
apparently been broken since the tinfoil2 changes went in.

Fixes [YOCTO #11034].

(Bitbake rev: 52d87e4a58a52174e8e0b6297abaac8fd93ffcc3)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-19 06:28:47 -08:00
Khem Raj b14e61d1bd bitbake: fetch2: Add NFS Stale file exception handling
- In some cases the file descriptor
  is held by nfs client and none of os.path.* is catching
  that, it could mean that error is not doled out because
  client has cached the stat info. In this case we are
  out of luck. Needed to catch IOError, which would be
  causing the Stale error.

- In download method, update_stamp is invoked
  md5sum validation which is found to be throwing
  Stale errors.
- Added error handling to fix the stale errors.

(Bitbake rev: 5a53e7d7b017769a6eb0f0a6335735a1fe51a5ec)

Signed-off-by: Balaji Punnuru <balaji_punnuru@cable.comcast.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-19 06:28:47 -08:00
Robert P. J. Day 6c611d697f bitbake: fetch2: Rename "setup_revisons" to "setup_revisions"
For spelling's sake, rename Python routine "setup_revisons" to
"setup_revisions."

(Bitbake rev: 4df59b027c02ef39d72476251ccd3fd62fc20bf6)

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-19 06:28:47 -08:00
Robert P. J. Day 1bd4f040a3 bitbake: fetch2: Correct two examples of typo "revsion."
(Bitbake rev: 05f5421b2e44cd58c5912848de43d5884d070150)

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-19 06:28:46 -08:00
Andre McCurdy 7ab8b6558c bitbake: cooker: detect malformed BBMASK expressions which begin with a separator
When constructing an older style single regex, it's possible for BBMASK
to end up beginning with '|', which matches and masks _everything_.

(Bitbake rev: 56ad67017e601c7e0f6085ca84e29c28d8d4519f)

Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-19 06:28:46 -08:00
Richard Purdie 6cfc1c83b9 bitbake: cooker: Rewrite dependency dot file generation
The package-depends.dot and pn-depends.dot files are inaccurate, missing
out key dependencies such those made via the [depends] flags. As such
they can be misleading to the user.

They mainly exist for historical reasons, coming from a time before
we had task based execution.

This commit removes the two dated file formats and replaces them with
a recipe-depends.dot which is a flattened version of task-depends.dot.

The old format files are removed if present so that the user can't get
confused about why data might not match between files.

The code is also rewritten to use 'with f: f.write()' syntax as is more
commonly used now.

Also update the docs to match the change.

(Bitbake rev: d3e182bc18ff2894f1efc8aad3d508dd432c996e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-19 06:28:46 -08:00
Richard Purdie 701ae7d1f4 bitbake: doc: Replace depexp UI with taskexp and cleanup UI lists
The depexp UI has been replaced with taskexp, also remove old
references to goggle and hob.

(Bitbake rev: 814c2b232ea5f88b5ad5031fb9d389c9c594aa01)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-19 06:28:46 -08:00
Richard Purdie 6a531c8b33 bitbake: ui: Replace depexp with taskexp
The data displayed by the depexp UI is buggy, bitbake can't convey
accurate runtime dependency information.

Convert the UI to become taskexp ("Task Explorer") which provides
a graphical way of exploring the task-depends.dot file. This data
is accurate and being able to visualise the data is an often requested
feature as standard dot file viewers can't usualy cope.

(Bitbake rev: 416a496edc692982af2feec768ac4df8fb799853)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-19 06:28:46 -08:00
Juro Bystricky e98757e267 bitbake: cooker.py: run sanity checks for multiconfig
Also run sanity check for all additional multiconfig configurations
as listed in BBMULTICONFIG, not just the "default" configuration.

[YOCTO#10810]

(Bitbake rev: b9777374cbe63cdcf80767033f628c26d23e90f9)

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-15 20:08:15 -08:00
Sujith H d4b5a70831 bitbake: bitbake: toaster: add wic.bmap support to toaster
Add wic.bmap file extension support for toaster

(Bitbake rev: 6a3f6f1b5cc9ec69b28bebf70daed7579c60cd9e)

Signed-off-by: Sujith H <sujith.h@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-15 20:08:15 -08:00
brian avery 9bc41e1e8d bitbake: toaster: remove cut and paste cruft
There was a superfluous section in toaster start/stop script that was
setting the TOASTER_DIR and had a set of comments around that setting.
This was done in two places and only the last one was effective. This
patch removes the spurious section to make it clearer what was
happening and what TOASTER_DIR was actually getting set to.

(Bitbake rev: e551e73a094f5a1937bce78de9e41908bf3e07c3)

Signed-off-by: brian avery <brian.avery@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-15 20:08:15 -08:00
brian avery f43d97af94 bitbake: toaster: move sqlite database to TOASTER_DIR
The toaster.sqlite database was located in TOASTER_DIR/build.  This
meant that if you named your build directory something else (like cow),
Toaster would fail to make/find the database.  TOASTER_DIR is on the
whitelist unlike BUILDDIR and we need to be able to write there anyway
given our current layout so this should not disrupt anything.

[YOCTO #9992]

(Bitbake rev: 2c48168a86309c0cf2be793e7409a78ba21fca14)

Signed-off-by: brian avery <brian.avery@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-15 20:08:15 -08:00
brian avery 3b7ab16bf8 bitbake: toaster: remove cut and paste cruft
There was a superfluous section in toaster start/stop script that was
setting the TOASTER_DIR and had a set of comments around that setting.
This was done in two places and only the last one was effective. This
patch removes the spurious section to make it clearer what was
happening and what TOASTER_DIR was actually getting set to.

(Bitbake rev: 1f0eac0a172a4fbe1799675f2c3ce989743bd862)

Signed-off-by: brian avery <brian.avery@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-15 20:08:15 -08:00
Richard Purdie f0d5eb39c3 bitbake: lib: Drop now unneeded update_data calls
Now that the datastore works dynamically we don't need the update_data calls
so we can just remove them. They're not actually done anything at all for
a while.

(Bitbake rev: 2300beb50333bb620013b058a7309e7f2042101d)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-15 20:08:15 -08:00
Richard Purdie 9f12295626 bitbake: bitbake: Update version to 1.33.1
(Bitbake rev: 95deecabfffdb6a7009ecc385c8b12290fbfcb73)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-07 14:36:01 +00:00
Paul Eggleton 8e61d6d8b7 bitbake: fetch2/npm: fix handling of os field
When I originally added this check I didn't quite understand how the
values in this field should be expressed - it seems from reading the
documentation if there is an entry starting with '!' then the list is
a blacklist and we shouldn't expect "linux" to be in the list, or we'll
end up skipping important dependencies.

This fixes fetching the "statsd" npm package.

Fixes [YOCTO #10760].

(Bitbake rev: 7aa6d1586417e0e7d9925917a82caee5884957db)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-07 14:36:01 +00:00
Paul Eggleton eed25ff021 bitbake: fetch2/npm: handle items only in optionalDependencies
An npm package.json file has two dependency fields: dependencies and
optionalDependencies. An item in optionalDependencies *may* also be
listed in dependencies, but this is not required (and not necessary
since if it's in optionalDependencies it will be optional, adding it to
dependencies won't do anything). The code here was assuming that an
optional dependency would always be in both, that's probably because
that was true of the examples I was looking at at the time. To fix it,
just add the optional ones to the list we're iterating over.

(Bitbake rev: c0c50d43266150a80be31ae2c6fcaf37f5ba231d)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-07 14:36:01 +00:00
Paul Eggleton d01b4bd15b bitbake: lib/bb/build: add tasksbetween() function
Add a utility function that gives the list of dependent tasks between
two specified tasks (just within the same recipe). This is intended to
be able to be executed from recipe context so it uses the datastore
rather than having access to the runqueue.

This will be used in OpenEmbedded-Core's populate_sdk_ext.bbclass to
get the list of tasks between do_image_complete and do_build.

(Bitbake rev: 433379bf12cf31fdf46defdf66695cf8be9994b1)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-07 14:36:01 +00:00
Richard Purdie 6f14790163 bitbake: bitbake: Bump version to 1.33.0 (develoment version)
(Bitbake rev: 2a309cd20cddf3d2258bd00ad06b26452e6cc043)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-27 10:41:09 +00:00
Patrick Ohly 478644aedf bitbake: build.py: avoid exception when function is not defined
exc_func() fails with a hard to debug exception when the
function does not exist, for example due to a typo:

  ERROR: ...: Traceback (most recent call last):
    File "/work/bitbake/lib/bb/build.py", line 644, in exec_task
      return _exec_task(fn, task, d, quieterr)
    File "/work/bitbake/lib/bb/build.py", line 584, in _exec_task
      exec_func(func, localdata)
    File "/work/bitbake/lib/bb/build.py", line 198, in exec_func
      cleandirs = flags.get('cleandirs')
  AttributeError: 'NoneType' object has no attribute 'get'

There is code further down which will print a warning, but we don't
reach that unless we allow None as result of of d.getVarFlags() first.

The warning is further down intentionally and has to stay there, to
ensure that 'cleandirs' gets executed also for empty functions.

(Bitbake rev: 25df3db5eeda9dbf417e67e96845f376e5c8e6b3)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-26 10:44:28 +00:00
Scott Rifenbark a0cc88dc66 bitbake: bitbake-user-manual: Fixed small typo in "Events" section
There was a stra quote character after the word database
and I removed it.

(Bitbake rev: 50afcab054b2d93be96bfd3c224affebcab023cc)

Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-23 23:30:15 +00:00
Scott Rifenbark 000d2708b2 bitbake: bitbake-user-manual: Updated Event descriptions
Fixes [YOCTO #10886]

Added text descriptions for many of the events in the list of the
"Events" section.

(Bitbake rev: e3b7e8430cb207756b59b32128aa3cef6a626fa1)

Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-23 23:30:14 +00:00
Aníbal Limón 8a3221e6e5 bitbake: lib/bb/main.py: Shutdown cooker when server isn't foreground
The cooker is added to the BBServer and then detached creating
a copy of the cooker in the process, if the server isn't in
foreground it cause fd leaks on inotify this can be see using
many instances of tinfoil.

Example:

from bb.tinfoil import Tinfoil
while True:
    with Tinfoil() as tinfoil:
        input("Pre\n")
        tinfoil.prepare(config_only=True)
        input("Post\n")

[YOCTO #10873]

(Bitbake rev: 2ada2efb057a291eb34c66d975eb339232137956)

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-23 22:38:49 +00:00
Aníbal Limón 509d26f95b bitbake: bb/server/process.py: ProcessEventQueue add close of _writer pipe
Call explicity close in _writer to avoid fd leakage because isn't
called on Queue.close()

[YOCTO #10873]

(Bitbake rev: 12dfac442d2d5674198485fbeb708a01d215c576)

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-23 22:38:49 +00:00
Matthew McClintock a5a51304d1 bitbake: bitbake-layers: show-appends: add optional argument to limit package list
Add ability to limit output per package:

$ bitbake-layers show-appends m4
=== Matched appended recipes ===
m4_1.4.17.bb:
  /home/mattsm/git/openembedded-core/meta-selftest/recipes-test/m4/m4_1.4.17.bbappend

Useful for writing tools to process the output, and debugging
bbappends for specific packages

(Bitbake rev: 43668657a8a679acc957e26e6fd8f47ab4cb3da8)

Signed-off-by: Matthew McClintock <msm-oss@mcclintock.net>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-23 22:38:49 +00:00
Richard Purdie 45df694a9f bitbake: data_smart: Fix unneeded variable manipulation
If was pointed out that if we have:

XXX = " A"
XXX_remove_inactive-override = "YY"

then XXX can become "A" and the leading space can be removed. This is because
the remove override code changes the variable value even when there is no
removals active. In the process it dirties the cache.

We don't really need to do this so tweak the code accordingly.

(Bitbake rev: 2bc4d35fb32defc59cd6ed1fc87e35924c201a5c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-22 09:05:39 +00:00
Patrick Ohly bf0ea57e4a bitbake: runqueue.py: revised completion scheduler
The idea is that tasks which complete building a recipe (like
do_package_qa) are more important than tasks which start building new
recipes (do_fetch) or those which increase disk usage
(do_compile). Therefore tasks get ordered like this (most important
first, do_rm_work before do_build because the enhanced rm_work.bbclass
was used):

1. ID /work/poky/meta/recipes-support/popt/popt_1.16.bb:do_build
2. ID /work/poky/meta/recipes-core/readline/readline_6.3.bb:do_build
3. ID /work/poky/meta/recipes-connectivity/libnss-mdns/libnss-mdns_0.10.bb:do_build
...
464. ID /work/poky/meta/recipes-sato/images/core-image-sato.bb:do_build
465. ID /work/poky/meta/recipes-graphics/xorg-proto/inputproto_2.3.2.bb:do_rm_work
466. ID /work/poky/meta/recipes-devtools/python/python3_3.5.2.bb:do_rm_work
467. ID /work/poky/meta/recipes-core/packagegroups/packagegroup-base.bb:do_rm_work
...
3620. ID virtual:native:/work/poky/meta/recipes-extended/pbzip2/pbzip2_1.1.13.bb:do_install
3621. ID /work/poky/meta/recipes-devtools/qemu/qemu-helper-native_1.0.bb:do_install
3622. ID /work/poky/meta/recipes-core/zlib/zlib_1.2.8.bb:do_compile_ptest_base
3623. ID /work/poky/meta/recipes-extended/bzip2/bzip2_1.0.6.bb:do_compile_ptest_base
...
3645. ID /work/poky/meta/recipes-support/libevent/libevent_2.0.22.bb:do_compile_ptest_base
3646. ID /work/poky/meta/recipes-core/busybox/busybox_1.24.1.bb:do_compile_ptest_base
3647. ID /work/poky/meta/recipes-kernel/linux/linux-yocto_4.8.bb:do_uboot_mkimage
3648. ID /work/poky/meta/recipes-kernel/linux/linux-yocto_4.8.bb:do_sizecheck
3649. ID /work/poky/meta/recipes-kernel/linux/linux-yocto_4.8.bb:do_strip
3650. ID /work/poky/meta/recipes-kernel/linux/linux-yocto_4.8.bb:do_compile_kernelmodules
3651. ID /work/poky/meta/recipes-kernel/linux/linux-yocto_4.8.bb:do_shared_workdir
3652. ID /work/poky/meta/recipes-kernel/linux/linux-yocto_4.8.bb:do_kernel_link_images
3653. ID /work/poky/meta/recipes-devtools/quilt/quilt-native_0.64.bb:do_compile
3654. ID /work/poky/meta/recipes-extended/texinfo-dummy-native/texinfo-dummy-native.bb:do_compile
...

The order of the same task between different recipes is the same as
with the speed scheduler, i.e. more important recipes come first.

(Bitbake rev: 70e297e5c285ce0a02e9efd3117ff62cdc77ec12)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-20 11:52:52 +00:00
Patrick Ohly 633697cce6 bitbake: build.py: add preceedtask() API
The API is required by the revised rm_work.bbclass implementation,
which needs to know all tasks that do_build depends so that it
can properly inject itself between do_build and those tasks.

The new API primarily hides the internal implementation of the "after"
and "before" dependency tracking. Because tasks defined as
precondition via "recrdeptask" may or may not be relevant (they are for
rm_work.bclass), the API also includes support for that.

There's no default value for including recrdeptasks, so developers
have to think about what they need.

(Bitbake rev: 9289ab40e77906e983a2f79cd7602ee95be5025a)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-20 11:52:52 +00:00
Richard Purdie 3f8d56d113 bitbake: fetch2: Avoid recursive errors
If PATH contains WORKDIR which contains PV which contains SRCPV we can end
up in circular recursion within the fetcher. This code change allows for the recursion
to be broken by giving PV a temporary dummy value in a data store copy.

(Bitbake rev: ce1e70b8018340b54dba3a81d7d379182cb77514)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-20 11:52:52 +00:00
Richard Purdie 51abd41ff6 bitbake: cooker: Add BB_LIMITEDDEPS support
When we're running with bitbake -b, BB_TASKDEPDATA is incorrect and limited.
We really need a way to know this from the metadata and this new variable
provides this in worker context. This means existing code can stop having
to guess.

(Bitbake rev: 05763bc886024dcce2ce6b3060fb00abf79a9402)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-20 11:52:52 +00:00
Richard Purdie 631229df72 bitbake: event/ast: Add RecipeTaskPreProcess event before task finalisation
There are various pieces of code which need to run after the tasks are
finalised but before bitbake locks in on the task dependencies. This
adds such an event so dependency changes in anonymous python can
be accounted for and acted upon by these specific event handlers.

(Bitbake rev: 4dcd0e53f5ff4bf4f2d6cbdc51ff33a5f5f206af)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-20 11:52:52 +00:00
Richard Purdie d8b2257f57 bitbake: runqueue: Fix traceback when using -b
Without this, bitbake -b of image recipes cause tracebacks since
the list of providers is empty.

(Bitbake rev: c53e43f3c6a675c0934a7a4e358fd66b049ffca3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-20 11:52:52 +00:00
Richard Purdie 918736d6c9 bitbake: cooker: Only add universe targets where the task exists
Currently "bitbake universe -c fetch" will error if every task in the system
doesn't have a fetch task. This seems unreasonable so filter the list based
upon whether the task exists. This implementation does assume if a task exits
for a given provider name, it can run, even if the preferred provider that
ends up getting built might be the namespace without the task. This is unlikely
to be a real world issue at this point.

(Bitbake rev: 438986f4e39974930ee3205ca4c4d620090e57bb)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-20 11:52:52 +00:00
Juro Bystricky 7d18d05d45 bitbake: cooker.py: new multiconfig '*' syntax support
Currently you cannot build a target for all the configured multiconfigs without
specifying a list. The list can be quite long, requiring to type several lines
of text.

This enhancement is to support globbing so that you can do this,
e.g. instead of:

    $ bitbake multiconfig:A:bash multiconfig:B:bash bash

you can do:

    $ bitbake multiconfig:*:bash

There are real world use cases where it is desirable to use multiconfig with
two different tasks. For example:  SDKs with multiple toolchains but also
containing set of additional host tools, or multiconfig builds requiring one image for
the  main CPU(s) and a different co-image for a companion CPU.
For this reason, two variations of the new syntax are supported.

For example, the following:

    $ bitbake multiconfig:*:meta-toolhchain

would expand to:

    $ bitbake multiconfig:A:meta-toolchain multiconfig:B:meta-toolchain meta-toolchain

However the following:

    $ bitbake multiconfig:*:meta-toolhchain hosttools

would expand to:

    $ bitbake multiconfig:A:meta-toolchain multiconfig:B:meta-toolchain hosttools

In other words, if the user specified the "default" task explicitly, it replaces the implicit
"default" task.

[YOCTO#10680]

(Bitbake rev: 1559ad1fc3ae8b1e4e75b210f598b90be192571b)

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-19 20:20:16 +00:00
brian avery 63f899a950 bitbake: toaster: bin/toaster whitelist TOASTER_DIR
Some of the tinfoil2 changes resulted in TOASTER_DIR being cleared by
the memory resident bitbake server toaster starts up.  This prevented
toaster from being able to connect to its sqlite database. Adding
TOASTER_DIR to the BB_ENV_EXTRAWHITE list stops the cooker from clearing
out the TOASTER_DIR variable.

[YOCTO #9252]

(Bitbake rev: 2420953b3d03551d8254609300ca572717aecdcd)

Signed-off-by: brian avery <brian.avery@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-17 13:18:47 +00:00
Ola Redell d937b5f5e7 bitbake: gitsm.py: Add force flag to git checkout command in update_submodules
When the gitsm fetcher is used with a repo that includes a .gitattributes
file that makes git modify files on cloning (e.g. line break characters),
the subsequent checkout performed in the update_submodules function fails.
This is fixed by adding the force flag (-f) to the checkout command.

(Bitbake rev: c05e1396625b14e66d795408ea2ae4cd2afc3209)

Signed-off-by: Ola Redell <ola.redell@retotech.se>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-17 11:29:29 +00:00
Jianxun Zhang 7eb02e837e bitbake: use multiple processes to dump signatures.
This change significantly shortens the time on reparsing stage
of '-S' option.

Each file is reparsed and then dumped within a dedicated
process. The maximum number of the running processes is not
greater than the value of BB_NUMBER_PARSE_THREADS if it is set.

The dump_sigs() in class SignatureGeneratorBasic is _replaced_
by a new dump_sigfn() interface, so calls from the outside and
subclasses are dispatched to the implementation in the base
class of SignatureGeneratorBasic.

Fixes [YOCTO #10352]

(Bitbake rev: 99d3703edd77a21770b366c6ad65a3c0f5183493)

Signed-off-by: Jianxun Zhang <jianxun.zhang@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-17 11:29:28 +00:00
Richard Purdie 840e221ea7 bitbake: event: Replace slightly elderly bbmake references!
bbmake hasn't existed for a while (a decade+) so we should
probably remove the references.

(Bitbake rev: 4170cf874850b950f31d2e36c895c110c0b096c3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-09 13:39:13 +00:00
Richard Purdie 6f6f51783a bitbake: prserv/persist_data/utils: Drop obsolete python2 imports
These imports were from python 2.6 and earlier, 2.4 in some cases.
Drop them since we're all python3 now.

(Bitbake rev: 7ef12684e8647b006bf46cae695069d4bfece1cf)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-09 13:39:13 +00:00
Aníbal Limón e016eb10b0 bitbake: bb/cooker: BBCooker stops notifier at shutdown
At end of  BBCooker needs to release fd's associated with pyinotify
watchers to  avoid: Too many open files (EMFILE) error in different
scenarios like several instances of tinfoil.

[YOCTO #10873]

(Bitbake rev: ae6045b84978940c365c95c33d6996359c3e299d)

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-06 00:01:07 +00:00
Richard Purdie 9f6a1043f6 bitbake: prserv/serv: Tweak stdout manipulation to be stream safe
We've been seeing oe-selftest failures under puzzling circumstances. It
turns out if you run oe-selftest on a machine with xmlrunner installed
and have the recent tinfoil2 changes, the launching of PR server crashes
leading to selftest hanging if using an autoloaded PR server.

The reason is that xmlrunner uses an io.StringIO object as stdout/stderr
instead of the usual io.TextIOWrapper and StringIO lacks a fileno() method.

We have to deal with both cases and in the python way, we try and then seek
forgivness if we see an AttributeError or UnSupportedOperation exception.
Unfortunately we have to deal with both cases as we may be performing a
traditiional double fork() from the commandline, or a larger python program.

[YOCTO #10866]

(Bitbake rev: 26243f04e3af652291d13e85c084057104fe155b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-05 13:54:07 +00:00
Richard Purdie dbb247cac5 bitbake: cookerdata: Convert multiconfig to use BB_CURRENT_MC
People are struggling with multiconfig as the point the conf file
is injected into the data store is not what people expect. We can't
really use a post config since that is too late and we can't really
use a pre config file since that is too early. In OE terms, we need
something right around the local.conf point so it behaves in a similar
way.

A way to handle this is to set the new variable BB_CURRENT_MC to be the
currently selected multiconfig, then the metadata itself can choose
when to inject the approriate configuration.

(Bitbake rev: 518b9015c2be8d3894277a8e54890d6f04d656c0)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-22 12:36:40 +00:00
Richard Purdie 4fc02c5eaa bitbake: runqueue: Only start fakeroot workers when needed
Fakeroot workers usually have dependencies that need to be ready before they
can be started. Starting them as a block therefore doesn't work as the
dependencies may or may not have been built. Therefore start the multiconfig
fakeworkers individually upon demand.

[YOCTO #10344]

(Bitbake rev: ab15486c636e451ed5a62e561980946887901c3b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-22 12:36:40 +00:00
Richard Purdie fe11d18ffd bitbake: runqueue: Ensure setscene tasks with overlapping stamps don't parallel execute
In multiconfig, mutliple tasks can execute which share the same stamp file. These
must not execute in parallel, the idea is the first should execute, the subsequent
ones should see a valid stamp and get skipped.

The normal task execution code has stamps code to handle this, this adds similar
code to the setscene execute() function to handle the issue there too.

(Bitbake rev: 937acf267fa9e45f538695b2cf8aa83232a96240)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-22 12:36:40 +00:00
Richard Purdie f048db1c64 bitbake: runqueue: Fix setscene issues with multiconfig
setscene was being entirelu skipped for multiconfig variants as the tasks
were simply not being spotted. If the default config was also being built
it masked the problem. When this was fixed by using taskfn instead of fn
in lookups against dataCache, several other instances of this problem were
highlighted.

This goes through and corrects the setscene code to correclty use taskfn
instead of fn in the appropriate places meaning setscene tasks for multiconfig
now work correctly.

(Bitbake rev: cead85cf219c07b40aeb7c0d948c25f0429136db)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-22 12:36:40 +00:00
Richard Purdie d6799e655e bitbake: siggen: Fix clean_basepath to work with multiconfig
Tasknames can now start with "multiconfig:" which broke the virtual: comparison code and
lead to unpredictable checksums with nativesdk recipes. This adds in handling for
the new additional prefix which unbreaks nativesdk builds when using multiconfig.

(Bitbake rev: 4da296c0c93391ec37f8b6e2245071657759771e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-22 12:36:40 +00:00
Richard Purdie d156f2ce33 bitbake: build/uihelper: Show better information about multiconfig tasks on UI
Currently the UI shows X is building, possibly multiple times but doesn't
say which of the multilibs that might be. This adds a prefix to the task
name so the mulitconfig being built can be identified.

(Bitbake rev: d93ddd185dde53f50aea06ada094bb0d9b5ba4f0)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-22 12:36:40 +00:00
Richard Purdie 5d620b7f90 bitbake: runqueue: Ensure pseudo executes from the correct place (use the right datastore with multiconfig)
The location of the fakeroot command and the various environmental values need
to be taken from the right multiconfig datastore, not the shared one. This
patch ensures the right one is used for cases like a split TMPDIR.

[YOCTO #10344]

(Bitbake rev: 813a7600bc26b7132ac36d1515571d321f566afb)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-22 12:36:40 +00:00
Mark Asselstine d41d2fdd56 bitbake: fetch2/wget: fixup case with no useful netrc data
Commit 873e33d0479e977520106b65d149ff1799195bf6 [fetch2/wget:
add Basic Auth from netrc to checkstatus()] causes "Fetcher failure
for URL: 'https://www.example.com/'. URL https://www.example.com/
doesn't work." on new builds when a user has a .netrc file but there
is no default and no matching host. The call to netrc.authenticators()
will return None in these cases and the attempted assignment to the
3-tuple will raise a TypeError exception. Add the TypeError to the
exceptions caught to get around this issue.

(Bitbake rev: c0c0af40ebddaf9dc99353c580a65d4c04295613)

Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-21 08:17:01 +00:00
Matthew McClintock aa15ff631c bitbake: fetch2/wget: add Basic Auth from netrc to checkstatus()
fetch2/wget uses urllib to check the status of the mirrors, wget will
use netrc to pass login and password information however checkstatus
will skip that.

This adds netrc login and password to checkstatus so both will work the
same.

(Bitbake rev: 873e33d0479e977520106b65d149ff1799195bf6)

Signed-off-by: Matthew McClintock <msm-oss@mcclintock.net>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-20 15:22:51 +00:00
Paul Eggleton fe7e75075e bitbake: runqueue: dry-run real tasks when BB_SETSCENE_ENFORCE is set
For the purposes BB_SETSCENE_ENFORCE is designed for (in OE, it is used
by the installation process for the extensible SDK), we don't actually
need the whitelisted real tasks to execute - we just need to have them
in the dependency tree so that we get all of the setscene tasks they
depend on to run. Therefore we can actually dry-run those real tasks
i.e. they won't be run (and thus we won't waste a significant amount of
time doing so) and won't be stamped as having run either. We do already
have a dry-run mode in BitBake (activated by the -n or --dry-run command
line option), but it dry-runs the setscene tasks as well which we don't
want here.

Note that this has no effect on the checking we are doing with
BB_SETSCENE_ENFORCE to ensure that only whitelisted real tasks are
scheduled to run - that's handled separately.

Fixes [YOCTO #10369].

(Bitbake rev: 58f084291beb3a87d8d9fdb36dfe7eff911fa36b)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-20 15:22:50 +00:00
Ross Burton 573c646d4c bitbake: BBHandler: use with instead of open/close
This is more pythonic and can handle unclosed file warnings better
than the previous code structure.

(Bitbake rev: 50633012a64a3b5f0662145e29ff426374fb7683)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-16 10:23:24 +00:00
Richard Purdie 2c4e366721 bitbake: cooker/command: Drop expanded_data
Some of our metadata assumes that BuildStarted and BuildCompleted events
see the same data store. This is the case for buildTarget but not for
buildFile and recent changes mean this is now a problem.

The update_data() call is now an empty operation and there is no difference
between the expanded_data and data so we can simply remove the expanded_data
and its references and use data everywhere. This has been inteded for a while
but the above issue makes this more pressing to finally clean up.

(Bitbake rev: e3694e738e98f26f413ada6860ca7d829d3662f0)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-16 10:23:24 +00:00
Joshua Lock 97f83e911e bitbake: bitbake: remove True option to getVar calls (take 2)
getVar() now defaults to expanding by default, thus remove the True
option from getVar() calls with a regex search and replace.

Search made with the following regex: getVar ?\(( ?[^,()]*), True\)

(a follow on patch to fix up a few recent introductions)

(Bitbake rev: f9961fd5beb31d5ab9656a5be59f7ab3effef2f0)

Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-16 10:23:24 +00:00
Paul Eggleton c61b525e91 bitbake: lib/bb/build: enable access to logger within tasks
In certain circumstances it can be useful to get access to BitBake's
logger within a task; the main example is in OpenEmbedded's image
construction code where we want to be able to check the log file for
errors and warnings, but we don't want to see any errors or warnings
that were emitted through the logger; so we need a way to exclude those.
In order to do this, pass the logger object into the task via a
BB_TASK_LOGGER variable, and add a logging handler class to bb.utils
that can be added to it in order to keep a list of warnings/errors that
have been emitted.

(Bitbake rev: f1cd6fab604f14d8686b1d783cbfe012d923ee42)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14 12:25:07 +00:00
Paul Eggleton 6688f6a115 bitbake: server/process: don't change UI process signal handler on terminate
On terminating the connection to the server, we were disabling SIGINT -
and this is executed on the UI side. I'm not sure whether the intention
here was to undo the SIGINT disabling we did in the server, and it was
just a mistake that it disabled rather than restored and it's run on the
wrong side, or whether we wanted to stop the user from breaking out of
the shutdown code - the commit message provides no clues either way.
Regardless, we do not want to permanently disable Ctrl+C here - it's
legitimate to terminate the connection to the server and then
re-establish it within the same process; at least currently, devtool
modify by virtue of using tinfoil in two separate parts of the code does
this, and the result of this disabling is that during the second tinfoil
usage we can potentially be parsing all recipes without the ability to
easily interrupt the process.

(Bitbake rev: 58c60a951229dcbd8253863fb24228d046c23f6e)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14 12:25:07 +00:00
Paul Eggleton d856bce542 bitbake: siggen: add means of ignoring basehash mismatch
If you run the setVariable command to set variables then you end up
causing the basehash to not match the previously computed values, which
triggers error messages. These mismatches are expected, so add a means
of disabling them.

(Bitbake rev: 5a80c0e210f26526afbe8f266b7b1a9c03334967)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14 12:25:07 +00:00
Paul Eggleton 8d315820aa bitbake: runqueue: enable setVariable command to affect task execution
Allow the client to set variables with the setVariable command and have
those changes take effect when running tasks. This is accomplished by
collecting changes made by setVariable separately and pass these to the
worker so it can be applied on top of the datastore it creates.

(Bitbake rev: 69a3cd790da35c3898a8f50c284ad1a4677682a4)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14 12:25:07 +00:00
Paul Eggleton 7229250411 bitbake: data_smart: support serialisation
The COW object used within VariableHistory can't be serialised itself,
but we can convert it to a dict when serializing and then back when
deserialising. This finally allows DataSmart objects to be serialized.
NOTE: "serialisation" here means pickling, not over XMLRPC or any other
transport.

(Bitbake rev: bbbb2a53d5decf3b613a92c4ff77c84bfc5d4903)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14 12:25:07 +00:00
Paul Eggleton 797a8ee040 bitbake: cooker: allow buildFile warning to be hidden programmatically
If we want to use this function/command internally, we don't want this
warning shown.

(Bitbake rev: 5cfbb60833e7b12d698c1c2970c17ccf2a4971bf)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14 12:25:07 +00:00
Paul Eggleton 8f8a9ef669 bitbake: tinfoil: pass datastore to server when expanding python references
If you're expanding a value that refers to the value of a variable in
python code, we need to ensure that the datastore that gets used to get
the value of that variable is the client-side datastore and not just the
part of it that's on the server side. For example, suppose you are in
client code doing the following:

d.setVar('HELLO', 'there')
result = d.expand('${@d.getVar("HELLO", True)}')

result should be "there" but if the client part wasn't taken into
account, it would be whatever value HELLO had in the server portion of
the datastore (if any).

(Bitbake rev: cbc22a0a9aadc8606b927dbac0f1407ec2736b35)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14 12:25:07 +00:00
Paul Eggleton f1f3a112a0 bitbake: tinfoil: implement server-side recipe parsing
It's not really practical for us to parse recipes on the client side, we
need to do it on the server because that's where we have the full python
environment (including any "pure" python functions defined in classes).
Thus, add some functions to tinfoil do this including a few shortcut
functions.

(Bitbake rev: 8f635815d191c9d848a92d51fdbf5e9fd3da1727)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14 12:25:07 +00:00
Paul Eggleton 8c33063a1d bitbake: remotedata: enable transporting datastore from the client to the server
For the purposes of server-side parsing and expansion allowing for
client-side use of the datastore, we need a means of sending a datastore
from the client back to the server, where the datastore probably
consists of a remote (server-side) original plus some client-side
modifications. To do this we need to take care of a couple of things:

1) xmlrpc can't handle nested dicts, so if you enable memres and simply
   try passing a serialised datastore then things break. Instead of
   serialising the entire datastore, just take the naive option of
   transferring the internal dict alone (as a list of tuples) for now.

2) Change the TinfoilDataStoreConnector object into simply the handle
   (number) when transmitting; it gets substituted with the real
   datastore when the server receives it.

(Bitbake rev: 784d2f1a024efe632fc9049ce5b78692d419d938)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14 12:25:07 +00:00
Paul Eggleton 7d5c9860de bitbake: tinfoil: rewrite as a wrapper around the UI
Rewrite tinfoil as a wrapper around the UI, instead of the earlier
approach of starting up just enough of cooker to do what we want. This
has several advantages:

* It now works when bitbake is memory-resident instead of failing with
  "ERROR: Only one copy of bitbake should be run against a build
  directory".

* We can now connect an actual UI, thus you get things like the recipe
  parsing / cache loading progress bar and parse error handling for free

* We can now handle events generated by the server if we wish to do so

* We can potentially extend this to do more stuff, e.g. actually running
  build operations - this needs to be made more practical before we can
  use it though (since you effectively have to become the UI yourself
  for this at the moment.)

The downside is that tinfoil no longer has direct access to cooker, the
global datastore, or the cache. To mitigate this I have extended
data_smart to provide remote access capability for the datastore, and
created "fake" cooker and cooker.recipecache / cooker.collection adapter
objects in order to avoid breaking too many tinfoil-using scripts that
might be out there (we've never officially documented tinfoil or
BitBake's internal code, but we can still make accommodations where
practical). I've at least gone far enough to support all of the
utilities that use tinfoil in OE-Core with some changes, but I know
there are scripts such as Chris Larson's "bb" out there that do make
other calls into BitBake code that I'm not currently providing access to
through the adapters.

Part of the fix for [YOCTO #5470].

(Bitbake rev: 3bbf8d611c859f74d563778115677a04f5c4ab43)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14 12:25:07 +00:00
Paul Eggleton e271d7dc60 bitbake: command: provide a means to shut down from the client in memres mode
In memory resident mode we don't really want to actually shut down since
it's only the client going away.

(Bitbake rev: 74db369c46043116359101cab70486afd82372c0)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14 12:25:07 +00:00
Paul Eggleton d325d94f3f bitbake: data_smart: implement remote datastore functionality
This allows you to maintain a local reference to a remote datastore. The
actual implementation of the remote connection is delegated to a
connector object that the caller must define and supply. There is
support for getting variable values and expanding python references
(i.e. ${@...} remotely, however setting variables remotely is not
supported - any variable setting is done locally as if the datastore
were a copy (which it kind of is).

Loosely based on an earlier prototype implementation by Qing He.

(Bitbake rev: a3edc3eefa2d03c4ad5d12187b32fa4dc495082a)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14 12:25:07 +00:00
Paul Eggleton 727f332829 bitbake: server/xmlrpc: send back 503 response with correct encoding
If you send back a string here you get "TypeError: 'str' does not
support the buffer interface" errors in bitbake-cookerdaemon.log and
"IncompleteRead(0 bytes read, 22 more expected)" errors on the client
side.

(Bitbake rev: 0d659a7dfe5fb096f8aa4380320f9e2a464b3cb5)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14 12:25:07 +00:00
Paul Eggleton 7ebca83926 bitbake: knotty: fix --observe-only option
If we're in observe-only mode then we cannot run commands that would
affect the server's state, including getSetVariable, so prevent that
from being called in observe-only mode.

(Bitbake rev: 2c5a8661430edebff67ab4a108995033d182b5d6)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14 12:25:06 +00:00
Paul Eggleton 568409faa1 bitbake: knotty: make quiet option a level option
Allow you to specify -q / --quiet more than once to reduce the messages
even further. It will now operate as follows:

 Level  Option  Result
 -----  ------  ----------------------------------------
 0              Print usual output
 1      -q      Only show progress and warnings or above
 2      -qq     Only show warnings or above
 3+     -qqq    Only show errors

(Bitbake rev: 6cf2582e17c28ca04f5cfb59858c4a9778c700d4)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14 12:25:06 +00:00
Paul Eggleton 3fa98e19d5 bitbake: data_smart: fix resetting of reference on variablehistory
There is no "datasmart" member, only dataroot. This dates back to the
original implementation of variable history support - it's surprising we
haven't noticed the issue until now, but I guess it's rare to change a
copy of a datastore in a manner which using the old reference would
cause an issue.

(Bitbake rev: febd5534b07edfdef15cedb0578730c582c7373f)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14 12:25:06 +00:00
Michael Wood 1453920365 bitbake: toaster: views Remove old code that converts template context to JSON
Remove the template context to JSON decorator function as this is
deprecated by having a proper REST API.

(Bitbake rev: b65a8193368ffa1d15af24a6acde8dce6bd4d383)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-12 20:44:54 +00:00
Michael Wood 92a9141208 bitbake: toaster: js test Update js tests to use correct url for layer REST
Update js tests so that we use the new Layer REST API.

(Bitbake rev: 81764ce3ebf0d2fcb3dc6965f6f07931d39e5524)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-12 20:44:54 +00:00
Michael Wood 6f3d33c293 bitbake: toaster: Switch front end to use Layer get REST API
Switch the front end to use the proper REST API for retrieving layer
information.

(Bitbake rev: 5ea25c49091f4d4b5007af948e063ed25ba5766f)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-12 20:44:54 +00:00
Michael Wood ccb36cc549 bitbake: toaster: typeaheads Layers add url to layer REST API to the layer
Add the url to the Layer typeahead so that this can be used later on by
the front end code to look up layer details.

(Bitbake rev: d195f24a1b30ae8698bff5e87308347b9596a2e2)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-12 20:44:54 +00:00
Michael Wood de0295e5bb bitbake: toaster: api Add GET REST API for Layer information
Add a get API for returning information about layers.

(Bitbake rev: 3fa5170c98c699d2a7a8380b696fc599efcc5dee)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-12 20:44:54 +00:00
Michael Wood 23ad2a8ca0 bitbake: toaster: importlayer Add git revision typeahead to that input field
Add the front end mechanism to load the typeahead for the git revision
field on importing a layer.
Also fix one indentation issue and update the js test.

(Bitbake rev: 28114be42174095b812a93d4b5a0e01e953d74f8)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-12 20:44:54 +00:00
Michael Wood 97ff2c0091 bitbake: toaster: typeaheads Add a git revisions suggestions
When we're importing a layer it's useful to suggest available git revisions of the
layers. This uses git ls-remote to fetch the revisions and then filter on this.
Caching is added for this typeahead to avoid having to fetch this
information multiple times in a single session.

[YOCTO #8429]

(Bitbake rev: a94ae3ad0cb07a52004143c6f86f371b9e330e9f)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-12 20:44:54 +00:00
Michael Wood 4ecd040f3b bitbake: toaster: typeaheads widgets Fix flake8 issues and remove redundant code
Fix flake8 issues and remove redundant __init__ function definitions
from typeaheads (likely a copy and paste error).

(Bitbake rev: be1f9f48da480d813e3364815cb3e002ba70dd22)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-12 20:44:54 +00:00
Michael Wood 8eed264163 bitbake: toaster: tests Update import layer test to use new Layer add api
(Bitbake rev: d4c79cd60c12d329c533add73e88b7184dca6ca3)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-12 20:44:53 +00:00
Michael Wood f2b0d43c2f bitbake: toaster: importlayer Use new layer add API
Switch the importlayer.js to use the new REST API for importing a new layer.

(Bitbake rev: 6475fd7e0d2488bf300b75322f2c00297cd1440b)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-12 20:44:53 +00:00
Michael Wood 7e80e501fb bitbake: toaster: api Add layer Add api
Add layer adding REST api and remove old views method.

(Bitbake rev: 0c8e41d2217fd568a84e857d1be230fcfd4bb5c7)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-12 20:44:53 +00:00
Michael Wood 90d995c637 bitbake: toaster: models Layer_Version get_detailspage_url optional project_id
Allow passing none as the project id, this is convenient for layers
which belong to projects already and therefore have their own project
field.

Add documentation string to function

(Bitbake rev: 78dc7b9f1801e7f4c266ba1369e5706f177ddaa1)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-12 20:44:53 +00:00
Michael Wood 9dbcc0fbb3 bitbake: toaster: models Layer fix whitespace
(Bitbake rev: 8116cb4f71de09eff124cd48d80cc7a7c64da5e1)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-12 20:44:53 +00:00
Michael Wood bb9cf5f0f7 bitbake: toaster: tablejs Add visual indicator for table data loading
Add a visual indicator when the data is changing in the table, for instance if
it's being re-ordered, searched or paginated.

[YOCTO #10104]

(Bitbake rev: 554c4992b33b77526b4b37c7484f1dd00032ddef)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-12 20:44:53 +00:00
Scott Rifenbark 88ccf25e37 bitbake: bitbake-user-manual: Added new "Line Joining" section.
Fixes [YOCTO #10444]

Added a new section about syntax called "Line Joining".  The
section describes how you can use the backslash character (\)
to joing stuff.

(Bitbake rev: a2768ecae7846d72a1bdb7cbbc5e8d242af854f6)

Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-08 16:36:02 +00:00
Scott Rifenbark 9403e82f67 bitbake: bitbake-user-manual: Refreshed the 'bitbake --help' output.
(Bitbake rev: d7121d919beaa4be2c18d8f0bbd4afe01590eb7b)

Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-08 16:36:02 +00:00
Richard Purdie 931ce04b08 bitbake: toaster: Reference pip3 not pip
Now that we use python3, we should refer to pip3, not pip.

[YOCTO #10774]

(Bitbake rev: 99136f5f591deef0c96d9aea2dbea1c216f38121)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-08 15:52:08 +00:00
Richard Purdie e10da7d9df bitbake: cooker: Handle inofity queue overflows more gracefully
If many files change and the inotify queue overflows, rather than print
a traceback, invalidate the caches and warn the user.

[YOCTO #10676]

(Bitbake rev: 058f8517c041b80e8b591ad7d34a68281b2d03fc)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-08 10:32:21 +00:00
Richard Purdie 9977576fe9 bitbake: cooker: Fix world taskgraph generation issue
The processing of the "do_" prefix to tasks is currently inconsistent
and has resulted in "bitbake world -g" being broken as task prefixes
don't get handled correctly.

Make the "do_" task prefix handling consistent through various codepaths.

[YOCTO #10651]

(Bitbake rev: 3d7186353e804c9410096c408bc337a98c8b33fe)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-08 10:32:21 +00:00
Richard Purdie 9d1d35068e bitbake: utils: Avoid traceback errors
Avoid errors like:

ERROR: Exception handler error: 'NoneType' object has no attribute 'decode'

(Bitbake rev: 1aeb45abe56061f044c2347889c191d5256ff21f)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-08 10:32:21 +00:00
Richard Purdie ad11076737 bitbake: runqueue: Send BB_TASKDEPDATA for setscene tasks
We now have code in OE that needs BB_TASKDEPDATA for setscene tasks. Therefore
generate and send this data. In this case its a "pre collapsed" tree
but that is fine for the use cases in question.

(Bitbake rev: 38b857d086af43af6ea3aa60d3876a2c9b225401)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-08 10:32:21 +00:00
Richard Purdie c77e7021d7 bitbake: runqueue: Add the taskhash to BB_TASKDEPDATA
Its useful to know the task hash in code using TASKDEPDATA so add this
data to the data structure. The recipe specific sysroots in OE
need this data.

(Bitbake rev: 758867e8dc74283bb1f031e158ec54cefdd5c2a6)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-08 10:32:21 +00:00
Richard Purdie 24b668efa0 bitbake: bitbake-worker: Further IO performance tweaks
Looking further at the CPU loads on systems running large numbers of tasks,
the following things helps performance:

* Loop on waitpid until there are no processes still waiting
* Using select to wait for the cooker pipe to be writable before writing
  avoiding pointless 100% cpu usage
* Only reading from worker pipes that select highlights are readable

(Bitbake rev: 9375349e27b08b4d1cfe4825c042d4c82120e00b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-08 10:32:21 +00:00
Daniel Lublin 5c1ad6852e bitbake: lib/bs4: Fix imports from html5lib >= 0.9999999/1.0b8
As of html5lib 0.9999999/1.0b8 (released on July 14, 2016), some modules
have moved from _base to base. Handle this, while staying compatible
with earlier versions.

(Bitbake rev: 1679188f9c55c615cae780f2b5e6852dea9cf2ec)

Signed-off-by: Daniel Lublin <daniel@lublin.se>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-07 10:43:20 +00:00
Sujith H 1b4fa3f095 bitbake: cooker: convert type which needs to be marshalled
We assume that the value taken by variable v can be string,
integer or any type which can be marshalled by xmlrpc. This
change would help us to convert the non marshallable types
to string. So that we don't get exception from xmlrpc.

[YOCTO #10740]

(Bitbake rev: efb0e47479b3526bc047112f7200087c5844bba4)

Signed-off-by: Sujith H <sujith.h@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-07 10:42:22 +00:00
brian avery da22be9904 bitbake: toaster: browser tests - add Selenium Docker container as driver
Adds the ability to specify a Selenium Docker container server as
a driver. This allows for repeatable tests independent of host.
Currently we assume you are using the Firefox container. Instructions
are located in the README in tests/browser.

(Bitbake rev: 7df842f8f8b2ae640109ed06729ab59c9469fc64)

Signed-off-by: brian avery <brian.avery@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-07 10:42:22 +00:00
Ismo Puustinen e74831eba7 bitbake: depexp: fix string formatting.
The parameters to Python string formatting need to be inside a tuple.

(Bitbake rev: 3c82af11b89cf251c3e56725a1eed2d3f4bd835b)

Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-07 10:42:22 +00:00
Patrick Ohly 268bf22263 bitbake: monitordisk: add event
The current disk usage is interesting and may be worth logging over
time as part of the build statistics. Instead of re-implementing the
code and the configuration option (BB_DISKMON_DIRS), the information
gathered by monitordisk.py is made available to buildstats.bbclass via
a new event.

This has pros and cons:
- there is already a useful default configuration for "interesting" directories
- no code duplication
- on the other hand, users cannot configure recording separately from
  monitoring (probably not that important)

(Bitbake rev: f065ac17d0031dca6309ddbff18c8792630de865)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-07 10:42:22 +00:00
Patrick Ohly 091ebb8665 bitbake: monitordisk.py: minor code and comment cleanup
There's no need to encode and decode the hash key as a single string,
a tuple works just fine. Iterating over entries can be written more
concisely.

Entries in the stat results are integers, not floating point values.

(Bitbake rev: 3c943e989964382c0b819d92de26a0c914ebed33)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-07 10:42:22 +00:00
Patrick Ohly ad20ee9feb bitbake: runqueue.py: monitor disk space at regular time intervals
Hooking the disk monitor into the regular heatbeat event instead
of the runqueue solves two problems:

- When there is just one long running task which fills up the disk,
  the previous approach did not notice that until after the completion
  of the task because _execute_runqueue() only gets called on task
  state changes. As a result, aborting a build did not work in this
  case.

- When there are many short-lived tasks, disk space was getting
  checked very frequently. When the storage that is getting checked
  is on an NFS server, that can lead to noticable traffic to the
  server.

(Bitbake rev: 4547eea26803a9cd355d8b045197bcbdbb36a9ad)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-07 10:42:22 +00:00
Patrick Ohly 083365143e bitbake: cooker process: fire heartbeat event at regular time intervals
The intended usage is for recording current system statistics from
/proc in buildstats.bbclass during a build and for improving the
BB_DISKMON_DIRS implementation.

All other existing hooks are less suitable because they trigger at
unpredictable rates: too often can be handled by doing rate-limiting
in the event handler, but not often enough (for example, when there is
only one long-running task) cannot because the handler does not get
called at all.

The implementation of the new heartbeat event hooks into the cooker
process event queue. The process already wakes up every 0.1s, which is
often enough for the intentionally coarse 1s delay between
heartbeats. That value was chosen to keep the overhead low while still
being frequent enough for the intended usage.

If necessary, BB_HEARTBEAT_EVENT can be set to a float specifying
the delay in seconds between these heartbeat events.

(Bitbake rev: 7cf22ea057d28c54bd98dc1ab7a43402a29ff1f5)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-07 10:42:22 +00:00
Ross Burton 9e63f81c78 bitbake: ast: remove BBVERSIONS support
BBVERSIONS is moderately horrible and it doesn't appear to be actually used by
anyone, so remove it to simplify the finalise codepaths.

(Bitbake rev: 0bb188f01e396052b127e170a25246d79a6d6741)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30 15:48:10 +00:00
Patrick Ohly caf1a69577 bitbake: codeparser.py: support deeply nested tokens
For shell constructs like
   echo hello & wait $!
the process_tokens() method ended up with a situation where "token"
in the "name, value = token" assignment was a list of tuples
and not the expected tuple, causing the assignment to fail.

There were already two for loops (one in _parse_shell(), one in
process_tokens()) which iterated over token lists. Apparently the
actual nesting can also be deeper.

Now there is just one such loop in process_token_list() which calls
itself recursively when it detects that a list entry is another list.

As a side effect (improvement?!) of the loop removal in
_parse_shell(), the local function definitions in process_tokens() get
executed less often.

Fixes: [YOCTO #10668]

(Bitbake rev: d18a74de9ac75ba32f84c40620ca9d47c1ef96a3)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30 15:48:10 +00:00
Markus Lehtonen 38438b6cf4 bitbake: fetch2: obey BB_ALLOWED_NETWORKS when checking network access
[YOCTO #10508]

(Bitbake rev: ddd3bc2d64d7240ecb6b6e4a1ae29b1faef6cc22)

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30 15:48:10 +00:00
Michael Wood 4e48892b85 bitbake: toaster: buildinfohelper Clarify log message for build history
(Bitbake rev: 5accd6c4d1dcdf6609b4ed25c2b5e4faaf7f0909)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30 15:48:10 +00:00
Michael Wood 6dba0281e1 bitbake: toaster: buildinfohelper fix _get_layer_version_for_dependency
This function is simplified by not trying to handle replacing the regex
and just compiling and using it for matching.

- Fix typo in logger output with undefined variable
- Fix pyflake errors

(Bitbake rev: ea298ece8d678889cd5bcde46e00545e9a73edb9)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30 15:48:10 +00:00
Michael Wood 439f3da1a1 bitbake: toaster: buildinfohelper Simplify layer event to toaster layer function
Simplify the layer event information to layer version object in toaster
function. Previously this attempted many different methods of trying to
obtain the correct layer from toaster by manipulating the data from the
event or the data from the known layers to try and match them together.

We speed up and simplify this process by making better use of django's
orm methods and by working down the most likely matching methods in order
of accuracy.

[YOCTO #10220]

(Bitbake rev: 6935cc06974ea94c9971ede89b6e8f0eae9c195b)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30 15:48:10 +00:00
Michael Wood 5de7f159a1 bitbake: toaster: bldcontrol Move CustomImageRecipe file creation into own function
Move the custom image file creation (i.e. create the layer file
structure, conf and recipe file) into it's own function and remove the
creation of the BRLayer as this is done at schedule_build just like all
the other layers.

Fix a bug where the toaster-custom-images layer was always being appened
to the layer list if the directory exists.

(Bitbake rev: 15a42b36c01fccd79e5aa0788dea5640b253982b)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30 15:48:10 +00:00
Michael Wood 6f8df05e6e bitbake: toaster: orm models Handle CustomImageRecipe BRLayer here
The schedule_build function on the project object is where the BRLayers
are created for the build. Instead of creating the BRLayer for the
CustomImageRecipe in the localhostbbcontroller create it here so that
all that mechanism is in one place.

Also fix a number of pyflake errors.

(Bitbake rev: f8d3ea784937b6e416d3e5a4feb1283c478e4caa)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30 15:48:10 +00:00
Michael Wood b58b982eaf bitbake: toaster: orm models Project class Fix pyflake errors
(Bitbake rev: 69f33397083f54f977fa0cd4dd621731f32fd034)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30 15:48:10 +00:00
Michael Wood 30a9f65dcc bitbake: toaster: buildinfohelper toaster-custom-images layer
This fixes the unidentified layers issue by making the
toaster-custom-images layer a local layer. By doing this we also fix the
git assumptions made for the local layers which stop recipes and other
meta data being associated with them. This also removed some of the
special casing previously needed when we didn't have the concept of a
local (non git) layer.

Also rename created flag var to a have a different var for each returned
value so that the same value isn't used multiple times.

[YOCTO #10220]

(Bitbake rev: ba5332d4960d7f4f79aef63136796e2fa67284e3)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30 15:48:10 +00:00
Sujith H fa5ea98d3b bitbake: toaster: localhostbecontroller write toaster layers for project to toaster-bblayers.conf
Instead of updating conf/bblayers, here we update toaster-bblayers.conf
file. So extra effort to update bblayers.conf can be removed safely.

(Bitbake rev: f3e99d820f3798869a2a1d1604709c1c324dbbab)

Signed-off-by: Sujith H <sujith.h@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30 15:48:10 +00:00
Sujith H 5f0405abed bitbake: toaster: localhostbecontroller accept custom init script for build
When passed variable CUSTOM_BUILD_INIT_SCRIPT to toaster
setting, it would be nice to use it. Else toaster
can use oe-init script. This gives an oppurtunity to
use customized build init scritps.

(Bitbake rev: 9d168bb5f05453bdb7156793eea25da0a3119b4d)

Signed-off-by: Sujith H <sujith.h@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30 15:48:10 +00:00
Reyna, David c57533b83b bitbake: toaster: tablejs Fix missing close square bracket
There is a missing close square bracket.

[YOCTO #10631]

(Bitbake rev: f3da9f85e6036e6f43377172cbcfe701e0efca7f)

Signed-off-by: David Reyna <David.Reyna@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30 15:48:10 +00:00
Reyna, David 13c0ffc81c bitbake: toaster: orm gen_layerdeps Protect against circular Layer dependencies
Limit the recursion (to say 20 levels) when processing layer dependencies
so that circular dependecies do not cause infinite decent and an
out-of-memory failure. The duplicate found layers are already immediately
filtered in the code.

[YOCTO #10630]

(Bitbake rev: e9efef0bdb8068984c3013b87aac9e872ffb38ae)

Signed-off-by: David Reyna <David.Reyna@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30 15:48:10 +00:00
Michael Wood e336017e87 bitbake: toaster: customrecipejs Consume click event on 'a' link if disabled
Consume the click event on the download recipe link if it's disabled. To
prevent the link from sending user to an error page.
See http://getbootstrap.com/css/#forms-disabled-fieldsets and a link
caveat.

[YOCTO #10151]

(Bitbake rev: bc8401e78cea140349bded228d38f72f628b3980)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30 15:48:09 +00:00
Michael Wood 6191f71f81 bitbake: toaster: Add an example production settings file
Add an example settings that can be used for the basis of the production
instance of Toaster.

[YOCTO #10581]

(Bitbake rev: 1a7c356491b88c8decced39fb2039ef90065f2d2)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30 15:48:09 +00:00
Michael Wood 4477a762bd bitbake: toaster: tests Add management command tests
Add some simple sanity tests for the management commands that we use for
Toaster.

Can be executed with ./manage.py test tests.commands

For faster execution use the test settings and keepdb flag:
DJANGO_SETTINGS_MODULE=toastermain.settings_test ./manage.py test
tests.commands --keepdb

(Bitbake rev: 161ea71519e7f70d4aadaafc9c3294a12612f0cb)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30 15:48:09 +00:00
Michael Wood 310a9e5d35 bitbake: toaster: runbuilds Write the pidfile in python rather than shell script
Write the pid file out in the start up of this management command. This
ensures this has happened instead of relying on the shell command having
been run which may or may not be the case. This also makes it simpler for
testing.

Couple of clean ups of runbuilds as identified by pyflake

(Bitbake rev: 999e980ee1a58d16f33ef6c0e41aecdcd0206f39)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30 15:48:09 +00:00
Joshua Lock ddaac5e4e3 bitbake: bitbake: remove True option to getVarFlag calls
getVarFlag() now defaults to expanding by default, thus remove the
True option from getVarFlag() calls with a regex search and
replace.

Search made with the following regex:
getVarFlag ?\(( ?[^,()]*, ?[^,()]*), True\)

(Bitbake rev: c19baa8c19ea8ab9b9b64fd30298d8764c6fd2cd)

Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30 15:48:09 +00:00
Joshua Lock 1fce7ecbbb bitbake: bitbake: remove True option to getVar calls
getVar() now defaults to expanding by default, thus remove the True
option from getVar() calls with a regex search and replace.

Search made with the following regex: getVar ?\(( ?[^,()]*), True\)

(Bitbake rev: 3b45c479de8640f92dd1d9f147b02e1eecfaadc8)

Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30 15:48:09 +00:00
Richard Purdie 3d34ae6c11 bitbake: bitbake-worker: Handle cooker/worker IO deadlocking
I noiced builds where tasks seemed to be taking a surprisingly long time.
When I looked at the output of top/pstree, these tasks were no longer
running despite being listed in knotty. Some were in D/Z state waiting for
their exit code to be collected, others were simply not present at all.

strace showed communication problems between the worker and cooker, each
was trying to write to the other and nearly deadlocking. Eventually, timeouts
would allow them to echange 64kb of data but this was only happening every
few seconds.

Whilst this particularly affected builds on machines with large numbers
of cores (and hence highly parallal task execution) and in cases where
I had a lot of debug enabled, this situation is clearly bad in general.

This patch introduces a thread to the worker which is used to write data
back to cooker. This means that the deadlock can't occur and data flows
much more freely and effectively.

(Bitbake rev: 3cb0d1c78b4c2e4f251a59b86c8da583828ad08b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-29 11:22:06 +00:00
Kai Kang cd381cd714 bitbake: COW.py: fix sample codes
The call of methods iteritems() and itervalues() in sample codes were
replaced by items() and values() to convert to Python 3 by Bitbake rev
d0f904d407f57998419bd9c305ce53e5eaa36b24. But the methods iteritems()
and itervalues() belong to class COWDictMeta not class dict or set. The
modifications should not be made in purpose that it fails to run sample
codes, so revert them.

(Bitbake rev: d140f0ee6f301264e226914766d9f63558acfd6c)

Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-23 10:59:56 +00:00
Michael Wood dbf3a9fa8e bitbake: toaster: layerindex updater Take into account layers being predefined
As we can now provide layer definitions through fixtures we need to be
more clever how we update the metadata in the database to avoid
duplicate metadata being created. To do this we make more effort to
match existing data in the database and update only the fields which
will be better provided by the layer index.

This removes the need for us to special case layers which are provided
as part of poky such as openembedded-core or meta-poky which exist on
the layerindex but with different git urls.

(Bitbake rev: f981b68f66718d5b196684f4e378a5f195ff0337)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: brian avery <brian.avery@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-23 10:59:56 +00:00
Michael Wood f59ac87b46 bitbake: toaster: orm/fixtures Add the master release and correct morty release
Add the master release option to base your project on and correct the
morty release so that for poky based setups we use the poky provided
version of the layer rather than checking out the layer from its own git
repository.

[YOCTO #10497]

(Bitbake rev: c83ab92362378b22d3f4d6119bf362f704577ca2)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: brian avery <brian.avery@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-23 10:59:56 +00:00
Michael Wood 50cb0f596f bitbake: toaster: settings fixture Set default release to master
Now that morty has been released we now set the DEFAULT_RELEASE back to
master.

(Bitbake rev: 115cee16a9aecfcd1061bb106ebca4e861d9b296)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: brian avery <brian.avery@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-23 10:59:56 +00:00
Patrick Ohly 7bb38a3358 bitbake: taskdata.py: improve handling of depends/rdepends
Error handling only caught the cause where a dependency did not have
any colon, but ignored the case where more than one was given. Now
"pn:task:garbage" will raise an error instead of ignoring ":garbage".

The error message had a misplaced line break (?) with the full stop
on the next line. Indenting the explanation with a space might have
been intended and is kept.

split() was called three times instead of just once.

Instead of improving the two instances of the code (one for 'depends',
one for 'rdepends'), the common code is now in a helper function.

(Bitbake rev: 063d255fdcb3f79b2d1b0badedc80384b295a3f5)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-23 10:59:56 +00:00
Patrick Ohly d7f76363fb bitbake: data_smart.py: don't reorder internal bitbake variables when calculating hash
Commit 260ced745 added __BBTASKS, __BBANONFUNCS, __BBHANDLERS to the
data that gets hashed, but only after reordering these lists. The
intention probably was to make the hash deterministic, but that's
unnecessary (the content of the variables should already be
deterministic) and hides potential reasons that might require
re-parsing.

(Bitbake rev: 3511d464f3a9d8b4334cda384b35016de69ce49e)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-23 10:59:56 +00:00
Richard Purdie 2631c375b8 bitbake: data_smart: Default to expansion for getVar/getVarFlags
We've been building to this for a while, default to return expanded
values for getVar/getVarFlags.

We can then go through and remove the "True" option to many of the
calls to this function, all function calls should have a default by now
though since the parameter has been required for a while.

(Bitbake rev: caf5bb9b7fe254bca9da077ebcb84a37d1f96dd4)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-23 10:59:56 +00:00
Richard Purdie 30205c7148 bitbake: data: Drop deprecated old style bitbake API
The old style bb.data.getVar/setVar API has long since been deprecated in
favour of d.getVar/setVar and friends.

Now we're about to change the default expansion parameter, drop the old APIs
to simplify the transition and ensure everyone is using the new style functions.
Conversion is trivial if there are remaining stragglers.

I've left bb.data.expand() for now since its more widely used but would make a good
follow up patch series.

(Bitbake rev: 1825604d46fcd29fad6cfd325f1cb1e1b457d2c9)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-23 10:59:56 +00:00
Richard Purdie 8de811ae76 bitbake: lib/bb: Don't use deprecated bb.data.getVar/setVar API
The old style bb.data.getVar/setVar API is obsolete. Most of bitbake
doesn't use it but there were some pieces that escaped conversion. This
patch fixes the remaining users mostly in the fetchers.

(Bitbake rev: ff7892fa808116acc1ac50effa023a4cb031a5fc)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-23 10:59:56 +00:00
Paul Eggleton 4d8ee55164 bitbake: fetch2: npm: conditionally hide NPM_LOCKDOWN / NPM_SHRINKWRAP warnings
If ud.ignore_checksums is set (which we currently use to suppress the
warnings for missing SRC_URI checksums when fetching files from
scripts), then if we're fetching an npm package we should similarly
suppress the warnings when NPM_LOCKDOWN and NPM_SHRINKWRAP aren't set.

At the same time, make any errors reading either of these files actual
errors since if the file is specified and could not be found, that
should be an error - not the exact same warning.

Fixes [YOCTO #10464].

(Bitbake rev: cefb8c93c8299e68352cf7ec5ad9ca50c0d499ed)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-23 10:59:56 +00:00
brian avery 7c3a47ed89 bitbake: toaster: settings set ALLOWED_HOSTS to * in debug mode
As of Django 1.8.16, Django is rejecting any HTTP_HOST header that is
not on the ALLOWED_HOST list.  We often need to reference the
toaster server via a fqdn, if we start it via webport=0.0.0.0:8000 for
instance, and are hitting the server from a laptop. This change does
reduce  the protection from a DNS rebinding attack, however, if you are
running the toaster server outside a protected network, you should be
using the production instance.

[YOCTO #10578]

(Bitbake rev: 7f51149453c96a3f1da64ea85306518fd2b65f21)

Signed-off-by: brian avery <brian.avery@intel.com>
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-16 11:38:44 +00:00