index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Jan Alexander Steffens (heftig) <jan.steffens@gmail.com> | 2015-10-19 03:33:24 +0200 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2015-10-19 14:32:59 +1000 |
commit | 70e6875ad9afd6ee0e26c7fbe283466f7a6767e5 (patch) | |
tree | c0cef561b234b5bf14e622c9a5279ecf0b6cdd19 /scripts/libmakepkg/util | |
parent | 5d4a3f101ca15bb1ae7944ec305c7f10c9f504d0 (diff) |
-rw-r--r-- | scripts/libmakepkg/util/option.sh | 34 |
diff --git a/scripts/libmakepkg/util/option.sh b/scripts/libmakepkg/util/option.sh index 1b2d94dc..41c7fd3a 100644 --- a/scripts/libmakepkg/util/option.sh +++ b/scripts/libmakepkg/util/option.sh @@ -106,3 +106,37 @@ check_buildenv() { # not found return 127 } + +## +# Checks to see if options are present in BUILDENV or PKGBUILD; +# PKGBUILD options always take precedence. +# +# usage : check_buildoption( $option, $expected_val ) +# return : 0 - matches expected +# 1 - does not match expected +# 127 - not found +## +check_buildoption() { + in_opt_array "$1" ${options[@]} + case $? in + 0) # assert enabled + [[ $2 = y ]] + return ;; + 1) # assert disabled + [[ $2 = n ]] + return + esac + + in_opt_array "$1" ${BUILDENV[@]} + case $? in + 0) # assert enabled + [[ $2 = y ]] + return ;; + 1) # assert disabled + [[ $2 = n ]] + return + esac + + # not found + return 127 +} |