mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-10 14:36:58 +02:00
With Portage 2.1.10, the number of spaces in the output changed. This broke the get_package_list and caused failures during unit tests. To fix this, I've updated the script to handle this. BUG=chromium-os:17151 TEST=Verify that get_package_list works now. Change-Id: I2a334451807abdbeb9fb5cbb99a54ab75f234330 Reviewed-on: http://gerrit.chromium.org/gerrit/3415 Reviewed-by: Anush Elangovan <anush@chromium.org> Tested-by: David James <davidjames@chromium.org>
53 lines
1.5 KiB
Bash
Executable File
53 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Copyright (c) 2010 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.
|
|
|
|
# Lists all package dependencies of a particular package. Useful to find out
|
|
# all packages depended on by chromeos and chromeos-dev.
|
|
|
|
# --- BEGIN COMMON.SH BOILERPLATE ---
|
|
# Load common CrOS utilities. Inside the chroot this file is installed in
|
|
# /usr/lib/crosutils. Outside the chroot we find it relative to the script's
|
|
# location.
|
|
find_common_sh() {
|
|
local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")"))
|
|
local path
|
|
|
|
SCRIPT_ROOT=
|
|
for path in "${common_paths[@]}"; do
|
|
if [ -r "${path}/common.sh" ]; then
|
|
SCRIPT_ROOT=${path}
|
|
break
|
|
fi
|
|
done
|
|
}
|
|
|
|
find_common_sh
|
|
. "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1)
|
|
# --- END COMMON.SH BOILERPLATE ---
|
|
|
|
# Script must be run inside the chroot.
|
|
assert_inside_chroot
|
|
|
|
get_default_board
|
|
|
|
# Flags.
|
|
DEFINE_string board "$DEFAULT_BOARD" \
|
|
"The board for which the image was built." b
|
|
|
|
# Parse flags.
|
|
FLAGS "$@" || exit 1
|
|
eval set -- "${FLAGS_ARGV}"
|
|
|
|
[[ -z "${FLAGS_board}" ]] && die "A board must be specified."
|
|
|
|
if [[ -z "${FLAGS_ARGV}" ]]; then
|
|
warn "Please specify package."
|
|
die "Usage: ./get_package_list.sh chromeos-base/chromeos > package.list"
|
|
fi
|
|
|
|
emerge-$FLAGS_board --emptytree --usepkgonly -p -v --columns \
|
|
$1 2> /dev/null | sed -n -E -e 's/^\[binary[^]]*\] ([^ ]*) .*$/\1/p'
|