diff options
Diffstat (limited to 'lib/control.sh')
-rw-r--r-- | lib/control.sh | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/control.sh b/lib/control.sh index 75a59d5..22ed8a5 100644 --- a/lib/control.sh +++ b/lib/control.sh @@ -255,14 +255,16 @@ ob_set_binary_substvar() ## \fBob_set_source_substvar\fP(3) in a string. The format for ## variable substitutions is \fI${var}\fP, and substitutions can be ## nested. -## @operand string req The string in which to substitute variables. +## @operand string req The string in which to substitute variables. +## @operand package req The binary package for which to substitute variables. ## @return Returns 0 on success or 1 on possible recursion. ## @stderr Prints a warning on possible recursion. ## @pure yes This function has no side effects. ob_substvars() { local string="${1}" - shift 1 || _ob_abort + local package="${2}" + shift 2 || _ob_abort local depth= local lhs= local name= @@ -313,7 +315,18 @@ ob_substvars() ${name} EOF )" - value="$(eval "printf '%s' \"\${_OB_SUBSTVAR_SRC_${name}}\"")" + if eval "[ x\"\${_OB_SUBSTVAR_SRC_${name}:+set}\" = x'set' ]" + then + name="_OB_SUBSTVAR_SRC_${name}" + elif [ -n "${package}" ] && eval "[ x\"\${_OB_SUBSTVAR_BIN_$(: \ + )${package}__${name}:+set}\" = x'set' ]"; then + name="_OB_SUBSTVAR_BIN_${package}__${name}" + else + _ob_warn_msg 'substvar_unknown' "${name}" + string="${lhs}${rhs}" + continue + fi + value="$(eval "printf '%s' \"\${${name}}\"")" string="${lhs}${value}${rhs}" depth=$((${depth} + 1)) done |