]> git.saurik.com Git - apt.git/blame - test/integration/test-bug-661537-build-profiles-support
test-apt-download-progress: Allow smaller progress change
[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])'
39f96d07
DK
68setdrop() {
69 DROP="Reading package lists...
ce7f128c 70Building dependency tree...
39f96d07
DK
71$1 has no build depends.
720 upgraded, 0 newly installed, 0 to remove and 0 not upgraded."
73}
ce7f128c
DK
74
75msgtest 'Check if version of installed dpkg is high enough for' 'build profiles support'
ac81c0f9 76if 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 }
97else
98 msgskip
99 testwithdpkg() {
100 msgtest "Test with" "dpkg-checkbuilddeps -d '$1' -P '$2'"
101 msgskip
102 }
103fi
104
105testprofile() {
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 117setdrop 'spec-1'
ac81c0f9 118testprofile 'spec-1' 'foo <!stage1>' '' "$KEEP"
119testprofile 'spec-1' 'foo <!stage1>' 'stage1' "$DROP"
120testprofile 'spec-1' 'foo <!stage1>' 'notest' "$KEEP"
121testprofile 'spec-1' 'foo <!stage1>' 'stage1,notest' "$DROP"
122
39f96d07 123setdrop 'spec-2'
ac81c0f9 124testprofile 'spec-2' 'foo <stage1>' '' "$DROP"
125testprofile 'spec-2' 'foo <stage1>' 'stage1' "$KEEP"
126testprofile 'spec-2' 'foo <stage1>' 'notest' "$DROP"
127testprofile 'spec-2' 'foo <stage1>' 'stage1,notest' "$KEEP"
128
39f96d07 129setdrop 'spec-3'
ac81c0f9 130testprofile 'spec-3' 'foo <!stage1 !notest>' '' "$KEEP"
131testprofile 'spec-3' 'foo <!stage1 !notest>' 'stage1' "$DROP"
132testprofile 'spec-3' 'foo <!stage1 !notest>' 'notest' "$DROP"
133testprofile 'spec-3' 'foo <!stage1 !notest>' 'stage1,notest' "$DROP"
134
39f96d07 135setdrop 'spec-4'
ac81c0f9 136testprofile 'spec-4' 'foo <stage1 notest>' '' "$DROP"
137testprofile 'spec-4' 'foo <stage1 notest>' 'stage1' "$DROP"
138testprofile 'spec-4' 'foo <stage1 notest>' 'notest' "$DROP"
139testprofile 'spec-4' 'foo <stage1 notest>' 'stage1,notest' "$KEEP"
140
39f96d07 141setdrop 'spec-5'
ac81c0f9 142testprofile 'spec-5' 'foo <!stage1 notest>' '' "$DROP"
143testprofile 'spec-5' 'foo <!stage1 notest>' 'stage1' "$DROP"
144testprofile 'spec-5' 'foo <!stage1 notest>' 'notest' "$KEEP"
145testprofile 'spec-5' 'foo <!stage1 notest>' 'stage1,notest' "$DROP"
146
39f96d07 147setdrop 'spec-6'
ac81c0f9 148testprofile 'spec-6' 'foo <stage1 !notest>' '' "$DROP"
149testprofile 'spec-6' 'foo <stage1 !notest>' 'stage1' "$KEEP"
150testprofile 'spec-6' 'foo <stage1 !notest>' 'notest' "$DROP"
151testprofile 'spec-6' 'foo <stage1 !notest>' 'stage1,notest' "$DROP"
152
39f96d07 153setdrop 'spec-7'
ac81c0f9 154testprofile 'spec-7' 'foo <stage1> <!notest>' '' "$KEEP"
155testprofile 'spec-7' 'foo <stage1> <!notest>' 'stage1' "$KEEP"
156testprofile 'spec-7' 'foo <stage1> <!notest>' 'notest' "$DROP"
157testprofile 'spec-7' 'foo <stage1> <!notest>' 'stage1,notest' "$KEEP"