makepkg: use last match in BUILDENV/OPTIONS array

Using the last match in the BUILDENV and OPTIONS arrays allows the
user to easily override these values without specifying the entire
array. For example add "BUILDENV+=(sign)" in ~/.makepkg.conf.

Fixes FS#26701.

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Allan McRae 2012-09-17 17:02:17 +10:00
parent fc35b16fd4
commit fbf96203ab
2 changed files with 7 additions and 4 deletions

View file

@ -81,7 +81,8 @@ Options
This array contains options that affect the build environment, the defaults This array contains options that affect the build environment, the defaults
are shown here. All options should always be left in the array; to enable are shown here. All options should always be left in the array; to enable
or disable an option simply remove or place an ``!'' at the front of the or disable an option simply remove or place an ``!'' at the front of the
option. Each works as follows: option. If an option is specified multiple times, the final value takes
precedence. Each option works as follows:
*fakeroot*;; *fakeroot*;;
Allow building packages as a non-root user. This is highly recommended. Allow building packages as a non-root user. This is highly recommended.
@ -134,7 +135,8 @@ Options
equivalent to options that can be placed in the PKGBUILD; the defaults are equivalent to options that can be placed in the PKGBUILD; the defaults are
shown here. All options should always be left in the array; to enable or shown here. All options should always be left in the array; to enable or
disable an option simply remove or place an ``!'' at the front of the disable an option simply remove or place an ``!'' at the front of the
option. Each works as follows: option. If an option is specified multiple times, the final value takes
precedence. Each option works as follows:
*strip*;; *strip*;;
Strip symbols from binaries and libraries. If you frequently use a Strip symbols from binaries and libraries. If you frequently use a

View file

@ -830,8 +830,9 @@ check_buildenv() {
in_opt_array() { in_opt_array() {
local needle=$1; shift local needle=$1; shift
local opt local i opt
for opt in "$@"; do for (( i = $#; i > 0; i-- )); do
opt=${!i}
if [[ $opt = "$needle" ]]; then if [[ $opt = "$needle" ]]; then
# enabled # enabled
return 0 return 0