]> git.saurik.com Git - apt.git/blame - test/integration/test-bug-661537-build-profiles-support
pass versioned provides to external solvers in EDSP
[apt.git] / test / integration / test-bug-661537-build-profiles-support
CommitLineData
ce7f128c
DK
1#!/bin/sh
2set -e
3
3abb6a6a
DK
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
ce7f128c
DK
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...
a249b3e6 28Reading package lists...
ce7f128c
DK
29Building dependency tree...
30The following NEW packages will be installed:
31 bar
320 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
33Inst bar (1.0 unstable [all])
34Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s
35
25b86db1 36testsuccessequal 'Reading package lists...
ce7f128c
DK
37Building dependency tree...
38The following NEW packages will be installed:
39 bar foo
400 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
41Inst bar (1.0 unstable [all])
42Inst foo (1.0 unstable [all])
43Conf bar (1.0 unstable [all])
44Conf foo (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=i386
45
25b86db1 46testsuccessequal 'Reading package lists...
ce7f128c
DK
47Building dependency tree...
48The following NEW packages will be installed:
49 bar
500 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
51Inst bar (1.0 unstable [all])
52Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=armel
53
25b86db1 54testsuccessequal 'Reading package lists...
ce7f128c
DK
55Building dependency tree...
56The following NEW packages will be installed:
57 bar
580 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
59Inst bar (1.0 unstable [all])
60Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=i386 -P stage1
61
62KEEP='Reading package lists...
a249b3e6 63Reading package lists...
ce7f128c
DK
64Building dependency tree...
65The following NEW packages will be installed:
66 foo
670 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
68Inst foo (1.0 unstable [all])
69Conf foo (1.0 unstable [all])'
39f96d07
DK
70setdrop() {
71 DROP="Reading package lists...
39f96d07 72$1 has no build depends.
a249b3e6
DK
73Reading package lists...
74Building dependency tree...
39f96d07
DK
750 upgraded, 0 newly installed, 0 to remove and 0 not upgraded."
76}
ce7f128c
DK
77
78msgtest 'Check if version of installed dpkg is high enough for' 'build profiles support'
ac81c0f9 79if dpkg --compare-versions "$(command dpkg-query --showformat='${Version}' --show dpkg)" 'ge' '1.17.14'; then
ce7f128c
DK
80 msgpass
81 testwithdpkg() {
82 msgtest "Test with" "dpkg-checkbuilddeps -d '$1' -P '$2'"
83 local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwithdpkg.output"
84 if dpkgcheckbuilddeps -d "$1" -P "$2" /dev/null >$OUTPUT 2>&1; then
85 if [ "$3" = "$DROP" ]; then
86 msgpass
87 else
88 cat $OUTPUT
89 msgfail
90 fi
91 else
92 if [ "$3" = "$KEEP" ]; then
93 msgpass
94 else
95 cat $OUTPUT
96 msgfail
97 fi
98 fi
99 }
100else
101 msgskip
102 testwithdpkg() {
103 msgtest "Test with" "dpkg-checkbuilddeps -d '$1' -P '$2'"
104 msgskip
105 }
106fi
107
108testprofile() {
109 if [ -n "$3" ]; then
110 testequal "$4" aptget build-dep "$1" -s -P "$3"
111 export DEB_BUILD_PROFILES="$(echo "$3" | tr ',' ' ')"
112 testequal "$4" aptget build-dep "$1" -s -o with::environment=1
113 unset DEB_BUILD_PROFILES
114 else
115 testequal "$4" aptget build-dep "$1" -s
116 fi
117 testwithdpkg "$2" "$3" "$4"
118}
119
a249b3e6 120testsuccess aptcache gencaches
39f96d07 121setdrop 'spec-1'
ac81c0f9 122testprofile 'spec-1' 'foo <!stage1>' '' "$KEEP"
123testprofile 'spec-1' 'foo <!stage1>' 'stage1' "$DROP"
124testprofile 'spec-1' 'foo <!stage1>' 'notest' "$KEEP"
125testprofile 'spec-1' 'foo <!stage1>' 'stage1,notest' "$DROP"
126
39f96d07 127setdrop 'spec-2'
ac81c0f9 128testprofile 'spec-2' 'foo <stage1>' '' "$DROP"
129testprofile 'spec-2' 'foo <stage1>' 'stage1' "$KEEP"
130testprofile 'spec-2' 'foo <stage1>' 'notest' "$DROP"
131testprofile 'spec-2' 'foo <stage1>' 'stage1,notest' "$KEEP"
132
39f96d07 133setdrop 'spec-3'
ac81c0f9 134testprofile 'spec-3' 'foo <!stage1 !notest>' '' "$KEEP"
135testprofile 'spec-3' 'foo <!stage1 !notest>' 'stage1' "$DROP"
136testprofile 'spec-3' 'foo <!stage1 !notest>' 'notest' "$DROP"
137testprofile 'spec-3' 'foo <!stage1 !notest>' 'stage1,notest' "$DROP"
138
39f96d07 139setdrop 'spec-4'
ac81c0f9 140testprofile 'spec-4' 'foo <stage1 notest>' '' "$DROP"
141testprofile 'spec-4' 'foo <stage1 notest>' 'stage1' "$DROP"
142testprofile 'spec-4' 'foo <stage1 notest>' 'notest' "$DROP"
143testprofile 'spec-4' 'foo <stage1 notest>' 'stage1,notest' "$KEEP"
144
39f96d07 145setdrop 'spec-5'
ac81c0f9 146testprofile 'spec-5' 'foo <!stage1 notest>' '' "$DROP"
147testprofile 'spec-5' 'foo <!stage1 notest>' 'stage1' "$DROP"
148testprofile 'spec-5' 'foo <!stage1 notest>' 'notest' "$KEEP"
149testprofile 'spec-5' 'foo <!stage1 notest>' 'stage1,notest' "$DROP"
150
39f96d07 151setdrop 'spec-6'
ac81c0f9 152testprofile 'spec-6' 'foo <stage1 !notest>' '' "$DROP"
153testprofile 'spec-6' 'foo <stage1 !notest>' 'stage1' "$KEEP"
154testprofile 'spec-6' 'foo <stage1 !notest>' 'notest' "$DROP"
155testprofile 'spec-6' 'foo <stage1 !notest>' 'stage1,notest' "$DROP"
156
39f96d07 157setdrop 'spec-7'
ac81c0f9 158testprofile 'spec-7' 'foo <stage1> <!notest>' '' "$KEEP"
159testprofile 'spec-7' 'foo <stage1> <!notest>' 'stage1' "$KEEP"
160testprofile 'spec-7' 'foo <stage1> <!notest>' 'notest' "$DROP"
161testprofile 'spec-7' 'foo <stage1> <!notest>' 'stage1,notest' "$KEEP"