Merge "Enable simple modification of git repo location"

This commit is contained in:
Jenkins 2014-02-28 04:32:29 +00:00 committed by Gerrit Code Review
commit 4a45704edf
2 changed files with 18 additions and 0 deletions

View file

@ -81,3 +81,11 @@ of the repositories (by users or by other elements).
The repository names and types are written to an environment.d hook script at
01-source-repositories-environment. This allows later hook scripts during the
install.d phase to know which install type to use for the element.
The base url for all git repositories can be set by use of:
DIB_GITREPOBASE
So setting DIB\_GITREPOBASE=https://github.com/ when the repo location is set
to http://git.openstack.org/openstack/nova.git will result in use of the
https://github.com/openstack/nova.git repository.

View file

@ -46,6 +46,16 @@ function get_repos_for_element(){
case $REPOTYPE in
git)
if [ -z "${!REPOLOCATION_OVERRIDE:-""}" -a -n "${DIB_GITREPOBASE:-""}" ] ; then
# Transform the current repo base to the new one
local NEW_REPOLOCATION=$(echo $REPOLOCATION |\
sed "s,^[^:]\+://[^/]\+/\(~[^/]\+\)\?\(.*\)$,${DIB_GITREPOBASE}\2,g")
echo "Transformed ${REPOLOCATION} to ${NEW_REPOLOCATION}"
REPOLOCATION=$NEW_REPOLOCATION
# Also update the cache location
CACHE_NAME=$(echo "${REPOTYPE}_${REPOLOCATION}" | sha1sum | awk '{ print $1 }' )
CACHE_PATH=~/.cache/image-create/repository-sources/$CACHE_NAME
fi
sudo mkdir -p $REPO_SUB_DIRECTORY
if [ ! -e "$CACHE_PATH" ] ; then