flatcar-scripts/build_library/test_image_content.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

41 lines
1.3 KiB
Bash

# Copyright (c) 2012 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.
test_image_content() {
local root="$1"
local returncode=0
info "Checking $1"
local check_root="${BUILD_LIBRARY_DIR}/check_root"
if ! ROOT="$root" "$check_root" libs; then
warn "test_image_content: Failed dependency check"
warn "This may be the result of having a long-lived SDK with binary"
warn "packages that predate portage 2.2.18. If this is the case try:"
echo " emerge-$BOARD -agkuDN --rebuilt-binaries=y -j9 @world"
echo " emerge-$BOARD -a --depclean"
returncode=1
fi
local blacklist_dirs=(
"$root/usr/share/locale"
)
for dir in "${blacklist_dirs[@]}"; do
if [ -d "$dir" ]; then
warn "test_image_content: Blacklisted directory found: $dir"
# Only a warning for now, size isn't important enough to kill time
# playing whack-a-mole on things like this this yet.
#error "test_image_content: Blacklisted directory found: $dir"
#returncode=1
fi
done
# Check that there are no conflicts between /* and /usr/*
if ! ROOT="$root" "$check_root" usr; then
error "test_image_content: Failed /usr conflict check"
returncode=1
fi
return $returncode
}