forked from google/android-cuttlefish
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparse-deps.sh
executable file
·37 lines (29 loc) · 985 Bytes
/
parse-deps.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
set -o errexit
set -u
# set -x
# $1 = package name
# $2 = filter script
# $3 = process script
# Given the name of a package in $1, discover the name and version of each of
# its direct dependencies. For each direct dependency, invoke a script in $2
# with the name and version of that dependency. If the script result tests
# true, we invoke a seond script in $3 (with the same arguments as the script in
# $2.
source utils.sh
function parse_deps {
local package=$1
local filter=$2
local process=$3
local package_and_arch=$(add_arch "${package}")
local package_version=$(dpkg-query -W -f='${Version}' "${package_and_arch}")
if [ -z "${package_version}" ]; then
package_version=_
fi
parse_dpkg_dependencies "${package}" \
"${package_version}" \
"${filter}" \
"${process}" \
"$(get_depends_from_package ${package_and_arch})"
}
parse_deps $*