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