Merge branch 'altlinux-4.0'

Conflicts:

	rpm-4_0.spec
This commit is contained in:
Дмитрий Левин 2008-07-08 17:57:45 +00:00
commit 77a7f3cc55
3 changed files with 17 additions and 4 deletions

View File

@ -49,7 +49,7 @@ for f in "$@"; do
new_val="${fname%/*}"
if [ "$new_val" != "$old_val" ]; then
subst -p "s,^libdir='[^']*'\$,libdir='$new_val',g" "$f"
subst -p "s/^libdir='[^']*'\$/libdir='$(quote_sed_regexp "$new_val")'/g" "$f"
echo "${fname#.}: libdir: '$old_val' --> '$new_val'"
fi
@ -70,7 +70,7 @@ for f in "$@"; do
new_val="${new_val%% }"
if [ "$new_val" != "$old_val" ]; then
subst -p "s,^dependency_libs='[^']*'\$,dependency_libs='$new_val',g" "$f"
subst -p "s/^dependency_libs='[^']*'\$/dependency_libs='$(quote_sed_regexp "$new_val")'/g" "$f"
echo "${fname#.}: dependency_libs: '$old_val' --> '$new_val'"
fi
done

View File

@ -79,7 +79,7 @@ fix()
new_val="${new_val%% }"
if [ "$new_val" != "$old_val" ]; then
subst -p "s|^Cflags: .*|Cflags: $new_val|g" -- "$f" || return 1
subst -p "s/^Cflags: .*/Cflags: $(quote_sed_regexp "$new_val")/g" -- "$f" || return 1
echo "$fname: Cflags: '$old_val' --> '$new_val'"
fi
@ -109,7 +109,7 @@ fix()
new_val="${new_val%% }"
if [ "$new_val" != "$old_val" ]; then
subst -p "s|^Libs: .*|Libs: $new_val|g" -- "$f" || return 1
subst -p "s/^Libs: .*/Libs: $(quote_sed_regexp "$new_val")/g" -- "$f" || return 1
echo "$fname: Libs: '$old_val' --> '$new_val'"
fi
}

View File

@ -188,3 +188,16 @@ PackagedFiles()
rpmquery --list -f -- "$@" 2>/dev/null ||:
fi
}
# Quote given arguments for sed basic regular expression.
# Usage example: sed "s/$(quote_sed_regexp "$var_pattern")/$(quote_sed_regexp "$var_replacement")/"
# Taken from libshell.
quote_sed_regexp()
{
local out="$*"
if [ -z "${out##*[\[\].*&^\$\\\\/]*}" ]; then
out="$(printf %s "$out" |sed -e 's/[].*&^$[\/]/\\&/g')" ||
return 1
fi
printf %s "$out"
}