mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-07 04:56:58 +02:00
board_options: new portageq wrappers
- May be sourced early, so explicitly die if source fails. - Add a function for getting the latest version of a package. - Read PROVIDES metadata using portageq, enabling data to be read from binary packages in addition to installed packages. The performance issue is not an issue here and needed to support empty build roots.
This commit is contained in:
parent
ab3f1ee0b8
commit
bc5de30442
@ -12,7 +12,7 @@ BOARD_ROOT="/build/${BOARD}"
|
||||
ARCH=$(get_board_arch ${BOARD})
|
||||
|
||||
# What cross-build are we targeting?
|
||||
. "${BOARD_ROOT}/etc/portage/make.conf"
|
||||
. "${BOARD_ROOT}/etc/portage/make.conf" || die
|
||||
|
||||
# check if any of the given use flags are enabled for a pkg
|
||||
pkg_use_enabled() {
|
||||
@ -25,12 +25,18 @@ pkg_use_enabled() {
|
||||
return $?
|
||||
}
|
||||
|
||||
# get a package's SONAMEs in soname.provided format
|
||||
pkg_soname_provides() {
|
||||
# Usage: pkg_version [installed|binary|ebuild] some-pkg/name
|
||||
# Prints: some-pkg/name-1.2.3
|
||||
# Note: returns 0 even if the package was not found.
|
||||
pkg_version() {
|
||||
portageq-"${BOARD}" best_visible "${BOARD_ROOT}" "$1" "$2"
|
||||
}
|
||||
|
||||
# Usage: pkg_provides [installed|binary] some-pkg/name-1.2.3
|
||||
# Prints: x86_32: libfoo.so.2 x86_64: libfoo.so.2
|
||||
pkg_provides() {
|
||||
local provides p
|
||||
# We could run this command but it ugly and silly slow:
|
||||
# portageq-"${BOARD}" metadata "${BOARD_ROOT}" installed "$1" PROVIDES
|
||||
provides=$(<"${BOARD_ROOT}/var/db/pkg/$1/PROVIDES")
|
||||
provides=$(portageq-"${BOARD}" metadata "${BOARD_ROOT}" "$1" "$2" PROVIDES)
|
||||
|
||||
if [[ -z "$provides" ]]; then
|
||||
return
|
||||
|
@ -211,7 +211,7 @@ package_provided() {
|
||||
for p in "$@"; do
|
||||
info "Writing $p to package.provided and soname.provided"
|
||||
echo "$p" >> "${profile}/package.provided"
|
||||
pkg_soname_provides "$p" >> "${profile}/soname.provided"
|
||||
pkg_provides binary "$p" >> "${profile}/soname.provided"
|
||||
done
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user