Improve the way upstream repositories are used.

Previously, 'upstream' would just use the url 'latest'. However, that
leads to instability, as if you repeated the build downstream you might
get 2 different builds, and it's difficult to see why one might fail.

Instead, stamp into the build the exact repository, so this can be
successfully traced. Also fix the repositoryChain behaviour.


Signed-off-by: Nigel Magnay <nigel.magnay@gmail.com>