summaryrefslogtreecommitdiff
path: root/test/integration/test-apt-never-markauto-sections
blob: 6c88c69fafd1d55ba80782228f77b09215960617 (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
#!/bin/sh
set -e

TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework
setupenvironment
configarchitecture 'amd64' 'i386'

aptconfig dump --no-empty --format '%v%n' APT::Never-MarkAuto-Sections > nevermarkauto.sections
testsuccess grep '^metapackages$' nevermarkauto.sections

# this is a very crude regression test, not a "this is how it should be" test:
# In theory mydesktop-core and texteditor should be marked as manual, but
# texteditor is installed as a dependency of bad-texteditor, not of
# mydesktop-core and mydesktop-core is removed while bad-texteditor is
# installed losing the manual bit as the problem resolver will later decide to
# drop bad-texteditor and re-instate mydesktop-core which is considered an
# auto-install at that point (in theory the never-auto handling should be
# copied to this place – as to the many other places dependencies are resolved
# 'by hand' instead of via MarkInstall AutoInst…
#
# Both could be fixed if apt would figure out early that installing
# bad-texteditor is a bad idea and eventually it should (as mydesktop-core is
# a direct descendant of mydesktop which was a user-request mydesktop-core should
# be as protected from removal as mydesktop is), but this is hard in the general case
# as with more or-groups and provides you can produce 'legal' examples for this.

buildsimplenativepackage 'mydesktop' 'all' '1' 'unstable' 'Depends: mydesktop-core, foreignpkg
Recommends: notavailable' '' 'metapackages'
buildsimplenativepackage 'mydesktop-core' 'amd64' '1' 'unstable' 'Depends: bad-texteditor | texteditor, browser (>= 42), nosection, foreignpkg
Recommends: notavailable
Multi-Arch: foreign' '' 'metapackages'
buildsimplenativepackage 'browser' 'amd64' '41' 'stable'
buildsimplenativepackage 'browser' 'amd64' '42' 'unstable'
buildsimplenativepackage 'texteditor' 'amd64' '1' 'stable'
buildsimplenativepackage 'bad-texteditor' 'amd64' '1' 'stable' 'Depends: texteditor
Conflicts: mydesktop-core'
buildsimplenativepackage 'nosection' 'amd64' '1' 'stable' '' '' '<none>'
buildsimplenativepackage 'foreignpkg' 'i386' '1' 'stable' 'Multi-Arch: foreign'
setupaptarchive

testsuccess aptcache show nosection
testfailure grep 'Section' rootdir/tmp/testsuccess.output
testequal 'dpkg' aptmark showmanual

testsuccess aptget install mydesktop -y -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1

testequal 'browser
dpkg
foreignpkg:i386
mydesktop
nosection' aptmark showmanual
testmarkedauto 'mydesktop-core' 'texteditor'

testequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
  mydesktop mydesktop-core texteditor
0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
Remv mydesktop [1]
Remv mydesktop-core [1]
Remv texteditor [1]' aptget autoremove mydesktop -s

testequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
  mydesktop mydesktop-core texteditor
0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
Remv mydesktop [1]
Remv mydesktop-core [1]
Remv texteditor [1]' aptget autoremove texteditor -s
testsuccess aptget autoremove texteditor -y

testdpkgnotinstalled mydesktop mydesktop-core texteditor
testdpkginstalled browser

testequal 'browser
dpkg
foreignpkg:i386
nosection' aptmark showmanual
testmarkedauto

# test that installed/upgraded auto-pkgs are not set to manual

testsuccess aptget install browser=41 -y --force-yes

testequal 'browser
dpkg
foreignpkg:i386
nosection' aptmark showmanual
testmarkedauto
testsuccess aptmark auto browser
testmarkedauto 'browser'
testsuccess aptmark auto nosection
testmarkedauto 'browser' 'nosection'
testequal 'dpkg
foreignpkg:i386' aptmark showmanual

testsuccess aptget install mydesktop -y

testequal 'dpkg
foreignpkg:i386
mydesktop' aptmark showmanual
testmarkedauto 'browser' 'nosection' 'mydesktop-core' 'texteditor'