]>
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])' | |
68 | DROP='Reading package lists... | |
69 | Building dependency tree... | |
70 | 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' | |
71 | ||
72 | msgtest 'Check if version of installed dpkg is high enough for' 'build profiles support' | |
ac81c0f9 | 73 | if dpkg --compare-versions "$(command dpkg-query --showformat='${Version}' --show dpkg)" 'ge' '1.17.14'; then |
ce7f128c DK |
74 | msgpass |
75 | testwithdpkg() { | |
76 | msgtest "Test with" "dpkg-checkbuilddeps -d '$1' -P '$2'" | |
77 | local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwithdpkg.output" | |
78 | if dpkgcheckbuilddeps -d "$1" -P "$2" /dev/null >$OUTPUT 2>&1; then | |
79 | if [ "$3" = "$DROP" ]; then | |
80 | msgpass | |
81 | else | |
82 | cat $OUTPUT | |
83 | msgfail | |
84 | fi | |
85 | else | |
86 | if [ "$3" = "$KEEP" ]; then | |
87 | msgpass | |
88 | else | |
89 | cat $OUTPUT | |
90 | msgfail | |
91 | fi | |
92 | fi | |
93 | } | |
94 | else | |
95 | msgskip | |
96 | testwithdpkg() { | |
97 | msgtest "Test with" "dpkg-checkbuilddeps -d '$1' -P '$2'" | |
98 | msgskip | |
99 | } | |
100 | fi | |
101 | ||
102 | testprofile() { | |
103 | if [ -n "$3" ]; then | |
104 | testequal "$4" aptget build-dep "$1" -s -P "$3" | |
105 | export DEB_BUILD_PROFILES="$(echo "$3" | tr ',' ' ')" | |
106 | testequal "$4" aptget build-dep "$1" -s -o with::environment=1 | |
107 | unset DEB_BUILD_PROFILES | |
108 | else | |
109 | testequal "$4" aptget build-dep "$1" -s | |
110 | fi | |
111 | testwithdpkg "$2" "$3" "$4" | |
112 | } | |
113 | ||
ac81c0f9 | 114 | testprofile 'spec-1' 'foo <!stage1>' '' "$KEEP" |
115 | testprofile 'spec-1' 'foo <!stage1>' 'stage1' "$DROP" | |
116 | testprofile 'spec-1' 'foo <!stage1>' 'notest' "$KEEP" | |
117 | testprofile 'spec-1' 'foo <!stage1>' 'stage1,notest' "$DROP" | |
118 | ||
119 | testprofile 'spec-2' 'foo <stage1>' '' "$DROP" | |
120 | testprofile 'spec-2' 'foo <stage1>' 'stage1' "$KEEP" | |
121 | testprofile 'spec-2' 'foo <stage1>' 'notest' "$DROP" | |
122 | testprofile 'spec-2' 'foo <stage1>' 'stage1,notest' "$KEEP" | |
123 | ||
124 | testprofile 'spec-3' 'foo <!stage1 !notest>' '' "$KEEP" | |
125 | testprofile 'spec-3' 'foo <!stage1 !notest>' 'stage1' "$DROP" | |
126 | testprofile 'spec-3' 'foo <!stage1 !notest>' 'notest' "$DROP" | |
127 | testprofile 'spec-3' 'foo <!stage1 !notest>' 'stage1,notest' "$DROP" | |
128 | ||
129 | testprofile 'spec-4' 'foo <stage1 notest>' '' "$DROP" | |
130 | testprofile 'spec-4' 'foo <stage1 notest>' 'stage1' "$DROP" | |
131 | testprofile 'spec-4' 'foo <stage1 notest>' 'notest' "$DROP" | |
132 | testprofile 'spec-4' 'foo <stage1 notest>' 'stage1,notest' "$KEEP" | |
133 | ||
134 | testprofile 'spec-5' 'foo <!stage1 notest>' '' "$DROP" | |
135 | testprofile 'spec-5' 'foo <!stage1 notest>' 'stage1' "$DROP" | |
136 | testprofile 'spec-5' 'foo <!stage1 notest>' 'notest' "$KEEP" | |
137 | testprofile 'spec-5' 'foo <!stage1 notest>' 'stage1,notest' "$DROP" | |
138 | ||
139 | testprofile 'spec-6' 'foo <stage1 !notest>' '' "$DROP" | |
140 | testprofile 'spec-6' 'foo <stage1 !notest>' 'stage1' "$KEEP" | |
141 | testprofile 'spec-6' 'foo <stage1 !notest>' 'notest' "$DROP" | |
142 | testprofile 'spec-6' 'foo <stage1 !notest>' 'stage1,notest' "$DROP" | |
143 | ||
144 | testprofile 'spec-7' 'foo <stage1> <!notest>' '' "$KEEP" | |
145 | testprofile 'spec-7' 'foo <stage1> <!notest>' 'stage1' "$KEEP" | |
146 | testprofile 'spec-7' 'foo <stage1> <!notest>' 'notest' "$DROP" | |
147 | testprofile 'spec-7' 'foo <stage1> <!notest>' 'stage1,notest' "$KEEP" |