runqueue.py: Fix a stamp comparision bug

We check the stamp cache before comparing t2 and t3 which means that we can miss
a level in the stamp file chains. The result of this is that a stamp can be accepted
as valid when in fact it isn't. Some weird behaviour alerted me to this in a local
build.

This patch also fixes to only uses the cache in recurse mode, there was a corner
case where stamps not in recurse mode could get added to the cache which could cause
an issue potentially.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
runqueue.py: Gracefully exit if an exception occurs in the runqueue execution code

There was a bug where an exception in the runqueue code would cause an infinite loop
of debug messages. The exception would get reported but would loop since runqueue was
still registered as an idle handler.

This patch adds an exception handler to ensure in the case of errors, the system
more gracefully shuts down and doesn't loop.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
runqueue.py: Optimise the hashvalidate call to only process tasks we may actually want

Currently we call the hashvalidate for anything without a valid setscene stamp.
This improves the code to account for existing stamp files so that we only process
setscene hashes for things we might actually end up using. This avoids hash processing
and makes things slightly more efficient and the logs less confusing.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
runqueue.py: Ensure one setscene function doesn't mask out another which needs to run

The scenequeue code could result in one setscene function masking out another
which had been marked as notcovered. This change ensures the notcovered list
is taken into account when deciding which tasks need to be run, ensuring
that tasks that should be run do get run.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
runqueue.py: Allow the setsceneverify function to have a list of tasks that are invalid and need to run

There was some odd behaviour if some task was run from setcene whilst there were
existing valid stamps for a depepdency. For example, do_populate_sysroot might
be installed at setscene time but if there were other tasks not installed from
setscene such as do_populate_lic which depend on do_configure, the setsceneverify
function would think that do_configure needed to be rerun and would hence void the
do_populate_sysroot and force that to rerun too.

The setsceneverify function needs to know which tasks are going to be rerun, not just
what the overall task list is and what setscene functions have run. This patch adds
that information and maintains backwards compatibility in a slightly ugly but effective
way. The metadata needs updating to take advantage of this change.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
runqueue.py: Wipe out the stamp cache between setscene and main task execution

The stamp files can change during setscene and the cache should be cleared to
account for this.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
fetch/local: Allow preservation of path components in relative file:// urls

This enhances the fetcher to allow preservation of the path component in urls
like: file://xxx/yyy/somefile.patch.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>