Refactor individual run-test build scripts

Follow the same convention as run-test run scripts.

The python files shall export build function,
rather than doing the work when the script is loaded.

This has the advantage that we now pass context/arguments
to the function (rather than using environment variables).

Test: the generated build artefacts are identical
Change-Id: I90e0ef0d2e31b27813042d51d07b5ae132e1e704
64 files changed