aboutsummaryrefslogtreecommitdiff
path: root/test_pbuilder-satisfydepends-funcs
blob: 4eaa665ec118d2abbbf190da45d5a85520ee46da (plain)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash

# testsuite to test pbuilder-satisfydepends-funcs.

if [ -n "$PBUILDER_CHECKOUT" ]; then
    . "$PBUILDER_CHECKOUT/testlib.sh"

    . "$PBUILDER_CHECKOUT/pbuilder-satisfydepends-funcs"
else
    # these currently don't need to be exported
    PBUILDER_TEST_ROOT="${PBUILDER_ROOT:-}"
    PBUILDER_TEST_PKGLIBDIR="${PBUILDER_PKGLIBDIR:-$PBUILDER_ROOT/usr/lib/pbuilder}"
    . "$PBUILDER_TEST_PKGLIBDIR/testlib.sh"

    . "$PBUILDER_TEST_PKGLIBDIR/pbuilder-satisfydepends-funcs"
fi

DEBIAN_CONTROL=""

cleanup() {
    if [ -n "$DEBIAN_CONTROL" ]; then
        rm -f "$DEBIAN_CONTROL"
    fi
}

test_get_build_deps() {
    local BINARY_ARCH

    BINARY_ARCH="$1"

    cat <<EOF >"$DEBIAN_CONTROL"
Source: amule
XXXX:
Build-Depends: 
 autotools-dev ( >= 1.2 ) ,
	 debhelper 	,
 quilt(<<12:0),
##
 libwxgtk2.8-dev
Build-Depends-Indep: test [ amd64 i386 ], test1, 
 test2[!i386 ! amd64], test3 | 
 test4, test5
Misc: test

Build-Depends: wrong build depends, line
Description: test
 other things
 wow
EOF
    get_build_deps
}

test_get_build_deps_dsc() {
    cat <<EOF >"$DEBIAN_CONTROL"
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.0
Source: hello-debhelper
Build-Depends: debhelper (>= 7)
Checksums-Sha1: 
 fcbf0264928900adf03a7797474375e1a6fa3836 499638 hello-debhelper_2.4.orig.tar.gz
 0ea70eb46b4c90a8dbefbe60bebe4b9f9abb2733 5308 hello-debhelper_2.4-3.diff.gz


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iQEcBAEBCAAGBQJKml74AAoJEEHOfwufG4sysC4H/26EikyIgIqRuSXMiykc1hmd
97id9nWl+QzgCpUEg/+uDqEW+Bl6291FstGvzTFCwmB5JjH9ErH1LsyG1OLXbFUb
H89Em7qkl4o2ACTh255oM7FhVweof3UEaLCZMH+HZVVpHXNpEnhrfDvpTBbPGjUi
-----END PGP SIGNATURE-----
EOF
    get_build_deps
}

trap cleanup sigpipe sighup exit

# TODO move to build dir
DEBIAN_CONTROL="$(tempfile)"

expect_output "autotools-dev (>= 1.2), debhelper, quilt (<< 12:0), libwxgtk2.8-dev, test [amd64 i386], test1, test2 [!i386 !amd64], test3 | test4, test5" \
    test_get_build_deps "no"
expect_output "autotools-dev (>= 1.2), debhelper, quilt (<< 12:0), libwxgtk2.8-dev" \
    test_get_build_deps "yes"

expect_output "debhelper (>= 7)" test_get_build_deps_dsc

testlib_summary