]>
Commit | Line | Data |
---|---|---|
ce7f128c DK |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
4 | TESTDIR=$(readlink -f $(dirname $0)) | |
5 | . $TESTDIR/framework | |
6 | setupenvironment | |
7 | configarchitecture 'amd64' 'i386' 'armel' | |
8 | ||
9 | insertinstalledpackage 'build-essential' 'all' '0' 'Multi-Arch: foreign' | |
10 | ||
11 | insertpackage 'unstable' 'foo' 'all' '1.0' | |
12 | insertpackage 'unstable' 'bar' 'all' '1.0' | |
13 | ||
ac81c0f9 | 14 | insertsource 'unstable' 'buildprofiles' 'any' '1' 'Build-Depends: foo (>= 1.0) [i386 arm] <!stage1 !cross>, bar' |
ce7f128c DK |
15 | |
16 | # table from https://wiki.debian.org/BuildProfileSpec | |
ac81c0f9 | 17 | insertsource 'unstable' 'spec-1' 'any' '1' 'Build-Depends: foo <!stage1>' |
18 | insertsource 'unstable' 'spec-2' 'any' '1' 'Build-Depends: foo <stage1>' | |
19 | insertsource 'unstable' 'spec-3' 'any' '1' 'Build-Depends: foo <!stage1 !notest>' | |
20 | insertsource 'unstable' 'spec-4' 'any' '1' 'Build-Depends: foo <stage1 notest>' | |
21 | insertsource 'unstable' 'spec-5' 'any' '1' 'Build-Depends: foo <!stage1 notest>' | |
22 | insertsource 'unstable' 'spec-6' 'any' '1' 'Build-Depends: foo <stage1 !notest>' | |
23 | insertsource 'unstable' 'spec-7' 'any' '1' 'Build-Depends: foo <stage1> <!notest>' | |
ce7f128c DK |
24 | |
25 | setupaptarchive | |
26 | ||
25b86db1 | 27 | testsuccessequal 'Reading package lists... |
ce7f128c DK |
28 | Building dependency tree... |
29 | The following NEW packages will be installed: | |
30 | bar | |
31 | 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. | |
32 | Inst bar (1.0 unstable [all]) | |
33 | Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s | |
34 | ||
25b86db1 | 35 | testsuccessequal 'Reading package lists... |
ce7f128c DK |
36 | Building dependency tree... |
37 | The following NEW packages will be installed: | |
38 | bar foo | |
39 | 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. | |
40 | Inst bar (1.0 unstable [all]) | |
41 | Inst foo (1.0 unstable [all]) | |
42 | Conf bar (1.0 unstable [all]) | |
43 | Conf foo (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=i386 | |
44 | ||
25b86db1 | 45 | testsuccessequal 'Reading package lists... |
ce7f128c DK |
46 | Building dependency tree... |
47 | The following NEW packages will be installed: | |
48 | bar | |
49 | 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. | |
50 | Inst bar (1.0 unstable [all]) | |
51 | Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=armel | |
52 | ||
25b86db1 | 53 | testsuccessequal 'Reading package lists... |
ce7f128c DK |
54 | Building dependency tree... |
55 | The following NEW packages will be installed: | |
56 | bar | |
57 | 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. | |
58 | Inst bar (1.0 unstable [all]) | |
59 | Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=i386 -P stage1 | |
60 | ||
61 | KEEP='Reading package lists... | |
62 | Building dependency tree... | |
63 | The following NEW packages will be installed: | |
64 | foo | |
65 | 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. | |
66 | Inst foo (1.0 unstable [all]) | |
67 | Conf foo (1.0 unstable [all])' | |
39f96d07 DK |
68 | setdrop() { |
69 | DROP="Reading package lists... | |
ce7f128c | 70 | Building dependency tree... |
39f96d07 DK |
71 | $1 has no build depends. |
72 | 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." | |
73 | } | |
ce7f128c DK |
74 | |
75 | msgtest 'Check if version of installed dpkg is high enough for' 'build profiles support' | |
ac81c0f9 | 76 | if dpkg --compare-versions "$(command dpkg-query --showformat='${Version}' --show dpkg)" 'ge' '1.17.14'; then |
ce7f128c DK |
77 | msgpass |
78 | testwithdpkg() { | |
79 | msgtest "Test with" "dpkg-checkbuilddeps -d '$1' -P '$2'" | |
80 | local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwithdpkg.output" | |
81 | if dpkgcheckbuilddeps -d "$1" -P "$2" /dev/null >$OUTPUT 2>&1; then | |
82 | if [ "$3" = "$DROP" ]; then | |
83 | msgpass | |
84 | else | |
85 | cat $OUTPUT | |
86 | msgfail | |
87 | fi | |
88 | else | |
89 | if [ "$3" = "$KEEP" ]; then | |
90 | msgpass | |
91 | else | |
92 | cat $OUTPUT | |
93 | msgfail | |
94 | fi | |
95 | fi | |
96 | } | |
97 | else | |
98 | msgskip | |
99 | testwithdpkg() { | |
100 | msgtest "Test with" "dpkg-checkbuilddeps -d '$1' -P '$2'" | |
101 | msgskip | |
102 | } | |
103 | fi | |
104 | ||
105 | testprofile() { | |
106 | if [ -n "$3" ]; then | |
107 | testequal "$4" aptget build-dep "$1" -s -P "$3" | |
108 | export DEB_BUILD_PROFILES="$(echo "$3" | tr ',' ' ')" | |
109 | testequal "$4" aptget build-dep "$1" -s -o with::environment=1 | |
110 | unset DEB_BUILD_PROFILES | |
111 | else | |
112 | testequal "$4" aptget build-dep "$1" -s | |
113 | fi | |
114 | testwithdpkg "$2" "$3" "$4" | |
115 | } | |
116 | ||
39f96d07 | 117 | setdrop 'spec-1' |
ac81c0f9 | 118 | testprofile 'spec-1' 'foo <!stage1>' '' "$KEEP" |
119 | testprofile 'spec-1' 'foo <!stage1>' 'stage1' "$DROP" | |
120 | testprofile 'spec-1' 'foo <!stage1>' 'notest' "$KEEP" | |
121 | testprofile 'spec-1' 'foo <!stage1>' 'stage1,notest' "$DROP" | |
122 | ||
39f96d07 | 123 | setdrop 'spec-2' |
ac81c0f9 | 124 | testprofile 'spec-2' 'foo <stage1>' '' "$DROP" |
125 | testprofile 'spec-2' 'foo <stage1>' 'stage1' "$KEEP" | |
126 | testprofile 'spec-2' 'foo <stage1>' 'notest' "$DROP" | |
127 | testprofile 'spec-2' 'foo <stage1>' 'stage1,notest' "$KEEP" | |
128 | ||
39f96d07 | 129 | setdrop 'spec-3' |
ac81c0f9 | 130 | testprofile 'spec-3' 'foo <!stage1 !notest>' '' "$KEEP" |
131 | testprofile 'spec-3' 'foo <!stage1 !notest>' 'stage1' "$DROP" | |
132 | testprofile 'spec-3' 'foo <!stage1 !notest>' 'notest' "$DROP" | |
133 | testprofile 'spec-3' 'foo <!stage1 !notest>' 'stage1,notest' "$DROP" | |
134 | ||
39f96d07 | 135 | setdrop 'spec-4' |
ac81c0f9 | 136 | testprofile 'spec-4' 'foo <stage1 notest>' '' "$DROP" |
137 | testprofile 'spec-4' 'foo <stage1 notest>' 'stage1' "$DROP" | |
138 | testprofile 'spec-4' 'foo <stage1 notest>' 'notest' "$DROP" | |
139 | testprofile 'spec-4' 'foo <stage1 notest>' 'stage1,notest' "$KEEP" | |
140 | ||
39f96d07 | 141 | setdrop 'spec-5' |
ac81c0f9 | 142 | testprofile 'spec-5' 'foo <!stage1 notest>' '' "$DROP" |
143 | testprofile 'spec-5' 'foo <!stage1 notest>' 'stage1' "$DROP" | |
144 | testprofile 'spec-5' 'foo <!stage1 notest>' 'notest' "$KEEP" | |
145 | testprofile 'spec-5' 'foo <!stage1 notest>' 'stage1,notest' "$DROP" | |
146 | ||
39f96d07 | 147 | setdrop 'spec-6' |
ac81c0f9 | 148 | testprofile 'spec-6' 'foo <stage1 !notest>' '' "$DROP" |
149 | testprofile 'spec-6' 'foo <stage1 !notest>' 'stage1' "$KEEP" | |
150 | testprofile 'spec-6' 'foo <stage1 !notest>' 'notest' "$DROP" | |
151 | testprofile 'spec-6' 'foo <stage1 !notest>' 'stage1,notest' "$DROP" | |
152 | ||
39f96d07 | 153 | setdrop 'spec-7' |
ac81c0f9 | 154 | testprofile 'spec-7' 'foo <stage1> <!notest>' '' "$KEEP" |
155 | testprofile 'spec-7' 'foo <stage1> <!notest>' 'stage1' "$KEEP" | |
156 | testprofile 'spec-7' 'foo <stage1> <!notest>' 'notest' "$DROP" | |
157 | testprofile 'spec-7' 'foo <stage1> <!notest>' 'stage1,notest' "$KEEP" |