From 0226cf224617eda92f634b314b49acdf017bd107 Mon Sep 17 00:00:00 2001 From: Derek Higgins Date: Wed, 26 Feb 2014 22:22:40 +0000 Subject: [PATCH] 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 --- elements/source-repositories/README.md | 10 +++++++++- .../extra-data.d/98-source-repositories | 6 +++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/elements/source-repositories/README.md b/elements/source-repositories/README.md index f72168f03..7ed9c9b65 100644 --- a/elements/source-repositories/README.md +++ b/elements/source-repositories/README.md @@ -23,9 +23,17 @@ diskimage-builder which can change the details registered by the element, these DIB_REPOLOCATION_ : change the registered location DIB_REPOREF_ : 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 +*As you can see above, the \ 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 keystone from a stable branch then you would set DIB_REPOREF_keystone=stable/grizzly diff --git a/elements/source-repositories/extra-data.d/98-source-repositories b/elements/source-repositories/extra-data.d/98-source-repositories index 61bc9618a..ae08f1e24 100755 --- a/elements/source-repositories/extra-data.d/98-source-repositories +++ b/elements/source-repositories/extra-data.d/98-source-repositories @@ -29,15 +29,15 @@ function get_repos_for_element(){ local REPO_SUB_DIRECTORY=$(dirname $REPO_DEST) # 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} # 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} # 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} # Determine a unique cache path for this repo