OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # Lists all package dependencies of a particular package. Useful to find out | 7 # Lists all package dependencies of a particular package. Useful to find out |
8 # all packages depended on by chromeos and chromeos-dev. | 8 # all packages depended on by chromeos and chromeos-dev. |
9 | 9 |
10 . "$(dirname "$0")/common.sh" | 10 # --- BEGIN COMMON.SH BOILERPLATE --- |
| 11 # Load common CrOS utilities. Inside the chroot this file is installed in |
| 12 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's |
| 13 # location. |
| 14 find_common_sh() { |
| 15 local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")")) |
| 16 local path |
| 17 |
| 18 SCRIPT_ROOT= |
| 19 for path in "${common_paths[@]}"; do |
| 20 if [ -r "${path}/common.sh" ]; then |
| 21 SCRIPT_ROOT=${path} |
| 22 break |
| 23 fi |
| 24 done |
| 25 } |
| 26 |
| 27 find_common_sh |
| 28 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) |
| 29 # --- END COMMON.SH BOILERPLATE --- |
11 | 30 |
12 # Script must be run inside the chroot. | 31 # Script must be run inside the chroot. |
13 assert_inside_chroot | 32 assert_inside_chroot |
14 | 33 |
15 get_default_board | 34 get_default_board |
16 | 35 |
17 # Flags. | 36 # Flags. |
18 DEFINE_string board "$DEFAULT_BOARD" \ | 37 DEFINE_string board "$DEFAULT_BOARD" \ |
19 "The board for which the image was built." b | 38 "The board for which the image was built." b |
20 | 39 |
21 # Parse flags. | 40 # Parse flags. |
22 FLAGS "$@" || exit 1 | 41 FLAGS "$@" || exit 1 |
23 eval set -- "${FLAGS_ARGV}" | 42 eval set -- "${FLAGS_ARGV}" |
24 | 43 |
25 [[ -z "${FLAGS_board}" ]] && die "A board must be specified." | 44 [[ -z "${FLAGS_board}" ]] && die "A board must be specified." |
26 | 45 |
27 if [[ -z "${FLAGS_ARGV}" ]]; then | 46 if [[ -z "${FLAGS_ARGV}" ]]; then |
28 warn "Please specify package." | 47 warn "Please specify package." |
29 die "Usage: ./get_package_list.sh chromeos-base/chromeos > package.list" | 48 die "Usage: ./get_package_list.sh chromeos-base/chromeos > package.list" |
30 fi | 49 fi |
31 | 50 |
32 emerge-$FLAGS_board --emptytree --usepkgonly -p -v --columns \ | 51 emerge-$FLAGS_board --emptytree --usepkgonly -p -v --columns \ |
33 $1 2> /dev/null | cut -d ' ' -f 8 | grep '/' | 52 $1 2> /dev/null | cut -d ' ' -f 8 | grep '/' |
OLD | NEW |