From 9db6a7c44def28421e4529607d9e1ae80b2ceda3 Mon Sep 17 00:00:00 2001 From: Stefano Cotta Ramusino Date: Wed, 4 Jul 2012 03:37:20 +0200 Subject: [PATCH] libspec.lib: expand compound rpm variables such as %{majorminor} Signed-off-by: Stefano Cotta Ramusino --- lib/libspec.lib.in | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/libspec.lib.in b/lib/libspec.lib.in index c1d36a7..ae85f18 100644 --- a/lib/libspec.lib.in +++ b/lib/libspec.lib.in @@ -576,8 +576,12 @@ $FUNCNAME: * blank unexpanded and undefined variables beginning by \`?'..." # hack to prevent a rpm segfault when evaluating urls containing '%' (e.g. python-pyslsk) output_prefix=`echo ${output} | sed "s|\(^[a-z]*://\).*|\1|"` output_suffix=`echo ${output} | sed "s|$output_prefix||"` - notify.debug "$FUNCNAME: rpm --eval \"${output_suffix}\"" - output=$(rpm --eval "${output_suffix}") + notify.debug "$FUNCNAME: rpm --eval \"$(for i in $(seq 0 1 $(( ${#rpmvar_name[@]} - 1 ))); do +echo "%define ${rpmvar_name[$i]} ${rpmvar_value[$i]}"; done) +${output_suffix}\"" + output=$(rpm --eval "$(for i in $(seq 0 1 $(( ${#rpmvar_name[@]} - 1 ))); do +echo "%define ${rpmvar_name[$i]} ${rpmvar_value[$i]}"; done) +${output_suffix}") output="${output_prefix}${output}" notify.debug "$FUNCNAME: output = \`$output'" ;; esac