flatcar-scripts/build_library/board_options.sh
Michael Marineau 5985b1e3d6 build_library: replace package checking script
The new python script check_root uses data that portage already
maintains on what shared libraries packages need or provide instead of
re-scanning whatever ELF files that can be found. This is much more
comprehensive but there is a bit of a transition issue for folks with
long-lived SDKs: packages built with portage older than 2.2.18 do not
include this data. As such for now the check is non-fatal and provides a
command you can use to refresh locally installed packages.

The code checking for conflicts between top level directories and /usr
has also been rewritten. Both tests now are considerably faster.
2015-07-12 15:50:58 -07:00

55 lines
1.3 KiB
Bash

# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
if [ -z "${FLAGS_board}" ]; then
error "--board is required."
exit 1
fi
BOARD="${FLAGS_board}"
BOARD_ROOT="/build/${BOARD}"
ARCH=$(get_board_arch ${BOARD})
# What cross-build are we targeting?
. "${BOARD_ROOT}/etc/portage/make.conf"
# 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 ^+}"
equery-"${BOARD}" -q uses "${pkg}" | grep -q ${grep_args}
return $?
}
# get a package's SONAMEs in soname.provided format
pkg_soname_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")
if [[ -z "$provides" ]]; then
return
fi
# convert:
# x86_32: libcom_err.so.2 libss.so.2 x86_64: libcom_err.so.2 libss.so.2
# into:
# x86_32 libcom_err.so.2 libss.so.2
# x86_64 libcom_err.so.2 libss.so.2
echo -n "# $1:"
for p in ${provides}; do
if [[ "$p" == *: ]]; then
echo
echo -n "${p%:}"
else
echo -n " $p"
fi
done
echo
}