mirror of
https://github.com/flatcar/scripts.git
synced 2026-04-15 10:31:15 +02:00
build_library: Fix pkg_use_enabled
"equery uses" ignores forced or masked USE flags by default. In our case, the selinux USE flag is forced, so stop ignoring it with --forced-masked flag. Update the regexp to catch the forced USE flags too and modernize the function a bit. Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
This commit is contained in:
parent
4008a89cd8
commit
aaf5ccb019
@ -16,13 +16,19 @@ ARCH=$(get_board_arch ${BOARD})
|
||||
|
||||
# check if any of the given use flags are enabled for a pkg
|
||||
pkg_use_enabled() {
|
||||
local pkg="$1"
|
||||
shift
|
||||
# for every flag argument, turn it into `-e ^+flag` for grep
|
||||
local grep_args="${@/#/-e ^+}"
|
||||
local pkg="${1}"; shift
|
||||
|
||||
equery-"${BOARD}" -q uses "${pkg}" | grep -q ${grep_args}
|
||||
return $?
|
||||
# for every flag argument, turn it into a regexp that matches it as
|
||||
# either '+${flag}' or '(+${flag})'
|
||||
local -a grep_args=()
|
||||
local flag
|
||||
for flag; do
|
||||
grep_args+=( -e '^(\?+'"${flag}"')\?$' )
|
||||
done
|
||||
local -i rv=0
|
||||
|
||||
equery-"${BOARD}" --quiet uses --forced-masked "${pkg}" | grep --quiet "${grep_args[@]}" || rv=$?
|
||||
return ${rv}
|
||||
}
|
||||
|
||||
# Usage: pkg_version [installed|binary|ebuild] some-pkg/name
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user