From 6a6d91345971d70f3d9d117867e8e5e52b64f42c Mon Sep 17 00:00:00 2001 From: Gregory Haynes Date: Mon, 24 Feb 2014 16:29:24 -0800 Subject: [PATCH] Bash eval the lines in source-repository scripts This will allow us to add environment variables to source-repository scripts. Useful for things like arch-specific download urls. Change-Id: I4d046825a317dc88db3d7673ad261cedacd1a104 --- elements/source-repositories/README.md | 3 +++ .../source-repositories/extra-data.d/98-source-repositories | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/elements/source-repositories/README.md b/elements/source-repositories/README.md index f72168f0..ced064aa 100644 --- a/elements/source-repositories/README.md +++ b/elements/source-repositories/README.md @@ -36,6 +36,9 @@ fetch/pull section of a review. For example: DIB_REPOLOCATION_nova=https://review.openstack.org/openstack/nova DIB_REPOREF_nova=refs/changes/72/61972/8 +Additionally, the lines in the source-repository scripts are eval'd, so they +may contain environment variables. + Git sources will be cloned to \ Tarballs will be extracted to \. Tarballs should contain a diff --git a/elements/source-repositories/extra-data.d/98-source-repositories b/elements/source-repositories/extra-data.d/98-source-repositories index 61bc9618..649f4c06 100755 --- a/elements/source-repositories/extra-data.d/98-source-repositories +++ b/elements/source-repositories/extra-data.d/98-source-repositories @@ -12,7 +12,9 @@ function get_repos_for_element(){ local REGEX="^([^ ]+) (git|tar|file|package) ?(/[^ ]+)? ?([^ ]+)? ?([^ ]*)$" - while read line ; do + while read line; do + # expand variables + line=$(eval echo $line) # ignore blank lines and lines beginning in '#' [[ "$line" == \#* ]] || [[ -z "$line" ]] && continue