Skip to content

Commit bd45874

Browse files
committed
Enhance dependency checking
Allow multiple files containing dependencies to be specified. The core base dependency list will always be included. This may be useful for examples that require additional packages compared to the core dependencies. Use dpkg as an additional test to decide if a pkg needs to be installed. Packages that provide only libraries fail the hash test regardless of whether they are installed or not, so they need to be checked via other means. For example libavcodec-dev. A failure to install or check deps must exit with error.
1 parent ebdfbe5 commit bd45874

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ IGTOP=$(readlink -f "$(dirname "$0")")
66

77
source "${IGTOP}/scripts/common"
88
source "${IGTOP}/scripts/dependencies_check"
9-
dependencies_check "${IGTOP}/depends"
9+
dependencies_check "${IGTOP}/depends" || exit 1
1010

1111

1212
usage()

install_deps.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/bin/bash
22

3+
set -eu
4+
35
IGTOP=$(readlink -f "$(dirname "$0")")
46
source "${IGTOP}/scripts/dependencies_check"
5-
dependencies_install "${IGTOP}/depends"
7+
depf=("${IGTOP}/depends")
8+
for f in "$@" ; do
9+
depf+=($(realpath -e "$f"))
10+
done
11+
dependencies_install "${depf[@]}"

scripts/dependencies_check

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ dependencies_check()
1414

1515
for depfile in "$@"; do
1616
if [[ -e "$depfile" ]]; then
17-
deps="$(sed -f "${IGTOP}/scripts/remove-comments.sed" < "${IGTOP}/depends")"
18-
17+
deps="$(sed -f "${IGTOP}/scripts/remove-comments.sed" < "$depfile")"
1918
fi
2019
for dep in $deps; do
2120
if ! hash "${dep%:*}" 2>/dev/null; then
22-
missing+=("${dep#*:}")
21+
if ! dpkg -s "${dep#*:}" > /dev/null 2>&1; then
22+
missing+=("${dep#*:}")
23+
fi
2324
fi
2425
done
2526
done
@@ -32,10 +33,11 @@ dependencies_check()
3233
echo
3334
echo "Script install_deps.sh can be used for this purpose."
3435
echo
35-
false
3636

3737
if [[ "$op" == install ]] ; then
3838
apt install -y "${missing[@]}"
39+
else
40+
exit 1
3941
fi
4042
fi
4143

0 commit comments

Comments
 (0)