From 9c42c79d8789f2c8bf789cb8db47a35ee2221acc Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Mon, 18 Mar 2019 16:05:00 -0400 Subject: ob_set_source_substvar(): Make sed script a global var --- diff --git a/lib/control.sh b/lib/control.sh index cd982e9..37123dd 100644 --- a/lib/control.sh +++ b/lib/control.sh @@ -18,6 +18,15 @@ # along with opkbuild. If not, see . _OB_SUBSTVARS_MAX_DEPTH=50 +_OB_SUBSTVAR_TRIM_SED=' + H; # Store each input line in the hold space. + ${ # At the last line of input: + g; # restore the hold space into the pattern space, + s/^[\n]*//; # remove leading newline characters, + s/[\n]*$//; # remove trailing newline characters, and + p; # print the results. + }; +' _ob_parse_control_error() { @@ -200,15 +209,7 @@ ob_set_source_substvar() name="$(printf '%s' "${name}" | tr 'a-z-' 'A-Z_')" # Trim leading and trailing whitespace from value. - value="$(printf '%s' "${value}" | sed -n ' - H; # Store each input line in the hold space. - ${ # At the last line of input: - g; # restore the hold space into the pattern space, - s/^[\n]*//; # remove leading newline characters, - s/[\n]*$//; # remove trailing newline characters, and - p; # print the results. - }; - ')" + value="$(printf '%s' "${value}" | sed -n "${_OB_SUBSTVAR_TRIM_SED}")" eval "_OB_SUBSTVAR_${name}=\"\${value}\"" -- cgit v0.9.1