summaryrefslogtreecommitdiffstats
path: root/test/integration/test-apt-cache
blob: c003fba8c9a67c05506ab14201335da067a1d8c3 (plain)
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#!/bin/sh
set -e

TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"

setupenvironment
configarchitecture 'amd64' 'i386'

DESCR='Some description
 That has multiple lines'
insertpackage 'unstable' 'fancy' 'all' '1'
insertpackage 'unstable,installed' 'foo' 'all' '1' 'Depends: bar
Conflicts: foobar
Recommends: cool (>= 2) | cooler (<< 5)' "$DESCR"
insertpackage 'unstable' 'bar' 'all' '1' 'Depends: bar
Breaks: foo (<< 1)
Replaces: foo (<< 1)' "$DESCR"
insertpackage 'unstable' 'specific' 'all' '1' 'Depends: bar:i386, specific:amd64
Breaks: foo:amd64 (<< 1)
Replaces: foo:i386 (<< 1)' "$DESCR"

setupaptarchive

insertinstalledpackage 'awesome' 'all' '1'
testdpkginstalled 'awesome'
testempty aptcache unmet awesome

# FIXME: Find some usecase for unmet as it seems kinda useless/broken
#testsuccess aptcache unmet
#testsuccess aptcache unmet foo

# not too useful to test, but makes coverage green…
testsuccess aptcache stats
cp rootdir/tmp/testsuccess.output stats.output
testsuccess test -s stats.output
testfailureequal 'E: apt-cache stats does not take any arguments' aptcache stats foo
testsuccess aptcache xvcg foo
cp rootdir/tmp/testsuccess.output xvcg.output
testsuccess test -s xvcg.output
testsuccess aptcache dotty foo
cp rootdir/tmp/testsuccess.output dotty.output
testsuccess test -s dotty.output
# for this, even the sourcecode says it is useless (expect debugging)
testsuccess aptcache dump
cp rootdir/tmp/testsuccess.output dump.output
testsuccess test -s dump.output

testsuccessequal 'bar
foo
awesome
specific
fancy' aptcache pkgnames
testsuccessequal 'bar' aptcache pkgnames bar
testsuccessequal 'foo
fancy' aptcache pkgnames f

testsuccessequal "       foo |          1 | file:$(readlink -f .)/aptarchive unstable/main all Packages" aptcache madison foo

### depends

testsuccessequal 'foo
  Depends: bar
  Conflicts: <foobar>
 |Recommends: <cool>
  Recommends: <cooler>' aptcache depends foo
testsuccessequal 'foo
  Depends: bar
  Conflicts: <foobar>
 |Recommends: <cool>
  Recommends: <cooler>' aptcache depends foo --implicit
testsuccessequal 'foo
  Depends: bar
  Conflicts: <foobar>
  Recommends: <cool>' aptcache depends foo -o APT::Cache::ShowOnlyFirstOr=1
testsuccessequal 'foo
  Depends: bar
  Conflicts: <foobar>
  Recommends: <cool>' aptcache depends foo -o APT::Cache::ShowOnlyFirstOr=1 --implicit
testsuccessequal 'foo
  Depends: bar
  Conflicts: <foobar>
 |Recommends: <cool> (>= 2)
  Recommends: <cooler> (<< 5)' aptcache depends foo -o APT::Cache::ShowVersion=1
testsuccessequal 'foo
  Depends: bar
  Conflicts: <foobar>
 |Recommends: <cool> (>= 2)
  Recommends: <cooler> (<< 5)' aptcache depends foo -o APT::Cache::ShowVersion=1 --implicit
testsuccessequal 'foo
  Depends: bar
  Conflicts: <foobar>' aptcache depends foo --no-recommends
testsuccessequal 'foo
  Depends: bar
  Conflicts: <foobar>' aptcache depends foo --no-recommends --implicit
testsuccessequal 'foo
  Depends: bar' aptcache depends foo --important --implicit
testsuccessequal 'foo
  Conflicts: <foobar>' aptcache depends foo --important --no-depends --conflicts
testsuccessequal 'foo
  Conflicts: <foobar>' aptcache depends foo --important --no-depends --conflicts --implicit
testsuccessequal 'foo
  Depends: bar
  Conflicts: <foobar>
 |Recommends: <cool>
  Recommends: <cooler>
bar
  Depends: bar
  Breaks: foo
  Replaces: foo
<foobar>
<cool>
<cooler>' aptcache depends foo --recurse
testsuccessequal 'foo
  Depends: bar
  Conflicts: <foobar>
 |Recommends: <cool>
  Recommends: <cooler>
bar
  Depends: bar
  Breaks: foo
  Replaces: foo
  Breaks: <foo:i386>
  Replaces: <foo:i386>
<foobar>
<cool>
<cooler>
<foo:i386>' aptcache depends foo --recurse --implicit
testsuccessequal 'foo
  Depends: bar
bar
  Depends: bar
  Replaces: foo' aptcache depends foo --recurse --important --replaces
testsuccessequal 'foo
  Depends: bar
bar
  Depends: bar
  Replaces: foo
  Replaces: <foo:i386>
<foo:i386>' aptcache depends foo --recurse --important --replaces --implicit
testsuccessequal 'bar
  Depends: bar
  Breaks: foo
  Replaces: foo' aptcache depends bar
testsuccessequal 'bar
  Depends: bar
  Breaks: foo
  Replaces: foo
  Breaks: <foo:i386>
  Replaces: <foo:i386>' aptcache depends bar --implicit

testsuccessequal 'specific
  Depends: <bar:i386>
  Depends: <specific:amd64>
    specific
  Breaks: <foo:amd64>
  Replaces: <foo:i386>' aptcache depends specific
testsuccessequal 'specific
  Depends: <bar:i386>
  Depends: <specific:amd64>
    specific
  Breaks: <foo:amd64>
  Replaces: <foo:i386>' aptcache depends specific --implicit

## rdepends

# Note that specific does not appear in this list as it doesn't depend on foo,
# but on an arch-specific foo!
testsuccessequal 'foo
Reverse Depends:
  bar
  bar' aptcache rdepends foo
testsuccessequal 'foo
Reverse Depends:
  Breaks: bar
  Replaces: bar' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1
testsuccessequal 'foo
Reverse Depends:
  Breaks: bar (<< 1)
  Replaces: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1
testsuccessequal 'foo
Reverse Depends:
  Breaks: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1 --important --breaks