summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/control.sh19
-rw-r--r--locale/en_US/libopkbuild_2.sh1
-rw-r--r--src/ob-checkbuilddeps.sh2
-rw-r--r--src/ob-genchanges.sh2
-rw-r--r--src/ob-gencontrol.sh8
5 files changed, 24 insertions, 8 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
diff --git a/locale/en_US/libopkbuild_2.sh b/locale/en_US/libopkbuild_2.sh
index 38f2063..275177e 100644
--- a/locale/en_US/libopkbuild_2.sh
+++ b/locale/en_US/libopkbuild_2.sh
@@ -37,6 +37,7 @@ msg_libopkbuild_2_list_item_separator=', '
msg_libopkbuild_2_control_missing_fields='%s: missing fields: %s'
msg_libopkbuild_2_substvar_deep_nesting='Possible recursion in substitutions'
msg_libopkbuild_2_substvar_invalid='Invalid substitution variable "%s"'
+msg_libopkbuild_2_substvar_unknown='Unknown substitution variable "%s"'
# lib/changelog.sh
msg_libopkbuild_2_changelog_found_blank_line='%s: found blank line where expected %s'
diff --git a/src/ob-checkbuilddeps.sh b/src/ob-checkbuilddeps.sh
index 39d7e60..f75cf43 100644
--- a/src/ob-checkbuilddeps.sh
+++ b/src/ob-checkbuilddeps.sh
@@ -60,7 +60,7 @@ check_build_deps()
deps="$(ob_get_source_parameter 'Build-Depends')"
deps="$(ob_reduce_deps -a "${OPK_HOST_ARCH}" \
-p "${OPK_HOST_PLAT}" -- "${deps}")"
- deps="$(ob_substvars "${deps}")"
+ deps="$(ob_substvars "${deps}" '')"
missing=''
IFS=','
diff --git a/src/ob-genchanges.sh b/src/ob-genchanges.sh
index f972002..9e8c75a 100644
--- a/src/ob-genchanges.sh
+++ b/src/ob-genchanges.sh
@@ -48,7 +48,7 @@ write_changes()
ob_set_package_substvars "${pkg}"
desc="$(ob_get_binary_parameter "${pkg}" 'Description' | \
head -n 1)"
- desc="$(ob_substvars "${desc}")"
+ desc="$(ob_substvars "${desc}" "${pkg}")"
printf ' %s - %s\n' "${pkg}" "${desc}" >&3
done
diff --git a/src/ob-gencontrol.sh b/src/ob-gencontrol.sh
index e42ab60..c2eb61b 100644
--- a/src/ob-gencontrol.sh
+++ b/src/ob-gencontrol.sh
@@ -95,14 +95,16 @@ gen_control()
-a "${OPK_HOST_ARCH}" \
-p "${OPK_HOST_PLAT}" \
-- "${value}")"
- value="$(ob_substvars "${value}")"
+ value="$(ob_substvars "${value}" \
+ "${binary}")"
;;
'Conflicts' | 'Provides' | 'Replaces')
value="$(ob_reduce_deps \
-a "${OPK_HOST_ARCH}" \
-p "${OPK_HOST_PLAT}" \
-u -- "${value}")"
- value="$(ob_substvars "${value}")"
+ value="$(ob_substvars "${value}" \
+ "${binary}")"
;;
esac
printf '%s: %s\n' "${name}" "${value}" | \
@@ -222,7 +224,7 @@ main()
plat="$(ob_get_binary_parameter "${pkg}" 'Platform')"
[ x"${plat}" != x'all' ] && plat="${OPK_HOST_PLAT}"
desc="$(ob_get_binary_parameter "${pkg}" 'Description')"
- desc="$(ob_substvars "${desc}")"
+ desc="$(ob_substvars "${desc}" "${pkg}")"
gen_control "${pkg}" "${OPK_BINARY_VERSION}" \
"${arch}" "${plat}" "${desc}" 'true'
install_maintainer_scripts "${pkg}"