Replace more then just "-" in REPONAME

Looks like shells only support alphanumeric characters and "_"'s in
environment variables. We were substituting "-" characters but in
order to be able to set overrides in projects with names containing
other characters we need to substitute more, I'm looking at you
oslo.config.

Change-Id: I3e2b1b0bc5871e4ec4ffd8117906cd077aa2cb0d
Co-authored-by: James Polley <jp@jamezpolley.com>
This commit is contained in:
Derek Higgins 2014-02-26 22:22:40 +00:00 committed by James Polley
parent 61d474f2cd
commit 0226cf2246
2 changed files with 12 additions and 4 deletions

View File

@ -23,9 +23,17 @@ diskimage-builder which can change the details registered by the element, these
DIB_REPOLOCATION_<name> : change the registered location DIB_REPOLOCATION_<name> : change the registered location
DIB_REPOREF_<name> : change the registered reference DIB_REPOREF_<name> : change the registered reference
for example if you would like diskimage-builder to get ironic from a local For example if you would like diskimage-builder to get ironic from a local
mirror you could set DIB_REPOLOCATION_ironic=git://localgitserver/ironic.git mirror you could set DIB_REPOLOCATION_ironic=git://localgitserver/ironic.git
*As you can see above, the \<name\> of the repo is used in several bash
variables. In order to make this syntactically feasible, any characters not in
the set \[A-Za-z0-9_\] will be converted to \_*
*For instance, a repository named "diskimage-builder" would set a variable called
"DIB_REPOTYPE_diskimage_builder"*
Alternatively if you would like to use the keystone element and build an image with Alternatively if you would like to use the keystone element and build an image with
keystone from a stable branch then you would set DIB_REPOREF_keystone=stable/grizzly keystone from a stable branch then you would set DIB_REPOREF_keystone=stable/grizzly

View File

@ -29,15 +29,15 @@ function get_repos_for_element(){
local REPO_SUB_DIRECTORY=$(dirname $REPO_DEST) local REPO_SUB_DIRECTORY=$(dirname $REPO_DEST)
# REPOTYPE can be overridden with DIB_REPOTYPE_{name} # REPOTYPE can be overridden with DIB_REPOTYPE_{name}
local REPOTYPE_OVERRIDE=DIB_REPOTYPE_${REPONAME//-/_} local REPOTYPE_OVERRIDE=DIB_REPOTYPE_${REPONAME//[^A-Za-z0-9]/_}
REPOTYPE=${!REPOTYPE_OVERRIDE:-$REPOTYPE} REPOTYPE=${!REPOTYPE_OVERRIDE:-$REPOTYPE}
# REPOLOCATION can be overridden with DIB_REPOLOCATION_{name} # REPOLOCATION can be overridden with DIB_REPOLOCATION_{name}
local REPOLOCATION_OVERRIDE=DIB_REPOLOCATION_${REPONAME//-/_} local REPOLOCATION_OVERRIDE=DIB_REPOLOCATION_${REPONAME//[^A-Za-z0-9]/_}
REPOLOCATION=${!REPOLOCATION_OVERRIDE:-$REPOLOCATION} REPOLOCATION=${!REPOLOCATION_OVERRIDE:-$REPOLOCATION}
# REPOREF can be overridden with DIB_REPOREF_{name} # REPOREF can be overridden with DIB_REPOREF_{name}
local REPOREF_OVERRIDE=DIB_REPOREF_${REPONAME//-/_} local REPOREF_OVERRIDE=DIB_REPOREF_${REPONAME//[^A-Za-z0-9]/_}
REPOREF=${!REPOREF_OVERRIDE:-$REPOREF} REPOREF=${!REPOREF_OVERRIDE:-$REPOREF}
# Determine a unique cache path for this repo # Determine a unique cache path for this repo