Merge remote-tracking branch 'mvo/bugfix/coverity' into debian/sid
[ntk/apt.git] / test / integration / test-bug-686346-package-missing-architecture
1 #!/bin/sh
2 set -e
3
4 TESTDIR=$(readlink -f $(dirname $0))
5 . $TESTDIR/framework
6 setupenvironment
7 configarchitecture 'amd64'
8
9 insertinstalledpackage 'pkgb' 'none' '1'
10 insertinstalledpackage 'pkgd' 'none' '1'
11 insertpackage 'unstable' 'pkga' 'amd64' '2' 'Depends: pkgb'
12 insertpackage 'unstable' 'pkgb' 'amd64' '2'
13 insertpackage 'unstable' 'pkgc' 'amd64' '1' 'Conflicts: pkgb'
14 insertpackage 'unstable' 'pkge' 'none' '1'
15
16 setupaptarchive
17
18 testequal 'Reading package lists...
19 Building dependency tree...
20 The following packages will be REMOVED:
21 pkgb:none
22 The following NEW packages will be installed:
23 pkgc
24 0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
25 Remv pkgb:none [1]
26 Inst pkgc (1 unstable [amd64])
27 Conf pkgc (1 unstable [amd64])' aptget install pkgc -s
28
29 testequal 'Reading package lists...
30 Building dependency tree...
31 The following extra packages will be installed:
32 pkgb
33 The following packages will be REMOVED:
34 pkgb:none
35 The following NEW packages will be installed:
36 pkga pkgb
37 0 upgraded, 2 newly installed, 1 to remove and 0 not upgraded.
38 Remv pkgb:none [1]
39 Inst pkgb (2 unstable [amd64])
40 Inst pkga (2 unstable [amd64])
41 Conf pkgb (2 unstable [amd64])
42 Conf pkga (2 unstable [amd64])' aptget install pkga -s
43
44 # ensure that arch-less stanzas from Packages files are ignored
45 msgtest 'Package is distributed in the Packages files' 'pkge'
46 grep -q 'Package: pkge' $(find aptarchive -name 'Packages') && msgpass || msgfail
47 testnopackage pkge
48 testnopackage pkge:none
49 testnopackage pkge:*
50
51 # do not automatically change from none-arch to whatever-arch as
52 # this breaks other none packages and dpkg has this ruleset as
53 # this difference seems so important that it has to be maintained …
54 testequal 'Reading package lists...
55 Building dependency tree...
56 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade -s
57
58 # pkgd has no update with an architecture
59 testdpkginstalled pkgd
60 msgtest 'Test apt-get purge' 'pkgd'
61 testsuccess --nomsg aptget purge pkgd -y
62 testdpkgnotinstalled pkgd
63
64 # there is a pkgb with an architecture
65 testdpkginstalled pkgb
66 msgtest 'Test apt-get purge' 'pkgb:none'
67 testsuccess --nomsg aptget purge pkgb:none -y
68 testdpkgnotinstalled pkgb
69
70 # check that dependencies are created after the none package exists in the cache
71 rm rootdir/var/cache/apt/*.bin
72 insertinstalledpackage 'pkgb' 'none' '1'
73 insertinstalledpackage 'pkgf' 'none' '1' 'Conflicts: pkgb'
74 insertinstalledpackage 'pkgg' 'amd64' '1' 'Conflicts: pkgb'
75 insertinstalledpackage 'pkgb' 'amd64' '2'
76 testequal "Reading package lists...
77 Building dependency tree...
78 Reading state information...
79 You might want to run 'apt-get -f install' to correct these.
80 The following packages have unmet dependencies:
81 pkgb : Conflicts: pkgb:none but 1 is installed
82 pkgb:none : Conflicts: pkgb but 2 is installed
83 pkgf:none : Conflicts: pkgb:none but 1 is installed
84 Conflicts: pkgb but 2 is installed
85 pkgg : Conflicts: pkgb but 2 is installed
86 Conflicts: pkgb:none but 1 is installed
87 E: Unmet dependencies. Try using -f." aptget check
88
89 # check that dependencies are generated for none-packages
90 rm rootdir/var/lib/dpkg/status
91 insertinstalledpackage 'pkgx' 'none' '1'
92 insertinstalledpackage 'pkgy' 'none' '1' 'Depends: pkgz, pkgx (>= 1)'
93 insertinstalledpackage 'pkgz' 'none' '1'
94 testequal 'Reading package lists...
95 Building dependency tree...
96 Reading state information...
97 The following packages will be REMOVED:
98 pkgx:none* pkgy:none*
99 0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
100 Purg pkgy:none [1]
101 Purg pkgx:none [1]' aptget purge pkgx -s
102 testequal 'Reading package lists...
103 Building dependency tree...
104 Reading state information...
105 The following packages will be REMOVED:
106 pkgy:none* pkgz:none*
107 0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
108 Purg pkgy:none [1]
109 Purg pkgz:none [1]' aptget purge pkgz -s