mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-23 00:08:50 -05:00
makepkg: Improve optdepends extraction
Prevents issues where optdepends descriptions contain a bracket. Also, strip all comments from arrays before joining them. Fixes FS#23307. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
b48f718417
commit
b6cada3eed
@ -1258,7 +1258,8 @@ check_sanity() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local provides_list=()
|
local provides_list=()
|
||||||
eval $(awk '/^[[:space:]]*provides=/,/\)/' "$BUILDFILE" | sed "s/provides=/provides_list+=/")
|
eval $(awk '/^[[:space:]]*provides=/,/\)/' "$BUILDFILE" | \
|
||||||
|
sed -e "s/provides=/provides_list+=/" -e "s/#.*//")
|
||||||
for i in ${provides_list[@]}; do
|
for i in ${provides_list[@]}; do
|
||||||
if [[ $i != ${i//</} || $i != ${i//>/} ]]; then
|
if [[ $i != ${i//</} || $i != ${i//>/} ]]; then
|
||||||
error "$(gettext "Provides array cannot contain comparison (< or >) operators.")"
|
error "$(gettext "Provides array cannot contain comparison (< or >) operators.")"
|
||||||
@ -1267,7 +1268,8 @@ check_sanity() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
local backup_list=()
|
local backup_list=()
|
||||||
eval $(awk '/^[[:space:]]*backup=/,/\)/' "$BUILDFILE" | sed "s/backup=/backup_list+=/")
|
eval $(awk '/^[[:space:]]*backup=/,/\)/' "$BUILDFILE" | \
|
||||||
|
sed -e "s/backup=/backup_list+=/" -e "s/#.*//")
|
||||||
for i in "${backup_list[@]}"; do
|
for i in "${backup_list[@]}"; do
|
||||||
if [[ ${i:0:1} = "/" ]]; then
|
if [[ ${i:0:1} = "/" ]]; then
|
||||||
error "$(gettext "Backup entry should not contain leading slash : %s")" "$i"
|
error "$(gettext "Backup entry should not contain leading slash : %s")" "$i"
|
||||||
@ -1276,7 +1278,8 @@ check_sanity() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
local optdepends_list=()
|
local optdepends_list=()
|
||||||
eval $(awk '/^[[:space:]]*optdepends=/,/\)/' "$BUILDFILE" | sed "s/optdepends=/optdepends_list+=/")
|
eval $(awk '/^[[:space:]]*optdepends=\(/,/\)[[:space:]]*(|#.*)$/' "$BUILDFILE" | \
|
||||||
|
sed -e "s/optdepends=/optdepends_list+=/" -e "s/#.*//")
|
||||||
for i in "${optdepends_list[@]}"; do
|
for i in "${optdepends_list[@]}"; do
|
||||||
local pkg=${i%%:*}
|
local pkg=${i%%:*}
|
||||||
if [[ ! $pkg =~ ^[[:alnum:]\>\<\=\.\+\_\-]+$ ]]; then
|
if [[ ! $pkg =~ ^[[:alnum:]\>\<\=\.\+\_\-]+$ ]]; then
|
||||||
@ -1300,7 +1303,8 @@ check_sanity() {
|
|||||||
|
|
||||||
local valid_options=1
|
local valid_options=1
|
||||||
local known kopt options_list
|
local known kopt options_list
|
||||||
eval $(awk '/^[[:space:]]*options=/,/\)/' "$BUILDFILE" | sed "s/options=/options_list+=/")
|
eval $(awk '/^[[:space:]]*options=/,/\)/' "$BUILDFILE" | \
|
||||||
|
sed -e "s/options=/options_list+=/" -e "s/#.*//")
|
||||||
for i in ${options_list[@]}; do
|
for i in ${options_list[@]}; do
|
||||||
known=0
|
known=0
|
||||||
# check if option matches a known option or its inverse
|
# check if option matches a known option or its inverse
|
||||||
|
Loading…
Reference in New Issue
Block a user