PROJ1664: Add ability to build a dependant build from lua

This patch adds a new command to the lua interface: invokebuild. invokebuild
 creates a new instance of buildsys and starts building a specified
target it with the parameters that are passed from lua. If the new instance
of buildsys exits due to an error it will causes the calling build to
exit as well. invokebuild will block calling build until it has been
completed.

Invocation of invokebuild from lua:

From lua configuration file
invokebuild('Target', feature('running-path'), feature('buildsyspp-path'),
{'--',
 'luabuild='..feature('luabuild'),
 'relname='..feature('relname')})


Target - target names a configuration file
runnning-path - path where configuration file exist
buildsyspp-path - location of buildsys++ executable
anything within the {} are arguments passed to the buildsys++ executable.

Output of the build will be of the following form:
Target-name: package: package build output

Reviewed-by: Mark Wutzke <mark.wutzke@alliedtelesis.co.nz>
PROJ1664: Change error messages to be more informative

This patch changes the exception messages returned to the user so they
now use invokebuild instead of cmd or invokeself.

Reviewed-by: Scott Parlane <scott.parlane@alliedtelesis.co.nz>
PROJ1164: Pass build options through to invoke build.

This change moves invokebuild so that it is now executed during the building
stage and not the pre prepossessing stage. This allows for faster builds
as two builds are run at the same time. Running two builds at the same time
does cause higher cpu usage.

The invoked build is now passing the build options from the parent buildsys
task. This allows functionality like the "--clean" to be handled in the
child build as well as any package filters.

After this change invokebuild will not require the buildsys path and the
path to the buildsys++ executable from lua.

Reviewed-by: Mark Wutzke <mark.wutzke@alliedtelesis.co.nz>
Reviewed-by: Scott Parlane <scott.parlane@alliedtelesis.co.nz>
Merge remote-tracking branch 'sbx8112_1664/master'

Reviewed-by: Scott Parlane <scott.parlane@alliedtelesis.co.nz>

Signed-off-by: Michael Moyle <michael.moyle@alliedtelesis.co.nz>
MAINT: Refactor location handling

The existing code had a lot of duplication for location handling,
and not all code supported the same locations, this is now fixed.

Reviewed-by: Mark Wutzke <mark.wutzke@alliedtelesis.co.nz>

Signed-off-by: Andrew Campbell <andrew.campbell@alliedtelesis.co.nz>
MAINT: Add mkdir function

Lots of packages are doing bd:cmd(path, 'mkdir', {'-p', dir})
so now they can do bd:mkdir(path, {dir}) and have the same result.

Reviewed-by: Mark Wutzke <mark.wutzke@alliedtelesis.co.nz>

Signed-off-by: Andrew Campbell <andrew.campbell@alliedtelesis.co.nz>
MAINT: Added unzip support

This patch added the ability to unzip zip files in lua.

The use case is the same as tar.* files:
bd:extract('dl/'..version..'.zip')

This will unzip the file specified into the work directory

Reviewed-by: Scott Parlane <scott.parlane@alliedtelesis.co.nz>

Signed-off-by: Scott Parlane <scott.parlane@alliedtelesis.co.nz>
MAINT: Add sed function

Lots of packages are doing bd:cmd(path, 'sed', {'-i','-e', pattern, file})
so now they can do bd:sed(path, pattern, {file}) and have the same result.

Reviewed-by: John Collis <john.collis@alliedtelesis.co.nz>
MAINT: Move interface commands to their own folder

 - Split bd interface commands into builddir.cpp
 - Other top level commands are moved to toplevel.cpp

Reviewed-by: Scott Parlane <scott.parlane@alliedtelesis.co.nz>

Signed-off-by: Scott Parlane <scott.parlane@alliedtelesis.co.nz>
MAINT: Remove some duplicate code

Moved some duplicate code to its own function.

Reviewed-by: Scott Parlane <scott.parlane@alliedtelesis.co.nz>

Signed-off-by: Scott Parlane <scott.parlane@alliedtelesis.co.nz>
MAINT: Don't use absolute paths for running configure

This causes configure to use absolute paths for access to source code
which is known to break at least novaprova.

Reviewed-by: John Collis <john.collis@alliedtelesis.co.nz>

Signed-off-by: Andrew Campbell <andrew.campbell@alliedtelesis.co.nz>
MAINT: colorize warnings/errors

This makes it easier to see errors, warnings etc especially with the
huge output from parallel compiling.

Reviewed-by: Brad Carthew <brad.carthew@alliedtelesis.co.nz>
MAINT: Only reset color when color has been set

Reviewed-by: Scott Parlane <scott.parlane@alliedtelesis.co.nz>

Signed-off-by: Andrew Campbell <andrew.campbell@alliedtelesis.co.nz>