Enable simple modification of git repo location
Add the DIB_GITREPOBASE variable to the source-repositories element to enable global changing of git repository location. Change-Id: Icfac5e103fce6e5a3f1a2db094144a0ed89fcc33
This commit is contained in:
parent
61d474f2cd
commit
0edfcf6587
@ -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
|
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
|
01-source-repositories-environment. This allows later hook scripts during the
|
||||||
install.d phase to know which install type to use for the element.
|
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.
|
||||||
|
@ -46,6 +46,16 @@ function get_repos_for_element(){
|
|||||||
|
|
||||||
case $REPOTYPE in
|
case $REPOTYPE in
|
||||||
git)
|
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
|
sudo mkdir -p $REPO_SUB_DIRECTORY
|
||||||
|
|
||||||
if [ ! -e "$CACHE_PATH" ] ; then
|
if [ ! -e "$CACHE_PATH" ] ; then
|
||||||
|
Loading…
Reference in New Issue
Block a user