]> git.saurik.com Git - apt.git/blame - test/integration/test-bug-661537-build-profiles-support
sync TFRewrite*Order arrays with dpkg and dak
[apt.git] / test / integration / test-bug-661537-build-profiles-support
CommitLineData
ce7f128c
DK
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6setupenvironment
7configarchitecture 'amd64' 'i386' 'armel'
8
9insertinstalledpackage 'build-essential' 'all' '0' 'Multi-Arch: foreign'
10
11insertpackage 'unstable' 'foo' 'all' '1.0'
12insertpackage 'unstable' 'bar' 'all' '1.0'
13
ac81c0f9 14insertsource '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 17insertsource 'unstable' 'spec-1' 'any' '1' 'Build-Depends: foo <!stage1>'
18insertsource 'unstable' 'spec-2' 'any' '1' 'Build-Depends: foo <stage1>'
19insertsource 'unstable' 'spec-3' 'any' '1' 'Build-Depends: foo <!stage1 !notest>'
20insertsource 'unstable' 'spec-4' 'any' '1' 'Build-Depends: foo <stage1 notest>'
21insertsource 'unstable' 'spec-5' 'any' '1' 'Build-Depends: foo <!stage1 notest>'
22insertsource 'unstable' 'spec-6' 'any' '1' 'Build-Depends: foo <stage1 !notest>'
23insertsource 'unstable' 'spec-7' 'any' '1' 'Build-Depends: foo <stage1> <!notest>'
ce7f128c
DK
24
25setupaptarchive
26
25b86db1 27testsuccessequal 'Reading package lists...
ce7f128c
DK
28Building dependency tree...
29The following NEW packages will be installed:
30 bar
310 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
32Inst bar (1.0 unstable [all])
33Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s
34
25b86db1 35testsuccessequal 'Reading package lists...
ce7f128c
DK
36Building dependency tree...
37The following NEW packages will be installed:
38 bar foo
390 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
40Inst bar (1.0 unstable [all])
41Inst foo (1.0 unstable [all])
42Conf bar (1.0 unstable [all])
43Conf foo (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=i386
44
25b86db1 45testsuccessequal 'Reading package lists...
ce7f128c
DK
46Building dependency tree...
47The following NEW packages will be installed:
48 bar
490 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
50Inst bar (1.0 unstable [all])
51Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=armel
52
25b86db1 53testsuccessequal 'Reading package lists...
ce7f128c
DK
54Building dependency tree...
55The following NEW packages will be installed:
56 bar
570 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
58Inst bar (1.0 unstable [all])
59Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=i386 -P stage1
60
61KEEP='Reading package lists...
62Building dependency tree...
63The following NEW packages will be installed:
64 foo
650 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
66Inst foo (1.0 unstable [all])
67Conf foo (1.0 unstable [all])'
68DROP='Reading package lists...
69Building dependency tree...
700 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.'
71
72msgtest 'Check if version of installed dpkg is high enough for' 'build profiles support'
ac81c0f9 73if 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 }
94else
95 msgskip
96 testwithdpkg() {
97 msgtest "Test with" "dpkg-checkbuilddeps -d '$1' -P '$2'"
98 msgskip
99 }
100fi
101
102testprofile() {
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 114testprofile 'spec-1' 'foo <!stage1>' '' "$KEEP"
115testprofile 'spec-1' 'foo <!stage1>' 'stage1' "$DROP"
116testprofile 'spec-1' 'foo <!stage1>' 'notest' "$KEEP"
117testprofile 'spec-1' 'foo <!stage1>' 'stage1,notest' "$DROP"
118
119testprofile 'spec-2' 'foo <stage1>' '' "$DROP"
120testprofile 'spec-2' 'foo <stage1>' 'stage1' "$KEEP"
121testprofile 'spec-2' 'foo <stage1>' 'notest' "$DROP"
122testprofile 'spec-2' 'foo <stage1>' 'stage1,notest' "$KEEP"
123
124testprofile 'spec-3' 'foo <!stage1 !notest>' '' "$KEEP"
125testprofile 'spec-3' 'foo <!stage1 !notest>' 'stage1' "$DROP"
126testprofile 'spec-3' 'foo <!stage1 !notest>' 'notest' "$DROP"
127testprofile 'spec-3' 'foo <!stage1 !notest>' 'stage1,notest' "$DROP"
128
129testprofile 'spec-4' 'foo <stage1 notest>' '' "$DROP"
130testprofile 'spec-4' 'foo <stage1 notest>' 'stage1' "$DROP"
131testprofile 'spec-4' 'foo <stage1 notest>' 'notest' "$DROP"
132testprofile 'spec-4' 'foo <stage1 notest>' 'stage1,notest' "$KEEP"
133
134testprofile 'spec-5' 'foo <!stage1 notest>' '' "$DROP"
135testprofile 'spec-5' 'foo <!stage1 notest>' 'stage1' "$DROP"
136testprofile 'spec-5' 'foo <!stage1 notest>' 'notest' "$KEEP"
137testprofile 'spec-5' 'foo <!stage1 notest>' 'stage1,notest' "$DROP"
138
139testprofile 'spec-6' 'foo <stage1 !notest>' '' "$DROP"
140testprofile 'spec-6' 'foo <stage1 !notest>' 'stage1' "$KEEP"
141testprofile 'spec-6' 'foo <stage1 !notest>' 'notest' "$DROP"
142testprofile 'spec-6' 'foo <stage1 !notest>' 'stage1,notest' "$DROP"
143
144testprofile 'spec-7' 'foo <stage1> <!notest>' '' "$KEEP"
145testprofile 'spec-7' 'foo <stage1> <!notest>' 'stage1' "$KEEP"
146testprofile 'spec-7' 'foo <stage1> <!notest>' 'notest' "$DROP"
147testprofile 'spec-7' 'foo <stage1> <!notest>' 'stage1,notest' "$KEEP"