File: install-deps-remove-debs

package info (click to toggle)
dgit 13.19
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 4,084 kB
  • sloc: perl: 13,953; sh: 7,268; makefile: 340; python: 334; tcl: 69
file content (50 lines) | stat: -rwxr-xr-x 1,144 bytes parent folder | download | duplicates (3)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
#
# Install all dependencies for all tests for running in-tree.
# Installs then *REMOVE* all debs generated by this source package!
#
# With --our-debs-dir=DIR, instead removes all packages with debs in DIR
#
# For use in chroots.

set -e
set -o pipefail
shopt -s inherit_errexit # #514862, wtf

. tests/lib-core

x () { echo >&2 "+ $*"; "$@"; }

# Assume we'll have t2usm somehow, for these purposes.  That just means
# we don't skip the t2u-integration test and instead *do* install its deps.
deps=" $(
       export DGIT_TEST_T2USM_PROGRAM=/bin/false
       tests/enumerate-tests dep-packages
) "

case "$#.$1" in
    0.)
	our_pkgs=$(perl -ne 'print if s{^Package: }{}' debian/control)

	x apt-get -y install $our_pkgs
	;;
    1.--our-debs-dir=*)
	our_debs=$(find "${1#--our-debs-dir=}" -name '*.deb')

	our_pkgs=''; for p in $our_debs; do
	    p=${p##*/}
	    p=${p%%_*}
	    our_pkgs+=" $p"
	    deps="${deps// $p / }"
	done

	x apt-get -y install $our_debs
	;;
    *)
	fail "$0: bad usage"
	;;
esac

x apt-get -y install --no-install-recommends $deps eatmydata moreutils
x apt-get -y build-dep .
x apt-get -y remove $our_pkgs