2 # Copyright (C) The Arvados Authors. All rights reserved.
4 # SPDX-License-Identifier: AGPL-3.0
8 DEBUG=${ARVADOS_DEBUG:-0}
9 STDOUT_IF_DEBUG=/dev/null
10 STDERR_IF_DEBUG=/dev/null
11 DASHQQ_UNLESS_DEBUG=-qq
12 if [[ "$DEBUG" != "0" ]]; then
13 STDOUT_IF_DEBUG=/dev/stdout
14 STDERR_IF_DEBUG=/dev/stderr
18 # Multiple .deb based distros symlink to this script, so extract the target
19 # from the invocation path.
20 target=$(echo $0 | sed 's/.*test-packages-\([^.]*\)\.sh.*/\1/')
22 export ARV_PACKAGES_DIR="/arvados/packages/$target"
24 dpkg-query --show > "$ARV_PACKAGES_DIR/$1.before"
26 apt-get $DASHQQ_UNLESS_DEBUG --allow-insecure-repositories update
28 apt-get $DASHQQ_UNLESS_DEBUG -y --allow-unauthenticated install "$1" >"$STDOUT_IF_DEBUG" 2>"$STDERR_IF_DEBUG"
30 dpkg-query --show > "$ARV_PACKAGES_DIR/$1.after"
33 diff "$ARV_PACKAGES_DIR/$1.before" "$ARV_PACKAGES_DIR/$1.after" > "$ARV_PACKAGES_DIR/$1.diff"
39 export ARV_PACKAGES_DIR="/arvados/packages/$target"
41 if [[ -f $(ls -t "$ARV_PACKAGES_DIR/$1"_*.deb 2>/dev/null | head -n1) ]] ; then
42 debpkg=$(ls -t "$ARV_PACKAGES_DIR/$1"_*.deb | head -n1)
44 debpkg=$(ls -t "$ARV_PACKAGES_DIR/processed/$1"_*.deb | head -n1)
49 if [[ "$DEBUG" != "0" ]]; then
50 find -type f -name '*.so' | while read so; do
51 printf "\n== Package dependencies for %s ==\n" "$so"
52 # dpkg is not fully aware of merged-/usr systems: ldd may list a library
53 # under /lib where dpkg thinks it's under /usr/lib, or vice versa.
54 # awk constructs globs that we pass to `dpkg --search` to be flexible
55 # about which version we find. This could potentially return multiple
56 # results, but doing better probably requires restructuring this whole
57 # code to find and report the best match across multiple dpkg queries.
59 | awk 'BEGIN { ORS="\0" } ($3 ~ /^\//) {print "*" $3}' \
60 | sort --unique --zero-terminated \
61 | xargs -0 --no-run-if-empty dpkg --search \
67 exec /jenkins/package-testing/common-test-packages.sh "$1"