Commit Graph

547 Commits

Author SHA1 Message Date
Richard Purdie
c9692bdff0 bitbake: runqueue: Fix task dependency corner case in sanity test
A corner case was identified where tasks with valid stamps from previous
builds need to be accounted for in the new sanity test in the migration
code. Add a variable to track such completed tasks to ensure the sanity
test works correctly.

(Bitbake rev: d517b1ef13ca7ab2fb4d761d3bd3b9fb7c591514)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-01-02 16:43:01 +00:00
Richard Purdie
7ab33df995 bitbake: runqueue: Ensure task dependencies are run correctly
We've seen a number of mystery failures where task B would run despite
task A, its dependency not having run. An example would be do_compile
when do_unpack didn't run.

This has been tracked down to this code block. In theory it shouldn't
trigger however it can and has due to bugs elsewhere. When it does, it
causes significant weird failures and possible build corruption.

Change the code to abort the build. This avoids any chance of corruption
and should ensure the issues get reported, putting an end to the weird
build failures.

There may be some cases where this triggers and it shouldn't, we'll work
through those as they arise and are identified.

(Bitbake rev: 7a92b7f58ab187eddfe550bd6fb687240c7b11bb)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-01-02 16:43:01 +00:00
Richard Purdie
e8ebeeaa1b bitbake: runqueue: Fix equiv hash handling build failures
Regardless of whether we remapped the hash on the server or not, we need
to have bitbake work as if we did as we need to match how the stamp files
look.

This change resolves build failures where tasks were rerunning when they
shouldn't.

(Bitbake rev: 40928f6991436cf687821015324483b205abfcb1)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-01-02 16:43:01 +00:00
Richard Purdie
ec3897d9c0 bitbake: runqueue: Only call into the migrations function if migrations active
This doesn't save much time but does make the profile counts for the
function more accurate which is in itself useful.

(Bitbake rev: d446fa89d206fbc6d098215163c968ea5a8cf4a9)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-12-16 23:27:14 +00:00
Richard Purdie
f397a61f7c bitbake: runqueue: Optimise task filtering
We were seeing this running thousands of times with hashequiv, do
the filtering where it makes more sense and make it persist.

(Bitbake rev: 2cfeb9998a8ad5b1dcda0bb4e192c5e4306dab17)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-12-16 23:27:14 +00:00
Richard Purdie
d98e9d86d1 bitbake: runqueue: Optimise out pointless loop iteration
(Bitbake rev: 105d1f0748edde7753a4063e6fdc758ffc8a8a9e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-12-16 23:27:14 +00:00
Richard Purdie
45f62a4a25 bitbake: runqueue: Optimise task migration code slightly
Move the calls to difference_update out a code level which improves efficiency
significantly.

Also further combine the outer loop for efficiency too.

These two changes remove a bottleneck from the performance charts.

(Bitbake rev: e28ec69356f1797de3e4e3fca0fef710bc4564de)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-12-16 23:27:14 +00:00
Richard Purdie
e4dc65ad46 bitbake: runqueue: Fix sstate task iteration performance
Creating a new sorted list of sstate tasks each iteration through runqueue is
extremely ineffecient and was compounded by the recent change from a list to set.

Create one sorted list instead of recreating it each time.

(Bitbake rev: de18824996841c3f35f54ff5ad12f94f6dc20d88)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-12-16 23:27:14 +00:00
Richard Purdie
884463c8d1 bitbake: siggen: Split get_tashhash for performance
There are two operations happening in get_taskhash, the building of the
underlying data and the calculation of the hash.

Split these into two funtions since the preparation part doesn't need
to rerun when unihash changes, only the calculation does.

This split allows sigificant performance improvements for hashequiv
in builds where many hashes are equivalent and many hashes are changing.

(Bitbake rev: 6a32af2808d748819f4af55c443578c8a63062b3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-12-16 23:27:14 +00:00
Richard Purdie
73896a7a0e bitbake: runqueue: Fix task mismatch failures from incorrect logic
The "no dependencies" task case was not being correctly considered in this
code and seemed to be the cause of occasionaly task hash mismatch errors
that were being seen as the dependencies were never accounted for properly.

(Bitbake rev: 608b9f821539de813bfbd9e65950dbc56a274bc2)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-12-16 23:27:14 +00:00
Richard Purdie
eb9809741c bitbake: runqueue: Rework process_possible_migrations() to improve performance
The looping over multiple changed hashes causes many calls to get_taskhash
and get_unihash which are potentially slow and then overwritten.

Instead, batch up all the tasks which have changed unihashes and then
do one big loop over the changed tasks rather than each in turn.

This makes worlds of difference to the performance graphs and should speed
up build where many tasks are being rehashed.

(Bitbake rev: c9c68d898985cf0bec6fc95f54c151cc50255cac)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-12-16 23:27:14 +00:00
Joshua Watt
b3771bded2 bitbake: runqueue: Batch scenequeue updates
Batch all updates to scenequeue data together in a single invocation
instead of checking each task serially. This allows the checks for
sstate object to happen in parallel, and also makes sure the log
statement only happens once (per set of rehashes).

(Bitbake rev: db033a8f8a276d864bdb2e1eef159ab5794a0658)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-12-12 13:15:00 +00:00
Richard Purdie
d61727185a bitbake: runqueue: Add extra debugging when locked sigs mismatches occur
(Bitbake rev: 3aad9978be2a40d4c535a5ae092f374ba2a5f627)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-12-04 12:12:45 +00:00
Richard Purdie
36e40ed24f bitbake: runqueue/siggen: Allow handling of equivalent hashes
Based on the hashserv's new ability to accept hash mappings, update runqueue
to use this through a helper function in siggen.

This addresses problems with meta-extsdk-toolchain and its dependency on
gdb-cross which caused errors when building eSDK. See the previous commit
for more details.

(Bitbake rev: 39098b4ba2133f4d9229a0aa4fcf4c3e1291286a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-12-04 12:12:45 +00:00
Kai Kang
e0ce87bf85 bitbake: runqueue.py: not show warning for deferred multiconfig task
When follow the instructions of multiconfig from Yocto dev manual that
set in core-image-sato recipe:

  do_image[mcdepends] = "multiconfig:x86:arm:core-image-minimal:do_rootfs"

it show too many annoying warnings look like:

| WARNING: Deferring mc:x86:virtual:native:/buildarea6/kkang/poky/meta/recipes-support/libxslt/libxslt_1.1.33.bb:do_populate_sysroot
| after mc:arm: virtual:native:/buildarea6/kkang/poky/meta/recipes-support/libxslt/libxslt_1.1.33.bb:do_populate_sysroot

Treat them as infomations rather than warnings.

(Bitbake rev: 0fb4b5153237af4a13b2c65711ab798b0de06c2f)

Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-11-29 11:26:12 +00:00
Richard Purdie
2ca41234b5 bitbake: runqueue: Ensure failed harddependencies in scenequeue are accounted for in migrations
Setscene hard dependencies were not being correctly handled during task migration.
For example, do_package of recipe X might become valid due to hashequiv yet we're
still rebuilding pseudo-native, a harddep of do_package. This would mean
it would try to execute that setscene task despite pseudo not being present.

Fix this by ignoring tasks with failed harddependencies. This does mean
stlightly more rebuilds than is optimal but it avoids build crashes. Ultimately
the new runqueue model can likely better handle these cases than the older codebase
could but that is for another more invasive patch.

(Bitbake rev: 0dc61e8b9964f7fe41d51b6a481ca7aeaacd8bce)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-11-25 17:58:11 +00:00
Richard Purdie
e18bb3f56b bitbake: runqueue: Fix hash equivalence duplicate tasks running
The key problem is that currently running setscene tasks are not
accounted for when processing task migrations. This means can allow
two of the same task to execute at the same time with unpredictable
effects.

This change allows us to stop doing that and refactor the code slightly
to make it clearer that these conditions don't arrive even with
deferred tasks.

(Bitbake rev: ac1922d348613ca46a1047ad5ddf755eac16d568)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-11-22 23:12:12 +00:00
Richard Purdie
ca01520a0b bitbake: runqueue: Improve sstate rehashing output
Bibake is currently too 'chatty' when hash equivalence is enabled. Fix
this by only printing the log output if a rehash happens and it matches
an sstate object.

Also, pass a summary option to the hash checking function. This was
already changed to a mechanism which allows addition of new parameters
so this should be backwards and forwards compatible.

(Bitbake rev: 0c4515603ad08775e3b0404cba5374367e49f236)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-11-07 15:12:29 +00:00
Richard Purdie
9254d537aa bitbake: runqueue: Small performance optimisation
A minor performance optmisation to keep lists smaller when running large
builds. We can do this since once a task has been built, we don't need
to worry about it. This improves a major bottleneck that shows up on
performance profile charts in dryruns.

(Bitbake rev: cd6b89230823707c3c9bb9e6883bf5a971916581)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-09-30 17:23:35 +01:00
Richard Purdie
2f8cd1d021 bitbake: runqueue: Save unihashes more frequently
There are some runqueue code paths where the unihash cache would not be
saved where for example only parsing or an occurred. Save the cache at the
end of runqueue generation to ensure entries are cached.

(Bitbake rev: 9eee0d36870c11dd303894a6151c33a83bd3a1bc)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-09-30 17:23:35 +01:00
Richard Purdie
7ab4808e0a bitbake: siggen/runqueue: Fix signature mismatch issues
We need to set the setscene tasklist before we call into the
taskhash/unihash code else the behaviour is inconsistent.

Avoid reporting hashes for non setscene tasks since we'd never
query that.

(Bitbake rev: 419a7840b8627278db694029c25df00214d01d96)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-09-30 17:23:35 +01:00
Richard Purdie
ff872fdda5 bitbake: runqueue: Change task migration behaviour for rerunning setscene tasks
Currently runqueue will rerun setscene tasks multiple times as hashes
change. This has caused numerous problems since a setscene task may
become "unavailable" for some future signature combination and the code
then can't easily "unskip" tasks its already passed into the execution
queue.

At least for now, only run setscene once and assume they're equivalent
at that point. In practise that has been much more stable in testing.

Tweak the test to match the change in behaviour.

(Bitbake rev: 4205a3ef23834f317642bba155d67cd772176fb6)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-09-30 17:23:35 +01:00
Richard Purdie
d0b7471ba8 bitbake: runqueue: Fix task migration problems
Tasks were not migrating consistently, particularly:

* if a task was rehashed which had already run
* if a task which was valid became invalid due to a rehash

We need to always run the migration code for rehashed tasks and then
reprocess them for hash validity. This means rearranging the code.

It also means several tests are no longer correct and can't be written
correctly to work on all possible workflows so those are removed.

(Bitbake rev: 8443989ee41e9b162972935513e437b5c66ea74d)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-09-30 17:23:35 +01:00
Robert Yang
2af45501fd bitbake: runqueue: validate_hashes(): currentcount should be a number
According to sstate_checkhashes which is defined in sstate.bbclass, the
currentcoun should be a number (0, not None).

Fixed:
$ bitbake base-files -Sprintdiff
    >    bb.plain("Sstate summary: Wanted %d Found %d Missed %d Current %d (%d%% match, %d%% complete)" % (total, len(found), len(missed), currentcount, match, complete))

TypeError: %d format: a number is required, not NoneType

(Bitbake rev: 45cb73e2846eaffe8964a573875f54808e8f3633)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-09-19 20:30:35 +01:00
Joshua Watt
20f032338f bitbake: bitbake: Rework hash equivalence
Reworks the hash equivalence server to address performance issues that
were encountered with the REST mechanism used previously, particularly
during the heavy request load encountered during signature generation.
Notable changes are:

1) The server protocol is no longer HTTP based. Instead, it uses a
   simpler JSON over a streaming protocol link. This protocol has much
   lower overhead than HTTP since it eliminates the HTTP headers.
2) The hash equivalence server can either bind to a TCP port, or a Unix
   domain socket. Unix domain sockets are more efficient for local
   communication, and so are preferred if the user enables hash
   equivalence only for the local build. The arguments to the
   'bitbake-hashserve' command have been updated accordingly.
3) The value to which BB_HASHSERVE should be set to enable a local hash
   equivalence server is changed to "auto" instead of "localhost:0". The
   latter didn't make sense when the local server was using a Unix
   domain socket.
4) Clients are expected to keep a persistent connection to the server
   instead of creating a new connection each time a request is made for
   optimal performance.
5) Most of the client logic has been moved to the hashserve module in
   bitbake. This makes it easier to share the client code.
6) A new bitbake command has been added called 'bitbake-hashclient'.
   This command can be used to query a hash equivalence server, including
   fetching the statistics and running a performance stress test.
7) The table indexes in the SQLite database have been updated to
   optimize hash lookups. This change is backward compatible, as the
   database will delete the old indexes first if they exist.
8) The server has been reworked to use python async to maximize
   performance with persistently connected clients. This requires Python
   3.5 or later.

(Bitbake rev: 2124eec3a5830afe8e07ffb6f2a0df6a417ac973)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-09-18 17:52:01 +01:00
Richard Purdie
f025010ee0 bitbake: runqueue/siggen: Optimise hash equiv queries
We only have hash equivalence for setscene tasks so only query the server
for those, reducing the number of connections needed.

(Bitbake rev: 22082c7b3ca0cffcedb7d1d8c6681d35286376db)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-09-16 23:02:45 +01:00
Joshua Watt
46a71949de bitbake: bitbake: respect force flag in runall and runonly
Specifying the force flag will now cause runall and runonly to
invalidate the tasks before running them. This allows a --runall or
--runonly to force the tasks to run, even if they would have otherwise
been skipped, e.g.:

 bitbake -f --runall fetch

Will run all do_fetch tasks even if they wouldn't be necessary (for
example, skipped by setscene)

(Bitbake rev: 71e52d3822016027106f2a2e74b8dfdf20f5dc1e)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-28 16:44:09 +01:00
Richard Purdie
bb1e701fb1 bitbake: runqueue: Optimise build_taskdepdata slightly
Rather than repeatedly calling mc_from_tid() do this in the parent,
removing around a million function calls. Takes time spent in this
function from 40s to 36s.

(Bitbake rev: 28b3f0d8867804799420689c314ac4a8f01efb8c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-21 15:30:13 +01:00
Richard Purdie
4cc3c0daed bitbake: runqueue: Further optimise holdoff tasks
There are other data structures which can be reprocessed at the same
time as holdoff_tasks, further improving build efficiency in various
places.

(Bitbake rev: 02090b3456b7a2de12e72dfeaabfd3b631609924)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-21 15:30:13 +01:00
Richard Purdie
fece8f4737 bitbake: runqueue: Optimise holdoff task handling
We don't need to process the holdoff task list until we're executing tasks
which saves some data manipulation, at the cost of some data structures
not being correct at all times. This saves significant amounts of time
in various profile charts of larger builds.

(Bitbake rev: 270f076111b12eab358417b0c4cf9c70d7cc787a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-21 15:30:13 +01:00
Richard Purdie
3afc48c38f bitbake: runqueue: Small but critical fix
We've observed do_package and do_package_setscene running in parallel. The
reason is that holdoff_tasks wasn't getting updated. Looking at the code, it
would seem the reason is that the task was in pending_migrations and hence
changed wasn't set and holdoff_tasks wasn't updated.

Fix this. It only affects builds with rehashing enabled.

(Bitbake rev: e26e61e84575669bd223f6ab316798097ed95ec8)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-21 15:30:13 +01:00
Richard Purdie
20946c63c2 bitbake: runqueue: Ensure target_tids is filtered
bitbake <target> --runonly=fetch

failed as the target_tids list included entries which were no longer targeted
task ids. Fix this.

(Bitbake rev: 94e848ae6544e628a19cb97115279b0b1678967c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-16 10:05:33 +01:00
Richard Purdie
5f0d31ce46 bitbake: runqueue: Ensure data is handled correctly
This doesn't appear to have ill effects right now but there is a correctness
issue which this so fix it.

(Bitbake rev: a5e084a266f63c2fd370122327615e49beaeb94e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-15 13:32:06 +01:00
Richard Purdie
2fa5d98f52 bitbake: runqueue: Fix data corruption problem
This was overwriting data in the parent which caused all kinds of
odd/weird failures.

(Bitbake rev: 4c5aeb424247a9d0c907524ffacd9c61fcdc0852)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-15 13:32:06 +01:00
Richard Purdie
93e4dc5f11 bitbake: runqueue: Ensure we clear the stamp cache
When the task hashes change we need to ensure the stampcache is cleared out
else tasks don't rerun when they should as we're basing decisions on stale
cache data.

(Bitbake rev: 08962092d3bb7887d82f97d442a6103c0677eae7)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-14 17:28:23 +01:00
Richard Purdie
64d0493d97 bitbake: runqueue: Add missing setscene task corner case
We weren't marking this special case of setscene task as buildable leading to
runqueue task failures.

(Bitbake rev: 930efbc563443d82df8d692bb8ff172ca2bae192)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-14 17:28:23 +01:00
Richard Purdie
0993752e06 bitbake: runqueue: Add further debug information
Further testing shows we should test some extra datastructures to help pinpoint logic
errors more precisely. This adds some further data structure sanity checks.

(Bitbake rev: 83c4370b25c3a14cc946965c5c5f83ea28f488a1)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-14 17:28:23 +01:00
Richard Purdie
0d73901c98 bitbake: runqueue: Drop debug statement causing performance issues
This debug statement could result in a long list of tasks which when
repeatedly sent over our IPC, slowed down the builds immensely. Remove
it in favour of other more targeted debugging added recently, bringing
back some lost performance, particularly on builds with large numbers
of tasks.

(Bitbake rev: 85fe627fdb6510f0942917964386fad9d8c479c8)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-14 17:28:23 +01:00
Richard Purdie
977a293f2f bitbake: runqueue: Fix event timing race
The event from the task notifiing of hash equivalency should only be processed
when the task completes. This can otherwise result in a race where a dependent
task may run before the original task completes causing various failures.

To make this work reliably, the code had to be restructured quite a bit.

(Bitbake rev: 1bf5be46f92f125193638cf41ff207d68f592259)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-14 17:28:23 +01:00
Richard Purdie
3fb90d0fff bitbake: runqueue: Recompute holdoff tasks from scratch
The changed_setscene variable here is just odd and not needed. Worse,
it could prevent some tasks from being removed from the holdoff tasks
list. The list is being rebuilt and should work as intended just from
the other data, this is a leftover from previous versions of the code
as far as I can tell.

(Bitbake rev: 030b9f2b3ce6ed40e79304eb0ffee6c6613f43be)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-14 17:28:23 +01:00
Richard Purdie
de06716c76 bitbake: runqueue: Improve scenequeue debugging
Whilst we had good runqueue failure mode debug, it hadn't adapted to the
scenequeue changes. Run the scenequeue sanity tests at the end of
a build and output the results regardless of whether all setscene tasks
completed or not. This *massively* improves the ability to debug runqueue
problems.

(Bitbake rev: b9b2177473c0b95a23bd519a201e1d2ba101c6c1)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-14 17:28:23 +01:00
Richard Purdie
d842d2507a bitbake: runqueue: Fix next_buildable_task performance problem
Looking at the profile information, a lot of time is being spent in
next_buildable_task. This is probably due to the generator expressions
not working well with the empty test.

The easiest way to improve things is to switch to using set manipulations.
We also don't need to update self.buildable the way the original code did
as we don't rely on that anywhere.

(Bitbake rev: 3bcf9ad4964b7e42d1a02ce231e9db42a81ead2a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-14 17:28:23 +01:00
Richard Purdie
99db00b836 bitbake: runqueue: Wait for covered tasks to complete before trying setscene
If tasks are in the covered list of tasks for a given setscene task,
it needs to wait for those to complete before we can start.

(Bitbake rev: fdee640c26750b852eb68f5c80437377aa300ed8)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-14 17:28:23 +01:00
Richard Purdie
c86ae704d3 bitbake: runqueue: Improve setscene task handling logic
The previous tasks_covered and tasks_notcovered were basically unstable
data structures. We couldn't always tell whether tasks should be covered
or not when trying to repair the sturcture if sstate tasks reran.

In the end its simpler to throw the lists away and rebuild them based upon
current data rather than trying to patch it adhoc. This turns out to be
simpler and much more reliable and I've much more confidence in this code.

(Bitbake rev: 52ee2ba2c617d928569f5afa404925c8b6f317bc)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-14 17:28:23 +01:00
Richard Purdie
18c109d6f5 bitbake: runqueue: Fix corruption issue
We need to copy this set, not modify the original else all kinds
of weird and bad things break, mostly from circular references.
We'll not go into how much sleep I lost tracking down the fallout
from this.

(Bitbake rev: 49927546d2b306830c98f6f9da4a6ad828f6a3a6)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-14 17:28:23 +01:00
Richard Purdie
4fbb862cdc bitbake: siggen: Clean up task reference formats
Currently siggen uses the format "<filename>.<taskname>" for referencing tasks
whilst runqueue uses "<filename>:<taskname>". This converts to use ":" as the
separator everywhere.

This is an API breaking change since the cache is affected, as are siginfo files
and any custom signature handlers such as those in OE-Core.

Ultimately this will let us clean up and the accessor functions from runqueue,
removing all the ".rsplit(".", 1)[0]" type code currently all over the place.
Once a standard is used everwhere we can update the code over time to be more
optimal.

(Bitbake rev: 07e539e1c566ca3434901e1a00335cb76c69d496)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-06 11:21:32 +01:00
Richard Purdie
40a5e193c4 bitbake: runqueue: Clean up BB_HASHCHECK_FUNCTION API
This function uses an old API which uses offsets into lists as a communication
mechanism. Update the API to use "tid" which is used universally in runqueue now.

We can also add kwargs support to the funciton definition to drop some of the
backwards compaiblility hoops we had to jump though with different function
argument combinations.

(Bitbake rev: dc23550047e5078da491ce9a6f30989cb5260df6)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-06 11:21:32 +01:00
Richard Purdie
ca04aaf7b5 bitbake: cooker/hashserv: Allow autostarting of a local hash server using BB_HASHSERVE
Its useful, particularly in the local developer model of usage, for
bitbake to start and stop a hash equivalence server on local port,
rather than relying on one being started by the user before the build.

The new BB_HASHSERVE variable supports this.

The database handling is moved internally into the hashserv code so that
different threads/processes can be used for the server without errors.

(Bitbake rev: a4fa8f1bd88995ae60e10430316fbed63d478587)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-06 11:21:31 +01:00
Richard Purdie
d9aafb8507 bitbake: runqueue: Improve determinism
Whilst this isn't strictly necessary, its helpful if the log output is
consistent and its also helpful if bugs either appear or don't appear
for a specific configuration. Ensuring the various iterations we make
are deterministic (sorted) helps with this.

(Bitbake rev: 6a901bb904a97ca90d88be2c6901d3d32346282f)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-06 11:21:31 +01:00
Richard Purdie
7df31ff368 bitbake: runqueue: Enable dynamic task adjustment to hash equivalency
There is a compelling usecase for tasks being able to notify runqueue
that their "unihash" has changed. When this is recieved, the hashes of
all subsequent tasks should be recomputed and their new hashes checked
against existing setscene validity. Any newly available setscene tasks
should then be executed.

Making this work effectively needs several pieces. An event is added
which the cooker listen for. If a new hash becomes available it can
send an event to notify of this.

When such an event is seen, hash recomputations are made. A setscene
task can't be run until all the tasks it "covers" are stopped. The
notion of "holdoff" tasks is therefore added, these are removed from
the buildable list with the assumption that some setscene task will
run and cover them.

The workers need to be notified when taskhashes change to update their
own internal siggen data stores. A new worker command is added to do this
which will affect all newly spawned worker processes from that worker.

An example workflow which tests this code is:

Configuration:
BB_SIGNATURE_HANDLER = "OEEquivHash"
SSTATE_HASHEQUIV_SERVER = "http://localhost:8686"

$ bitbake-hashserv &
$ bitbake automake-native
$ bitbake autoconf-native automake-native -c clean
$ bitbake m4-native -c install -f
$ bitbake automake-native

with the test being whether automake-native is installed from sstate.

(Bitbake rev: 1f630fdf0260db08541d3ca9f25f852931c19905)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-06 11:21:31 +01:00
Richard Purdie
de143e0db6 bitbake: siggen: Add new unitaskhashes data variable which is cached
We need to preserve unihash task hashes between runs. Use the new SimpleCache
class to create such a class within the signature generator which is loaded
at init time and saved when builds complete. The default is unpopulated but
metadata sig handlers can populate this cache.

(Bitbake rev: 1f326f2c29c2664a5daaeeb0c1fd332630efbdba)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-06 11:21:31 +01:00
Richard Purdie
53bb939383 bitbake: runqueue: Improve scenequeue processing logic
Rather than a special copy of the data structure which we change, compute
the logic using set operations from other data we have. This means
we can add tasks back into the scenequeue without having to worry about
reversing operations on this variable with all the potential bugs that
might involve.

(Bitbake rev: b707d0cbc25fa336a1e95ff588f1ea37eee063eb)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-06 11:21:31 +01:00
Richard Purdie
9881c532c8 bitbake: runqueue: Fix non setscene tasks targets being lost
If you specify both setscene and non-setscene tasks on the commandline, the
non-setscene tasks could be missed, e.g. "bitbake X:do_patch X:do_populate_sysroot"
and do_patch would fail to run.

Fix the problem in runqueue and add a testcase.

(Bitbake rev: 75292fdec5d9c0b5b3c554c4b7474a63656f7e12)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-18 12:16:19 +01:00
Richard Purdie
1069c36417 bitbake: runqueue: Optimise multiconfig with overlapping setscene
Currently if a multiconfig build contains different configurations which
have overlapping sstate artefacts, it will build them multiple times.
This is clearly suboptimal and not what users want/expect.

This adds code to detect this and stall all but one of the setscne tasks
so that once its built, it can be found by the other tasks.

We take care to iterate the multiconfigs in order so try and avoid
dependency loops. We also match on PN+taskname+taskhash since this is
what we know sstate in OE-Core would use. There are some tasks even within
a multiconfig which match hashes (mostly do_populate_lic tasks) but those
have a much higher chance of circular dependency so aren't work attempting
to optimise.

If a deadlock does occur the build will be slower but there is code to
unbreak such a deadlock so it hopefully doens't break anything.

Comments are injected into the test tasks so they have different task
hashes and a new test for this optimisation is added.

(Bitbake rev: a75c5fd6d4ec56836de0be2fe679c81297a080ad)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-16 13:53:17 +01:00
Richard Purdie
5333f31fc7 bitbake: runqueue: Abstract hash verification function
Pull the common pieces of the hash verification code into a single function
and reduce code duplication.

(Bitbake rev: d0c39e05cef841c6f29cc6c919df6cbf271a9bda)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-16 13:53:17 +01:00
Richard Purdie
be564f82ca bitbake: runqueue: Whitespace fix
Fix some unwanted extra indentation.

(Bitbake rev: 460a5c2e3e1d72f2da16fbc96832fadc82e72c52)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-16 13:53:17 +01:00
Richard Purdie
3b01998281 bitbake: runqueue: Simplify some convoluted logic
This was left from when task IDs complicated the code, simplify.

(Bitbake rev: ae36b5c693bb9f13c88199e78e3c31616852eafb)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-16 13:53:17 +01:00
Richard Purdie
39ef064da5 bitbake: runqueue: Complete the merge of scenequeue and normal task execution
This combines the scqenequeue and normal task execution into one function
and simplifies the state engine accordingly.

This is the final set of cleanup to fully merge things without adding the
extra noise to the previous commits.

(Bitbake rev: 56f3396d8c7cfbebd175877c9d773e4e35f8dea1)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00
Richard Purdie
2d84e3682c bitbake: runqueue: Alter setscenewhitelist handling
Since there is now parallel execution of setscene and normal tasks, the way
setscenewhitelist handling worked can't function the way it did. Paul and I
never liked its error output anyway.

This code tries a different approach, checking the task at execution time
but printing the uncovered task list.

This code may need improvement after real world usage but can
work with the new task flows.

(Bitbake rev: a08d8ba5f5194a09391b1904ee31c04c5f0b1e28)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00
Richard Purdie
cf829a5f66 bitbake: runqueue: Merge the queues and execute setscene and normal tasks in parallel
This is the serious functionality change in this runqueue patch series of
changes.

Rather than two phases of execution, the scenequeue setscene phase, followed
by normal task exeuction, this change allows them to execute in parallel
together.

To do this we need to handle marking of tasks as covered/uncovered in a piecemeal
fashion on a task by task basis rather than in a single function.

The code will block normal task exeuction until any setcene task which could
cover that task is executed and its status is known. There is a slight
optimisation which could be possible here at the risk of races but that
doesn't seem worthwhile.

The state engine isn't entirely cleaned up in this commit (see FIXME) and
the setscenewhitelist functionality is broken by it (see following patches)
however its good enough to test with normal workflows.

(Bitbake rev: 58b3f0847cc2d47e76f74d59dcbbf78fe41b118b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00
Richard Purdie
491c6049e0 bitbake: runqueue: Clarify scenequeue_covered vs. tasks_covered
It wasn't clear whether the variable contained just setscene covered
tasks or all covered tasks. We need both sets of data so lets just have
two clearly named variables.

(Bitbake rev: a9fb55627762e7c8b3df30b335ad0b2f1adc080e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00
Richard Purdie
4a1cb07df2 bitbake: runqueue: Further scheduler buildable tasks cleanup
The code for setting up buildable tasks can be simplified.

(Bitbake rev: ce3cd2df5b034f8dbdcf9834e8b9a393b6b01aad)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00
Richard Purdie
a9e759be65 bitbake: runqueue: Remove pointless variable
Its now clear a variable is pointless, remove it and tweak the logic
so the data structure of the existing variable matches what we need.

(Bitbake rev: c257c7b93b86dd794d31307e820215301c7ccf3b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00
Richard Purdie
5e3909bdce bitbake: runqueue: Code simplification
Simplfy some looping code which no longer has any purpose.

(Bitbake rev: 01dfc37095e5c661f275917d22aa1c1ad7f24d8d)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00
Richard Purdie
5b57335ae4 bitbake: runqueue: Tweak comments and debug code
Add some extra comments to build_scenequeue_data() and fix the debug code
so it actually works.

(Bitbake rev: 8ea6d8193fc89b4596da69e400fbc50e5a443f9f)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00
Richard Purdie
b051b819bd bitbake: runqueue: Simplify scenequeue unskippable calculation
The existing code to compute the 'unskippable' setscene task list is overcomlicated,
so replace it with something functionally equivalent but simpler and more efficient.

We don't need to process all chains, just the 'top' ones to the first setscene tasks.

This also makes the code more readable.

(Bitbake rev: 06982c82f10cbdbea0b601e5cf0450a2a99c14c2)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00
Richard Purdie
376aa786cd bitbake: runqueue: Add covered_tasks (or 'collated_deps') to scenequeue data
Its useful to have a list of all the tasks a given setscene task covers
and we can easily generate this data whilst doing other data processing.

This is used in later changes to runqueue rather than trying to compute it
on the fly which is difficult.

(Bitbake rev: 63ddc2fec40bd1b456702b97091f9dc5ef70a941)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00
Richard Purdie
fb8fc5e78c bitbake: event/runqueue: Drop StampUpdate event, its pointless/unused
Whilst this class has existed for years, it doesn't have any
users and has a questionable interface. Drop it to allow for further
simplification and changes.

(Bitbake rev: 3ab51764f7965d696bb2c5a872bf161473df4289)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00
Richard Purdie
97fda91810 bitbake: runqueue: Fold remains of the scenequeue setup into RunQueueExecute
Also move the scheduler init over, apart for the builtable tasks part which need
to remain called later.

(Bitbake rev: ad30a16cd30f9eab0224eb271f98f9a24516b621)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00
Richard Purdie
b4c6a2d059 bitbake: runqueue: Simplify _execute_runqueue logic
Cleanup to the _execute_runqueue logic to reduce indentation, drop the
dummy executor class concept and prepare for further changes.

(Bitbake rev: 726e3c61a69fef16e605ba9b911a17cd99f1a2c3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00
Richard Purdie
d3d7163ab6 bitbake: runqueue: Remove RunQueueExecuteScenequeue and RunQueueExecuteTasks
Replace the remains of the Tasks and Scenequeue Tasks classes with simple
function calls. Also drop the dummy version of the execution class to
simplify further changes as its not needed.

(Bitbake rev: 33805394310046cd58c2194f6d063b3946811014)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00
Richard Purdie
9341a6c5d1 bitbake: runqueue: Fix counter/task updating glitch
Some tasks were not being marked as covered/notcovered since internal
calls were being made without using the external call points.

Fix the accounting issues by using the correct external call points.

(Bitbake rev: fe0a7be03e8baed22f6b0915cd5f7956ba3fbf83)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00
Richard Purdie
57c527d630 bitbake: runqueue: Merge scenequeue and real task queue code together
Merge the unique functions from the Tasks and Scenequeue Tasks classes
into the common base class.

(Bitbake rev: 7539fe22bc831bb835901e3aca77985ab4ebc4c7)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00
Richard Purdie
cfb7312b72 bitbake: runqueue: Merge stats handling together for setscene/real tasks
Use a seperate stats class for scenequeue tasks and move the setup
into the base class. Update references accordingly.

(Bitbake rev: 32f39bbd5d3b7394689da9ba05be2c15b4523b27)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00
Richard Purdie
dd7f09f471 bitbake: runqueue: Uniquely namespace the scenequeue functions
In preparation for merging the setscene and normal task execution,
uniquely namespace the scenequeue specific functions.

For the one shared function, add the "sq_live" variable so we know
which functions to send the results to.

(Bitbake rev: 2cbe9399902ba67dca566c7344b2247412cf4d5c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00
Richard Purdie
2c0d4b6816 bitbake: runqueue: Factor out the process_setscene_whitelist checks
For ease of refactoring, move this code to its own separate function
until it becomes clear what we should do with it.

(Bitbake rev: 4b96b204f986dd62fba485876b7208665c14268d)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00
Richard Purdie
2a3a81b422 bitbake: runqueue: Remove unused function parameter
The function is only used by setscene code so the parameter is pointless,
remove it.

(Bitbake rev: b52dbf5e9cb327f8434213d286ad333f5dbad1d3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00
Richard Purdie
a4dae1741b bitbake: runqueue: Move scenequeue data generation to a separate function
Move the bulk of the scenequeue data generation to its own function
allowing for refactoring of the code.

Create the start of an object to represent this data.

(Bitbake rev: 68326e0426f25a1bbfd5ae3aa278656a3744053e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00
Richard Purdie
76f64f94b3 bitbake: runqueue: Remove now uneeded code
With the removal of the setcene verify code, this additional code block
is also now unneeded since tasks can't be forced at this point in the code
any move. This effectively reverts f21910157d873c030b149c4cdc5b57c5062ab5a6.

(Bitbake rev: 4514fe4f045d595cc9b938f9326f66f2b3e99f71)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00
Richard Purdie
3911e74101 bitbake: runqueue: Drop unused BB_SETSCENE_VERIFY_FUNCTION2
Nothing in OE-Core uses this and hasn't since 2017. It wasn't needed by core
metadata since the switch to recipe specific sysroots.

Since this function would be hard to implement with the planned changes to
runqueue, drop it which allows simplification and further code cleanup.

(Bitbake rev: 5deaa5df730a8a846f3192b4a639b7a2a72c1b71)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00
Richard Purdie
217094844c bitbake: runqueue: Tweak buildable variable handling in scheduler
Work off a copy of the 'buildable' class variable, allowing easier
future code changes.

(Bitbake rev: e851169acfebba404514135bf512e6f045739a13)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00
Joshua Watt
4fd9ee4670 bitbake: bitbake: Add --skip-setscene option
Adds an option to skip _setscene only if they would normally be
executed, without ignoring sstate completely.

Previously, '--no-setscene' would allow a build that completely ignored
sstate and _setscene tasks, and '--setscene-only' would allow a build
that only ran _setscene tasks, but there was no option do a build that
would respect tasks previously restored from sstate and build everything
else. Now one can run:

 bitbake --setscene-only IMAGE; bitbake --skip-setscene IMAGE

which is functionally equivalent to:

 bitbake IMAGE

The indented use is to allow a build to complete successfully in the
presence of _setscene task failures by splitting apart the two phases
e.g.:

 (bitbake -k --setscene-only IMAGE || true) && bitbake --skip-setscene IMAGE

(Bitbake rev: 813ba5b7c13b573a0b813b628a819bdbf0627540)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-03 17:00:57 +01:00
Robert Yang
5161799993 bitbake: bitbake: lib: Cleanup /usr/bin/env python
(Bitbake rev: cc712f3257904960247a7532cfc4611f3dccd36c)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-06-28 13:29:04 +01:00
Richard Purdie
1f68b0bd98 bitbake: multiconfig: Switch from 'multiconfig' -> 'mc'
After real world use its clear the "multiconfig:" prefix to multiconfig tasks,
whilst clear, is also clumbersome. Switch to use the short version instead.

mcdepends will continue to work with "multiconfig:" for now as well. The commandline
will only accept mc: going forward.

[YOCTO #11168]

(Bitbake rev: 821daf093b76504067a8b77dfa4b181af6ec92b4)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-06-10 14:46:38 +01:00
Richard Purdie
9501864db8 bitbake: bitbake: Strip old editor directives from file headers
There are much better ways to handle this and most editors shouldn't need this
in modern times, drop the noise from the files. Its not consitently applied
anyway.

(Bitbake rev: 5e43070e3087d09aea2f459b033d035c5ef747d0)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04 10:44:10 +01:00
Richard Purdie
cf9c0be3f6 bitbake: bitbake: Drop duplicate license boilerplace text
With the introduction of SPDX-License-Identifier headers, we don't need a ton
of header boilerplate in every file. Simplify the files and rely on the top
level for the full licence text.

(Bitbake rev: 695d84397b68cc003186e22f395caa378b06bc75)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04 10:44:10 +01:00
Richard Purdie
79834a7144 bitbake: bitbake: Add initial pass of SPDX license headers to source code
This adds the SPDX-License-Identifier license headers to the majority of
our source files to make it clearer exactly which license files are under.

The bulk of the files are under GPL v2.0 with one found to be under V2.0
or later, some under MIT and some have dual license. There are some files
which are potentially harder to classify where we've imported upstream code
and those can be handled specifically in later commits.

The COPYING file is replaced with LICENSE.X files which contain the full
license texts.

(Bitbake rev: ff237c33337f4da2ca06c3a2c49699bc26608a6b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04 10:44:04 +01:00
Robert Yang
5c5a0938de bitbake: bitbake-diffsigs: Use 4 spaces as indent for recursecb
It used 2 spaces as indent which wasn't clear enough, and might cause
confusions, people might think it was in wrong format.

Fixed:
$ bitbake bc-native -ccleansstate -Snone
$ bitbake bc-native -ccleansstate -Snone
$ bitbake-diffsigs tmp/stamps/x86_64-linux/bc-native/1.07.1-r0.do_cleansstate.sigdata.*

* Before:
Hash for dependent task bc/bc_1.07.1.bb.do_clean:virtual:native changed from [foo]
  Taint (by forced/invalidated task) changed from [foo]
Taint (by forced/invalidated task) changed from [foo]

* Now
Hash for dependent task bc/bc_1.07.1.bb.do_clean:virtual:native changed from [foo]
    Taint (by forced/invalidated task) changed from [foo]
Taint (by forced/invalidated task) changed from [foo]

(Bitbake rev: 5127a8d8e6d53f5f43a6ada7fd09b6b0c24ae989)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-04-23 23:30:45 +01:00
Richard Purdie
0b19e52b85 bitbake: runqueue: Filter out multiconfig dependencies from BB_TASKDEPDATA
The consumers of BB_TASKDEPDATA in OE metadata can't cope with multiconfig
dependencies. The choice is either to start adding code to each of them to
filter out multiconfig dependencies, or do this at source.

After consideration we've decided to do this at source as doing otherwise
is code duplication and error prone and in any case we've looked at, they
don't make sense.

[YOCTO #13090]
[YOCTO #13130]

(Bitbake rev: 531dcd221a10853f45cc057b52bb2d5083e0ee42)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 10:43:31 +00:00
Richard Purdie
8dac3ce424 bitbake: runqueue: Fix dependency loop analysis 'hangs'
Currently the mechanism for breaking out of the dependnecy loop analysis
code is broken and doesn't work leading to bitbake appearing to hang.

Add in a custom exception for this purpose and fix the code to exit
as intended, fixing the hang and making the dependency loop code
usable again.

(Bitbake rev: 8756e4ade67c16e35269ea0659e10b9ebaa6117f)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-17 10:20:21 +00:00
Joshua Watt
9025bd11ec bitbake: bitbake: Allow arguments in FAKEROOTCMD
Changes FAKEROOTCMD so that it can accept additional arguments to pass
to the fakeroot implementation instead of being treated as a simple
command

(Bitbake rev: 4fa51afb56b090cf1f746842acd602c9536715d5)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-15 08:18:19 +00:00
Robert Yang
34ce32a75b bitbake: bitbake: runqueue: __find_md5__ -> __find_sha256
Fixed:
Create a new build
$ bitbake quilt-native -ccleansstate -Snone
$ bitbake quilt-native -ccleansstate -Sprintdiff

[snip]
     latestmatch = sorted(matches.keys(), key=lambda f: matches[f])[-1]
>    prevh = __find_md5__.search(latestmatch).group(0)
     output = bb.siggen.compare_sigfiles(latestmatch, match, recursecb)
AttributeError: 'NoneType' object has no attribute 'group'

(Bitbake rev: 15d20d948359fa1d7a7a754b2a1d8ed9f4ca0480)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-01-14 11:36:49 +00:00
Joshua Watt
46f6f6a5f9 bitbake: bitbake: runqueue: Use multiconfig name to fetch unihash
The unihash should be fetched using the task filename that includes the
multiconfig prefixes.

[YOCTO #13124]

(Bitbake rev: 5e7f4e77e27bceaf6c68137cacb4f8d7d7de49dd)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-01-11 10:39:30 +00:00
Joshua Watt
445acdffe0 bitbake: runqueue: Pass unique hash to hash validate
If the unique hash is being used to track task dependencies, the hash
validation function needs to know about it in order to properly validate
the hash.

[YOCTO #13030]

(Bitbake rev: 9a529bb2658a4046dafbf32e1eb503d84e64e947)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-01-03 22:47:11 +00:00
Joshua Watt
3b5bdb227b bitbake: runqueue: Pass unique hash to task
The unique hash is now passed to the task in the BB_UNIHASH variable

[YOCTO #13030]

(Bitbake rev: aab80b099f6f259e4b57cba2c26dd385d07c5947)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-01-03 22:47:11 +00:00
Joshua Watt
57e3c55f6d bitbake: runqueue: Track task unique hash
Requests the task unique hash from siggen and tracks it

[YOCTO #13030]

(Bitbake rev: 1ecc47f0831b35c8c92b37a81cef4e43ff9f67b2)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-01-03 22:47:11 +00:00
Joshua Watt
86cc1a4104 bitbake: bitbake-worker: Pass taskhash as runtask parameter
Pass the task hash as a parameter to the 'runtask' message instead of
passing the entire dictionary of hashes when the worker is setup. This
is possible less efficient, but prevents the worker taskhashes from
being out of sync with the runqueue in the event that the taskhashes in
the runqueue change.

[YOCTO #13030]

(Bitbake rev: 1e86d8c1bec7ea5d016a5ad2097f999362e29033)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-07 12:38:58 +00:00
Richard Purdie
c5ca140d38 bitbake: runqueue: Ensure disk monitor is started when no setscene tasks are run
Currently if there are no setscene tasks, the disk monitor isn't started.

Move the startup code to somewhere to ensure it always is started. This
issue would partially explain occasional selftest failures.

(Bitbake rev: 5ba83ee25c1c9cba349edb68a22476b1d5fca6ce)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-01 11:32:08 +00:00
Richard Purdie
530aceebc1 bitbake: runqueue: Ensure setscene tasks that aren't covered get built
Running "bitbake gconf-native -c cleansstate; bitbake core-image-sato:do_populate_sdk"

results in a build where it fails to find gconf-native and fails to build it,
merrily trying to build the SDK without gconf being present.

The issue is the missing setscene tasks are effectively ignored as the later
code in runqueue thinks that since other sstate tasks are present, these
'cover' the missing one. In reality we need to call BB_SETSCENE_DEPVALID
to make that decision. To do that we need a "reduced" setscene dependency
graph which we don't have in main task graph context.

Since that was already done in setscene, we should just assume anything
in the non-covered list needs to be built.

(Bitbake rev: 464d0339add15bc8b4344ddd1e4c49706e3c0a02)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-09-10 12:13:38 +01:00
Richard Purdie
479a059c96 bitbake: cooker/runqueue: Turn universe warnings into verbnotes
If the user puts universe on the commandline, they don't really want warnings
so use the new verbnote level instead.

(Bitbake rev: 0c87ade5678e503899e3a6cdda5329f6fc212b63)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-09-10 12:13:38 +01:00
Andreas Müller
331463011f bitbake: runqueue: Move decision if a task can be started to one common place
(Bitbake rev: 99d9e4389e1f1d78d17a23ee078fe3f4a12cb31d)

Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-15 21:45:58 +01:00
Richard Purdie
dbda297fd9 bitbake: runqueue: Allow the hash validate function to have an idea of build completion
There is an oversight in the current hash validation API in that the
function can't know how many setscene tasks already completed. Rather
than trying to add additional parameters to the function, causing
incompatibilities, store the value in the datastore.

This is useful to allow build status reporting to the user for
figures on sstate reusage and build completion.

(Bitbake rev: ec037d3e49264037b81212f498d98e292ae7c334)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-08 10:52:00 +01:00
Alejandro Enedino Hernandez Samaniego
b8730f68d2 bitbake: bitbake: Add support for multiconfig dependencies
This patch adds the capability for tasks from different
multiconfigs to depend on one another.

These dependencies can be enabled using the following format:

task[mcdepends] = "multiconfig:FROM-MC:TO-MC:PN:task-to-depend-on"

For the sake of simplicity consider the following example:

Assuming we have set up multiconfig builds, one for qemux86 and one for
qemuarm, named x86 and arm respectively.

Adding the following line to an image recipe (core-image-sato):
do_image[mcdepends] = "multiconfig:x86:arm:core-image-minimal:do_rootfs"

Would state that core-image-sato:do_image from x86 will depend on
core-image-minimal:do_rootfs from arm so it can be executed.

This patch makes modifications to:
- cooker: To glue both multiconfigs in one place and make sure
  the dependencies can be provided.
- taskdata: To parse and add a new kind of dependency (mcdepends) to
  the taskdata object.
- runqueue: To differentiate tasks from different multiconfigs,
  add the specified dependencies to the corresponding tasks, and
  create a working runqueue that contains tasks from both multiconfigs.
- siggen: To avoid looking for tasks from different multiconfigs on
  objects where they dont belong.

The taskdata objects are still not aware of the concept of multiconfig,
so each object doesnt know which multiconfig its building, hence why
the mcdepends are added to all taskdata objects equally (we really
dont expect many of these), but the actual dependencies are added only
to the required tasks by the runqueue.

(Bitbake rev: da8cb8633504bdc815bdcefc538340b9bce5065d)

Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr@xilinx.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-01 10:07:22 +01:00
Joshua Watt
9b034e9a83 bitbake: runqueue: Stop on first unsatisfied dependency
(Bitbake rev: 9876b5da1c65bf09a790542cb4057f2d93868cf7)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-09 11:26:56 +01:00
Joshua Watt
53d1027625 bitbake: runqueue: Remove unused variable
(Bitbake rev: 91e5540f53aca93e3489255cfd95feaa0afd0498)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-09 11:26:56 +01:00
Joshua Watt
714f2f5bae bitbake: runqueue: Remove trailing whitespace
(Bitbake rev: 9b9aecbbb1a3fa67f7d3b1669186c9f4ced3a590)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-09 11:26:56 +01:00
Ming Liu
7cb125d7ee bitbake: runqueue.py: Fix a virtual class extension stamps issue
The file_name parameter passed to bb.parse.siggen.invalidate_task
should be a virtual file name instead of a real file name, or else you
will encounter a following error, for instance, when you run:

$ bitbake nativesdk-lzip -c unpack -f

the error arise:
| ERROR: An uncaught exception occurred in runqueue
| if file_name:
|    > taintfn = d.stamp[file_name] + '.' + task + '.taint'
| else:
| KeyError: 'virtual:nativesdk:/opt/poky/meta/recipes-extended/lzip/lzip_1.19.bb'

when multilib builds are used on OE.

(Bitbake rev: da37bdad46e11e7ce93ba7a59d58757b769dc16b)

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-02 21:38:06 +01:00
Mark Hatle
a0cb1021c0 bitbake: runqueue.py: Initial implementation of per task process limits
On high core machines, in do_fetch, it is possible to DDoS your own machine.
A method to limit any arbitrary task type to a certain number of simultaneous
threads is needed.  (Similar to how BB_NUMBER_THREADS works in the general
case.)  The format of this new limitation is:

    do_fetch[number_threads] = "2"

This should be set globally.  If it is set in individual recipes it could
result in unpredictable behavior.

Note: a value for number_threads > BB_NUMBER_THREADS will have no effect.

(Bitbake rev: 055865047c63b9c3b213b47a1884924ce0adeda0)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-06-15 17:57:30 +01:00
Mark Hatle
27101e647f bitbake: runqueue.py: Minor cleanup for RunQueueStats and users
The RunQueueStats:taskCompleted and RunQueueStats:taskSkipped can take
multiple arguments.  However, nowehere in bitbake are multiple arguments used.
Change this to match the behavior of the other APIs where it needs to be
called once for each task.

Additionally, these two functions were usually called in tandem, however in
the wrong order.  It really doesn't matter as there is no specific preemption
point between the calls.  But the taskSkipped should be called first to
increment the 'active' count, and then taskCompleted called to decrement it.

(Bitbake rev: 26d5ea9bb892bd6a2e1fd29a9023e0b0644edc16)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-06-15 17:57:30 +01:00
Richard Purdie
4bc71faf76 bitbake: runqueue: Ensure only recursive task dependencies are pruned
If a standalone tasks adds a dependency on X:do_build, the code in runqueue would
currently remove it if that do_build was part of an image recipe which uses
recrdeptask on do_build.

Such individual tasks shouldn't do this, therefore tweak the recursive reference code
to only process recurseive tasks, not all tasks.

(Bitbake rev: 4cfca360891e1ed876a9c19487b4f6210686af26)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-01 22:14:12 +00:00
Richard Purdie
c75985f40a bitbake: main/runqueue: Rework runall task and add runonly option
The runall commandline option was confusing people. There are in fact two
different behaviours people may want.

a) For a given target (or set of targets) look through the task graph and
run task X only if its present and would have been built.

b) For a given target (or set of targets) look through the task graph and
run task X if any recipe in the taskgraph has such a target even if it wasn't
in the original task graph.

I've decided to interpret the existing "runall" option as b), even if right
now if behaves like a). For a), which is a valid use case, this patch adds
a "runonly" option.

With both behaviours present, I'm hoping we can then kill off the "fetchall",
"checkuriall" and other tasks from OE metadata and replace them with this
option. This would significantly speed up task graph processing.

(Deleting the checkuriall and fetchall tasks takes "bitbake core-image-sato -g"
from 22s to 8s).

(Bitbake rev: 546a662c877b2d3af35e3996950582ed2df41fe4)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-14 15:26:03 +00:00
Richard Purdie
dafa1ac864 bitbake: runqueue: Rewrite and optimize recrdepends handling
This is a performance sensitive piece of code and the shear number
of recursive loops is causing a significant and unscalable performance
pain point.

This change moves to a two step approach, firstly generating a list of recursive
dependencies for any task, then applying this to the recursive tasks, iterating
over things until no further dependencies are added.

It was noticed an optimisation is possible and the list of recursive tasks need not
contain the taskname, only the base task id. This allows a significant performance
improvement and limits the size of the resursive task lists, improving speed.

(Bitbake rev: eba738ac5672556eaab4f3374c8025c322761c4a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-06 11:06:30 +00:00
Richard Purdie
2ae62f0d2b bitbake: runqueue: Optimize recrdepends handling
We can optimise the loops slightly so we only process given substrings
once rather than many times. This means expanding out add_resolved_dependencies.

Also add a function which allows replacement of the task element of a
task id, reducing the amount of string handling we're doing in a performance
critical loop.

Its also clear that later code adds to the tasks depends so we don't need
to add .depends() to extradeps at the start.

(Bitbake rev: 4ad281224e92b5f94e3a9c17e8898ec8f1086cdc)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-06 11:06:30 +00:00
Richard Purdie
38fd8bbb7f bitbake: runqueue: Remove unused variables
(Bitbake rev: 7e56c285f5ebae9b4b367514e60e3a6ba8cd5693)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-06 11:06:30 +00:00
Richard Purdie
0899c332f7 bitbake: runqueue: Fix recidepends handling
Currently we only run through the recidepends/recrdepends code once. This
means that we can miss some expansions of dependency trees where one
rec{r,i}depends tasks depends on another rec{r,i}depends task.

In reality we need to iterate over the data until we stop adding
dependencies.

In doing this we can't show quite so granular progress information since
we don't know how many times we'll need to do this.

This does slow down the runqueue prepare phase however some optimisations
are possible and can be handled in subsequent patches.

This fix means some missing dependencies, such as:

<image>:do_fetchall -> <image>:do_rootfs -> <pkgs>:do_package_write_X
  -> <ca-certs>:do_package_write_X -> debianutils-native
(via PAKAGE_WRITE_DEPS)

are now found/added.

[YOCTO #12510]

(Bitbake rev: aec2f07d56a19b97b6515897532b113cdead8338)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-06 11:06:30 +00:00
Richard Purdie
b77321ab24 bitbake: runqueue: Fix typo builable -> buildable
(Bitbake rev: 1e59ae8729513e19a801c723b67911491c2a66fe)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-21 13:06:45 +00:00
Paul Eggleton
1bb49ce322 bitbake: runqueue: fix BB_SETSCENE_ENFORCE with empty BB_SETSCENE_ENFORCE_WHITELIST
The whitelist shouldn't have to be populated in order for the
enforcement to work properly - check if the list is not None in order to
determine whether the functionality is enabled or not since that is how
the function that sets up the list behaves.

(Bitbake rev: 7b1e79c352ca6eef1693d8abfacf7505544f1caa)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-12 23:55:29 +01:00
Richard Purdie
2355a9b6f0 bitbake: cookerdata/taskdata/runqueue: Drop remaining tryaltconfigs code and commandline option
I can't actually see how this was working, nothing connected the commandline option
to the data in TaskData(). Drop the remaining pieces of this option, it was a relic
from a decade ago and we want deterministic builds, not random tries until something
might work.

(Bitbake rev: 767c7ba8fc76ec667ac1567de1c971c3575f2ecd)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-02 00:52:10 +01:00
Richard Purdie
3f71378fde bitbake: runqueue: Tweak debug message to make it more readable/diffable
Having this as one huge long line isn't easy to manipulate, split it into
multiple lines for ease of debugging issues.

(Bitbake rev: 5753fe81194f75fbcf4ccdc733cc585d02794cb1)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-31 15:13:53 +01:00
Paul Eggleton
21bb330f46 bitbake: lib/bb/event: refactor printing events
We really ought to have just one place where the string representation
of these events is produced. This doesn't take any real control away
from the UI - if an alternative representation is desired, that can
still be made.

(Bitbake rev: cb15db2a799be6d8eab9a2a43a9a573f89229cff)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21 08:41:12 +01:00
Juro Bystricky
68847d9ab5 bitbake: bitbake: runqueue: multiconfig fix
Differentiate between fn and taskfn in "execute".
This was somehow missed in "fakeroot" handling.

(Bitbake rev: d848bff7cf78f63986467b51f701a998a480eb25)

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-14 14:54:24 +01:00
Richard Purdie
ee0ef7d13c bitbake: runqueue: Allow recrdeptask not to exist for all recipes
Currently if you specify a recrdeptask, it must exist for all recipes or
you get a python traceback. This is a bug and it should be possible to have
recipes which don't have the specified task.

As well as preventing such a traceback (which shouldn't happen, it should be
a user readable error), this allows us to fix issues in OE-Core which would
otherwise trigger the traceback.

(Bitbake rev: f93a77f2f188e18de9e3d812e86d77c2f3c71889)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-10 23:00:32 +01:00
Andre McCurdy
812fabbd30 bitbake: runqueue: minor typo fix
(Bitbake rev: f2c151cd345788a135452f63f622a2bc0b10c2d4)

Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-15 17:38:33 +00:00
Matthew McClintock
404f2aef94 bitbake: runqueue: add option to run all tasks in specific build target
For example:

$ bitbake core-image-minimal --runall unpack
...
NOTE: Tasks Summary: Attempted 326 tasks of which 88 didn't need to be rerun and all succeeded.

$ bitbake core-image-minimal --runall patch
NOTE: Tasks Summary: Attempted 453 tasks of which 332 didn't need to be rerun and all succeeded.

This can replace fetchall as well:
$ bitbake core-image-minimal --runall fetch
NOTE: Tasks Summary: Attempted 135 tasks of which 119 didn't need to be rerun and all succeeded.

(Bitbake rev: 7c0fa6ba66cdb956b37d94055307cde857633df9)

Signed-off-by: Matthew McClintock <msm-oss@mcclintock.net>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-13 09:43:40 +00: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
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
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
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
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
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
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
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
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
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
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
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
Randy Witt
a75bccdd14 bitbake: runqueue.py: Remove redundant whitelist checks
The whitelist checks for BB_SETSCENE_ENFORCE were running for every call
to execute(). Since the task list doesn't change for each call into
execute, the checks only need to be ran once.

[YOCTO #10369]

(Bitbake rev: f65e631ab6705dfd9188f19ee423eca33bca7d7d)

Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-10-11 23:43:16 +01:00
Richard Purdie
77e56194dc bitbake: runqueue: Optimise task id string manipulations
Some task id manipulations were suboptimal:

* taskfn_fromtid and fn_from_tid were effectively the same function
* many calls to split_tid(), then taskfn_fromtid()
* taskfn_fromtid() called split_tid() internally

This patch adds split_tid_mcfn() to replace split_tid() and returns the
"taskfn" variant being used in many places. We update all core calls
to the new function and ignore the return values we don't need since the
function call overhead of the split_tid wrapper is higher than ignoring
a return value.

The one remaining standalone use of taskfn_fromtid is replaced with
fn_from_tid. I couldn't see any external usage so it was dropped.

There is external usage of split_tid so a wrapper remains for it.

Combined together these changes should improve some of the runqueue task
manipulation performance.

(Bitbake rev: 1bf2ef874fbe47f1320007efa0bdeef8d630b8a1)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-10-09 12:33:26 +01:00
Christopher Larson
f4366293ff bitbake: bb.runqueue: fix unexpected process death logic
`if w in self.rq.worker` when w *is* self.rq.worker doesn't make a great deal
of sense, and results in this error:

      File ".../poky/bitbake/lib/bb/runqueue.py", line 2372, in runQueuePipe.read():
                             name = None
        >                    if w in self.rq.worker:
                                 name = "Worker"
    TypeError: unhashable type: 'dict'

Most likely this was meant to be 'is' rather than 'in', but rather than
checking after the fact, just include the name in the iteration, instead.

While we're here, also clean up and fix the broken error message.

(Bitbake rev: 267e025cad44c8bd0fb157f1f7a2e08df117ba84)

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-10-09 12:33:26 +01:00
Richard Purdie
0b17e6d32c bitbake: runqueue: Ensure worker failure is accounted for in task statistics
If the worker fails to launch, ensure the task is shown as failed rather
than a confusing "all succeeded" message.

Patch from Juro Bystricky

[YOCTO #10335]

(Bitbake rev: 0e9a2ff96d138641501874a1cd7aa6cc7e94d727)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-30 16:52:21 +01:00
Richard Purdie
d3e6e1054c bitbake: runqueue: Handle missing sstate dependencies better
If you "bitbake glibc-locale" then delete the libpcre-native sstate
and "bitbake glibc-locale -C package_write_rpm", it will fail with
rpmbuild missing the libprce library.

The reason is that libpcre-native fails to install from sstate (since
it isn't present) but doesn't get built and hence rpm-native tries to
run without its dependencies.

The simplest fix is not to add "covered" tasks which have failed to
install sstate. I can't help feeling there is more to this issue but
this does fix the current problem and shouldn't have adverse affects.
It is an unusual situation to have missing dependencies in sstate since
they're usually all present or not at all.

I've taken the opportunity to remove some old cruft from when we had
numeric task ids, the code can be simpler now.

(Bitbake rev: ba566b46d530b495f12f3a74f76434717b22a020)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-21 21:58:06 +01:00
Richard Purdie
412a26e154 bitbake: build/runqueue: Add noextra stamp file parameter to fix multiconfig builds
We can't execute the same task for the same package_arch multiple
times as the current setup has conflicting directories. Since
these would usually have the same stamp/hash, we want to execute in
sequence rather than in parallel, so for the purposes of task execution,
don't consider the "extra-info" on the stamp files. We need to add
a parameter to the stamp function to achieve this.

This avoids multiple update-rc.d populate_sysroot tasks executing in
parallel and breaking multiconfig builds.

(Bitbake rev: a9041fc96a14e718c0c1d1676e705343b9e872d3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-02 18:09:49 +01:00
Richard Purdie
218b81acb6 bitbake: bitbake: Initial multi-config support
This patch adds the notion of supporting multiple configurations within
a single build. To enable it, set a line in local.conf like:

BBMULTICONFIG = "configA configB configC"

This would tell bitbake that before it parses the base configuration,
it should load conf/configA.conf and so on for each different
configuration. These would contain lines like:

MACHINE = "A"

or other variables which can be set which can be built in the same
build directory (or change TMPDIR not to conflict).

One downside I've already discovered is that if we want to inherit this
file right at the start of parsing, the only place you can put the
configurations is in "cwd", since BBPATH isn't constructed until the
layers are parsed and therefore using it as a preconf file isn't
possible unless its located there.

Execution of these targets takes the form "bitbake
multiconfig:configA:core-image-minimal core-image-sato" so similar to
our virtclass approach for native/nativesdk/multilib using BBCLASSEXTEND.

Implementation wise, the implication is that instead of tasks being
uniquely referenced with "recipename/fn:task" it now needs to be
"configuration:recipename:task".

We already started using "virtual" filenames for recipes when we
implemented BBCLASSEXTEND and this patch adds a new prefix to
these, "multiconfig:<configname>:" and hence avoid changes to a large
part of the codebase thanks to this. databuilder has an internal array
of data stores and uses the right one depending on the supplied virtual
filename.

That trick allows us to use the existing parsing code including the
multithreading mostly unchanged as well as most of the cache code.

For recipecache, we end up with a dict of these accessed by
multiconfig (mc). taskdata and runqueue can only cope with one recipecache
so for taskdata, we pass in each recipecache and have it compute the result
and end up with an array of taskdatas. We can only have one runqueue so there
extensive changes there.

This initial implementation has some drawbacks:

a) There are no inter-multi-configuration dependencies as yet

b) There are no sstate optimisations. This means if the build uses the
same object twice in say two different TMPDIRs, it will either load from
an existing sstate cache at the start or build it twice. We can then in
due course look at ways in which it would only build it once and then
reuse it. This will likely need significant changes to the way sstate
currently works to make that possible.

(Bitbake rev: 5287991691578825c847bac2368e9b51c0ede3f0)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-08-18 10:06:27 +01:00
Richard Purdie
0ef16f083e bitbake: runqueue: Abstract worker functionality to an object/array
With the introduction of multi-config and the possibility of distributed
builds we need arrays of workers rather than the existing two.

This refactors the code to have a dict() of workers and a dict of
fakeworkers, represented by objects. The code can iterate over these.

This is separated out from the multi-config changes since its separable
and clearer this way.

(Bitbake rev: 8181d96e0a4df0aa47287669681116fa65bcae16)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-08-18 10:06:26 +01:00
Paul Eggleton
1b6f701cd9 bitbake: runqueue: fix two minor issues with the initialising tasks progress
A couple of fixes for the "Initialising tasks" progress bar behaviour:
* Properly finish the progress bar when using bitbake -S
* Finish the progress bar before calling BB_HASHCHECK_FUNCTION (so that
  in OE when that shows its own "Checking sstate mirror object
  availability"  progress bar it gets shown on the next line as it
  should).

(Bitbake rev: de6759d8e9990e426e6d6464a2e05381cd4c12d6)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-08-17 10:22:58 +01:00
Ed Bartosh
844e1f9e1d bitbake: runqueue: improve exception logging
Runqueue errors direct the user to view the "failure below",
but no additional error message is available.

Log the stacktrace so that the user can see what went wrong.

Also fix a typo in the log message.

(Bitbake rev: e191f401e372ee181bc02250232ad9cb9a0e9477)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: bavery <brian.avery@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-19 08:56:51 +01:00
Paul Eggleton
1b930b41a5 bitbake: runqueue: report progress for "Preparing RunQueue" step
When "Preparing RunQueue" shows up you can expect to wait up to 30
seconds while it works - which is a bit long to leave the user waiting
without any kind of output. Since the work being carried out during this
time is divided into stages such that it's practical to determine
internally how it's progressing, replace the message with a progress
bar.

Actually what happens during this time is two major steps rather than
just one - the runqueue preparation itself, followed by the
initialisation prior to running setscene tasks. I elected to have the
progress bar cover both as one (there doesn't appear to be much point in
doing otherwise from a user perspective). I did however describe it as
"initialising tasks".

(Bitbake rev: 591e9741e108487ff437e77cb439ef2dbca42e03)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-08 09:57:27 +01:00