summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/control.sh10
-rw-r--r--lib/package.sh46
2 files changed, 41 insertions, 15 deletions
diff --git a/lib/control.sh b/lib/control.sh
index 3bcedbc..58bf68b 100644
--- a/lib/control.sh
+++ b/lib/control.sh
@@ -214,7 +214,10 @@ ob_set_substvar()
case "${name}" in *[!A-Za-z0-9-]* | '')
return 125
esac
- name="$(echo "${name}" | tr 'a-z-' 'A-Z_')"
+ name="$(tr 'a-z-' 'A-Z_' <<-EOF
+ ${name}
+ EOF
+ )"
# Trim leading and trailing whitespace from value.
read -r value <<-EOF
@@ -289,7 +292,10 @@ ob_substvars()
esac
# Perform the substitution.
- name="$(echo "${name}" | tr 'a-z-' 'A-Z_')"
+ name="$(tr 'a-z-' 'A-Z_' <<-EOF
+ ${name}
+ EOF
+ )"
value="$(eval "printf '%s' \"\${_OB_SUBSTVAR_${name}}\"")"
string="${lhs}${value}${rhs}"
depth=$(($depth + 1))
diff --git a/lib/package.sh b/lib/package.sh
index 5111341..9c6f861 100644
--- a/lib/package.sh
+++ b/lib/package.sh
@@ -113,8 +113,10 @@ ob_parse_package_metadata()
>>"${cache_file}"
done
for pkg in $(ob_get_binary_packages); do
- pkg_clean="$(echo "${pkg}" | tr 'a-z' 'A-Z' | \
- tr -dC 'A-Z0-9')"
+ pkg_clean="$({ tr 'a-z' 'A-Z' | tr -dC 'A-Z0-9';} <<-EOF
+ "${pkg}"
+ EOF
+ )"
for param_name in ${_OB_BINARY_PARAMETERS}; do
param_value="$(ob_get_binary_parameter "${pkg}" \
"${param_name}" | sed "s/'/'\\\\''/g")"
@@ -176,9 +178,11 @@ ob_get_binary_packages()
fi
# Make sure the "clean" name is unique.
- pkg_clean=" $(echo "${pkg}" | tr 'a-z' 'A-Z' | \
- tr -dC 'A-Z0-9') "
- if echo "${pkgs_clean}" | grep "${pkg_clean}" \
+ pkg_clean="$({ tr 'a-z' 'A-Z' | tr -dC 'A-Z0-9';} <<-EOF
+ "${pkg}"
+ EOF
+ )"
+ if echo "${pkgs_clean}" | grep " ${pkg_clean} " \
>/dev/null 2>&1; then
_ob_warn_msg 'duplicate_clean_binary_name' \
"${pkg_clean}"
@@ -230,7 +234,10 @@ ob_get_source_parameter()
case "${name}" in *[!A-Za-z0-9-]* | '')
return 125
esac
- name="$(echo "${name}" | tr 'a-z-' 'A-Z_')"
+ name="$(tr 'a-z-' 'A-Z_' <<-EOF
+ ${name}
+ EOF
+ )"
eval "printf '%s' \"\${_OB_SRCFIELD_${name}}\""
@@ -254,14 +261,19 @@ ob_get_binary_parameter()
fi
# Convert package name to its uppercase "clean" form.
- package="$(echo "${package}" | tr 'a-z' 'A-Z' | \
- tr -dC 'A-Z0-9')"
+ package="$({ tr 'a-z' 'A-Z' | tr -dC 'A-Z0-9'; } <<-EOF
+ "${pkg}"
+ EOF
+ )"
# Convert field name to uppercase and validate.
case "${name}" in *[!A-Za-z0-9-]* | '')
return 125
esac
- name="$(echo "${name}" | tr 'a-z-' 'A-Z_')"
+ name="$(tr 'a-z-' 'A-Z_' <<-EOF
+ ${name}
+ EOF
+ )"
eval "printf '%s' \"\${_OB_BINFIELD_${package}_${name}}\""
@@ -356,7 +368,10 @@ _ob_set_source_parameter()
case "${name}" in *[!A-Za-z0-9-]* | '')
return 125
esac
- name="$(echo "${name}" | tr 'a-z-' 'A-Z_')"
+ name="$(tr 'a-z-' 'A-Z_' <<-EOF
+ ${name}
+ EOF
+ )"
_OB_SOURCE_PARAMETERS="${_OB_SOURCE_PARAMETERS} ${name}"
@@ -380,14 +395,19 @@ _ob_set_binary_parameter()
fi
# Convert package name to its uppercase "clean" form.
- package="$(echo "${package}" | tr 'a-z' 'A-Z' | \
- tr -dC 'A-Z0-9')"
+ package="$({ tr 'a-z' 'A-Z' | tr -dC 'A-Z0-9'; } <<-EOF
+ "${pkg}"
+ EOF
+ )"
# Convert field name to uppercase and validate.
case "${name}" in *[!A-Za-z0-9-]* | '')
return 125
esac
- name="$(echo "${name}" | tr 'a-z-' 'A-Z_')"
+ name="$(tr 'a-z-' 'A-Z_' <<-EOF
+ ${name}
+ EOF
+ )"
if ! echo " ${_OB_BINARY_PARAMETERS} " | grep " ${name} " \
>/dev/null 2>&1; then