]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | set -e | |
3 | ||
4 | TESTDIR="$(readlink -f "$(dirname "$0")")" | |
5 | . "$TESTDIR/framework" | |
6 | ||
7 | setupenvironment | |
8 | configarchitecture 'amd64' 'i386' | |
9 | ||
10 | # regression test for #754904 | |
11 | testfailureequal 'E: Unsupported file /dev/null given on commandline' aptget install -qq /dev/null | |
12 | ||
13 | # only consider .deb files | |
14 | cat > foo.rpm <<EOF | |
15 | I'm not a deb, I'm a teapot. | |
16 | EOF | |
17 | testfailureequal 'E: Unsupported file ./foo.rpm given on commandline' aptget install -qq ./foo.rpm | |
18 | ||
19 | # and ensure we fail for invalid debs | |
20 | mv foo.rpm foo.deb | |
21 | testfailuremsg "E: Sub-process Popen returned an error code (2) | |
22 | E: Encountered a section with no Package: header | |
23 | E: Problem with MergeList ${TMPWORKINGDIRECTORY}/foo.deb | |
24 | E: The package lists or status file could not be parsed or opened." aptget install ./foo.deb | |
25 | ||
26 | buildsimplenativepackage 'foo' 'i386,amd64' '1.0' | |
27 | ||
28 | testfailureequal "Reading package lists... | |
29 | Building dependency tree... | |
30 | Note, selecting 'foo:i386' instead of './incoming/foo_1.0_i386.deb' | |
31 | Note, selecting 'foo' instead of './incoming/foo_1.0_amd64.deb' | |
32 | Some packages could not be installed. This may mean that you have | |
33 | requested an impossible situation or if you are using the unstable | |
34 | distribution that some required packages have not yet been created | |
35 | or been moved out of Incoming. | |
36 | The following information may help to resolve the situation: | |
37 | ||
38 | The following packages have unmet dependencies: | |
39 | foo:i386 : Conflicts: foo but 1.0 is to be installed | |
40 | foo : Conflicts: foo:i386 but 1.0 is to be installed | |
41 | E: Unable to correct problems, you have held broken packages." aptget install ./incoming/foo_1.0_i386.deb ./incoming/foo_1.0_amd64.deb -s | |
42 | ||
43 | testdpkgnotinstalled 'foo' 'foo:i386' | |
44 | testsuccess aptget install ./incoming/foo_1.0_i386.deb -o Debug::pkgCacheGen=1 | |
45 | testdpkginstalled 'foo:i386' | |
46 | testfailure aptget install incoming/foo_1.0_i386.deb -o Debug::pkgCacheGen=1 | |
47 | cd downloaded | |
48 | testsuccess aptget install "$(readlink -f ../incoming/foo_1.0_i386.deb)" -o Debug::pkgCacheGen=1 -y --reinstall | |
49 | testfailure grep 'is already the newest version' ../rootdir/tmp/testsuccess.output | |
50 | testsuccess aptget install ../incoming/foo_1.0_i386.deb -o Debug::pkgCacheGen=1 -y --reinstall | |
51 | testfailure grep 'is already the newest version' ../rootdir/tmp/testsuccess.output | |
52 | cd .. | |
53 | ||
54 | testsuccessequal "Reading package lists... | |
55 | Building dependency tree... | |
56 | Reading state information... | |
57 | Note, selecting 'foo' instead of './incoming/foo_1.0_amd64.deb' | |
58 | The following packages will be REMOVED: | |
59 | foo:i386 | |
60 | The following NEW packages will be installed: | |
61 | foo | |
62 | 0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. | |
63 | Remv foo:i386 [1.0] | |
64 | Inst foo (1.0 local-deb [amd64]) | |
65 | Conf foo (1.0 local-deb [amd64])" aptget install ./incoming/foo_1.0_amd64.deb -s | |
66 | ||
67 | # Check that installing the local deb works if it is not the candidate | |
68 | echo "Package: foo | |
69 | Pin: version 1.0 | |
70 | Pin-Priority: -1" > rootdir/etc/apt/preferences | |
71 | ||
72 | testsuccessequal "Reading package lists... | |
73 | Building dependency tree... | |
74 | Reading state information... | |
75 | Note, selecting 'foo' instead of './incoming/foo_1.0_amd64.deb' | |
76 | The following packages will be REMOVED: | |
77 | foo:i386 | |
78 | The following NEW packages will be installed: | |
79 | foo | |
80 | 0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. | |
81 | Remv foo:i386 [1.0] | |
82 | Inst foo (1.0 local-deb [amd64]) | |
83 | Conf foo (1.0 local-deb [amd64])" aptget install ./incoming/foo_1.0_amd64.deb -s | |
84 | ||
85 | createpkg() { | |
86 | local PKG="pkg-$1" | |
87 | mkdir -p ./incoming/$PKG/DEBIAN | |
88 | if [ -n "$2" ]; then | |
89 | echo -n "$2" >> ./incoming/$PKG/DEBIAN/control | |
90 | fi | |
91 | echo "Package: $PKG | |
92 | Version: 0 | |
93 | Priority: extra | |
94 | Maintainer: No Body <no@example.org> | |
95 | Architecture: all | |
96 | Depends: foo:i386 | |
97 | Description: test package" >> ./incoming/$PKG/DEBIAN/control | |
98 | if [ -n "$3" ]; then | |
99 | echo -n "$3" >> ./incoming/$PKG/DEBIAN/control | |
100 | fi | |
101 | testsuccess dpkg-deb --build ./incoming/$PKG/ ./incoming | |
102 | #dpkg-deb -I ./incoming/${PKG}_0_all.deb control | |
103 | } | |
104 | createpkg 'as-it-should-be' | |
105 | createpkg 'leading-newline' ' | |
106 | ||
107 | ' | |
108 | createpkg 'trailing-newline' '' ' | |
109 | ' | |
110 | ||
111 | testsuccess aptget install ./incoming/pkg-as-it-should-be_0_all.deb | |
112 | testsuccess aptget install ./incoming/pkg-leading-newline_0_all.deb | |
113 | testsuccess aptget install ./incoming/pkg-trailing-newline_0_all.deb | |
114 | ||
115 | testempty apt clean | |
116 | if [ "$(id -u)" = '0' ]; then | |
117 | # see if permission dropping is checked before usage | |
118 | chmod 711 ./incoming | |
119 | testsuccess aptget install -y ./incoming/pkg-as-it-should-be_0_all.deb --reinstall | |
120 | testfailure grep 'is already the newest version' rootdir/tmp/testsuccess.output | |
121 | chmod 710 ./incoming | |
122 | testsuccesswithnotice aptget install -y ./incoming/pkg-as-it-should-be_0_all.deb --reinstall | |
123 | testfailure grep 'is already the newest version' rootdir/tmp/testsuccesswithnotice.output | |
124 | chmod 700 ./incoming | |
125 | testsuccesswithnotice aptget install -y ./incoming/pkg-as-it-should-be_0_all.deb --reinstall | |
126 | testfailure grep 'is already the newest version' rootdir/tmp/testsuccesswithnotice.output | |
127 | chmod 711 ./incoming | |
128 | else | |
129 | testsuccess aptget install -y ./incoming/pkg-as-it-should-be_0_all.deb --reinstall | |
130 | testfailure grep 'is already the newest version' rootdir/tmp/testsuccess.output | |
131 | fi | |
132 | ||
133 | sed -i -e '/^Depends: foo/ d' rootdir/var/lib/dpkg/status | |
134 | testsuccess aptget install -y ./incoming/pkg-as-it-should-be_0_all.deb | |
135 | testfailure grep 'is already the newest version' rootdir/tmp/testsuccess.output |