]>
Commit | Line | Data |
---|---|---|
9c3e15ab MV |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
3abb6a6a DK |
4 | TESTDIR="$(readlink -f "$(dirname "$0")")" |
5 | . "$TESTDIR/framework" | |
9c3e15ab MV |
6 | |
7 | setupenvironment | |
5465192b | 8 | configarchitecture 'amd64' 'i386' |
9c3e15ab MV |
9 | |
10 | # regression test for #754904 | |
14341a7e | 11 | testfailureequal 'E: Unsupported file /dev/null given on commandline' aptget install -qq /dev/null |
9c3e15ab | 12 | |
5465192b DK |
13 | # only consider .deb files |
14 | cat > foo.rpm <<EOF | |
9c3e15ab MV |
15 | I'm not a deb, I'm a teapot. |
16 | EOF | |
14341a7e | 17 | testfailureequal 'E: Unsupported file ./foo.rpm given on commandline' aptget install -qq ./foo.rpm |
5465192b DK |
18 | |
19 | # and ensure we fail for invalid debs | |
20 | mv foo.rpm foo.deb | |
14341a7e DK |
21 | testfailuremsg "E: Sub-process Popen returned an error code (2) |
22 | E: Encountered a section with no Package: header | |
c9443c01 | 23 | E: Problem with MergeList ${TMPWORKINGDIRECTORY}/foo.deb |
14341a7e | 24 | E: The package lists or status file could not be parsed or opened." aptget install ./foo.deb |
9c3e15ab | 25 | |
5465192b DK |
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 | |
87d6947d | 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 |
5465192b | 42 | |
3dd64b9c | 43 | testdpkgnotinstalled 'foo' 'foo:i386' |
c9443c01 | 44 | testsuccess aptget install ./incoming/foo_1.0_i386.deb -o Debug::pkgCacheGen=1 |
b2640c0a | 45 | testdpkginstalled 'foo:i386' |
f359b7e8 | 46 | testfailure aptget install incoming/foo_1.0_i386.deb -o Debug::pkgCacheGen=1 |
3dd64b9c | 47 | cd downloaded |
e7edb2fe DK |
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 | |
3dd64b9c | 52 | cd .. |
5465192b DK |
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] | |
c9443c01 | 64 | Inst foo (1.0 local-deb [amd64]) |
87d6947d | 65 | Conf foo (1.0 local-deb [amd64])" aptget install ./incoming/foo_1.0_amd64.deb -s |
848fd2a6 | 66 | |
8bd823d0 DK |
67 | testsuccessequal 'Reading package lists... |
68 | Building dependency tree... | |
69 | Reading state information... | |
70 | 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget install --with-source ./incoming/foo_1.0_amd64.deb -s | |
71 | ||
72 | testsuccessequal 'Reading package lists... | |
73 | Building dependency tree... | |
74 | Reading state information... | |
75 | The following packages will be REMOVED: | |
76 | foo:i386 | |
77 | The following NEW packages will be installed: | |
78 | foo | |
79 | 0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. | |
80 | Remv foo:i386 [1.0] | |
81 | Inst foo (1.0 local-deb [amd64]) | |
82 | Conf foo (1.0 local-deb [amd64])' aptget install --with-source ./incoming/foo_1.0_amd64.deb foo -s | |
83 | ||
848fd2a6 JAK |
84 | # Check that installing the local deb works if it is not the candidate |
85 | echo "Package: foo | |
86 | Pin: version 1.0 | |
87 | Pin-Priority: -1" > rootdir/etc/apt/preferences | |
88 | ||
89 | testsuccessequal "Reading package lists... | |
90 | Building dependency tree... | |
91 | Reading state information... | |
92 | Note, selecting 'foo' instead of './incoming/foo_1.0_amd64.deb' | |
93 | The following packages will be REMOVED: | |
94 | foo:i386 | |
95 | The following NEW packages will be installed: | |
96 | foo | |
97 | 0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. | |
98 | Remv foo:i386 [1.0] | |
99 | Inst foo (1.0 local-deb [amd64]) | |
87d6947d | 100 | Conf foo (1.0 local-deb [amd64])" aptget install ./incoming/foo_1.0_amd64.deb -s |
2f91076d DK |
101 | |
102 | createpkg() { | |
103 | local PKG="pkg-$1" | |
104 | mkdir -p ./incoming/$PKG/DEBIAN | |
105 | if [ -n "$2" ]; then | |
106 | echo -n "$2" >> ./incoming/$PKG/DEBIAN/control | |
107 | fi | |
108 | echo "Package: $PKG | |
109 | Version: 0 | |
110 | Priority: extra | |
111 | Maintainer: No Body <no@example.org> | |
112 | Architecture: all | |
cb9ac09b | 113 | Depends: foo:i386 |
2f91076d DK |
114 | Description: test package" >> ./incoming/$PKG/DEBIAN/control |
115 | if [ -n "$3" ]; then | |
116 | echo -n "$3" >> ./incoming/$PKG/DEBIAN/control | |
117 | fi | |
118 | testsuccess dpkg-deb --build ./incoming/$PKG/ ./incoming | |
119 | #dpkg-deb -I ./incoming/${PKG}_0_all.deb control | |
120 | } | |
121 | createpkg 'as-it-should-be' | |
122 | createpkg 'leading-newline' ' | |
123 | ||
124 | ' | |
125 | createpkg 'trailing-newline' '' ' | |
126 | ' | |
127 | ||
128 | testsuccess aptget install ./incoming/pkg-as-it-should-be_0_all.deb | |
129 | testsuccess aptget install ./incoming/pkg-leading-newline_0_all.deb | |
130 | testsuccess aptget install ./incoming/pkg-trailing-newline_0_all.deb | |
514a25cb | 131 | |
e7edb2fe | 132 | testempty apt clean |
514a25cb | 133 | if [ "$(id -u)" = '0' ]; then |
e7edb2fe | 134 | # see if permission dropping is checked before usage |
514a25cb | 135 | chmod 711 ./incoming |
e7edb2fe DK |
136 | testsuccess aptget install -y ./incoming/pkg-as-it-should-be_0_all.deb --reinstall |
137 | testfailure grep 'is already the newest version' rootdir/tmp/testsuccess.output | |
514a25cb | 138 | chmod 710 ./incoming |
e7edb2fe DK |
139 | testsuccesswithnotice aptget install -y ./incoming/pkg-as-it-should-be_0_all.deb --reinstall |
140 | testfailure grep 'is already the newest version' rootdir/tmp/testsuccesswithnotice.output | |
514a25cb | 141 | chmod 700 ./incoming |
e7edb2fe DK |
142 | testsuccesswithnotice aptget install -y ./incoming/pkg-as-it-should-be_0_all.deb --reinstall |
143 | testfailure grep 'is already the newest version' rootdir/tmp/testsuccesswithnotice.output | |
cb9ac09b | 144 | chmod 711 ./incoming |
e7edb2fe DK |
145 | else |
146 | testsuccess aptget install -y ./incoming/pkg-as-it-should-be_0_all.deb --reinstall | |
147 | testfailure grep 'is already the newest version' rootdir/tmp/testsuccess.output | |
514a25cb | 148 | fi |
e7edb2fe | 149 | |
cb9ac09b DK |
150 | sed -i -e '/^Depends: foo/ d' rootdir/var/lib/dpkg/status |
151 | testsuccess aptget install -y ./incoming/pkg-as-it-should-be_0_all.deb | |
152 | testfailure grep 'is already the newest version' rootdir/tmp/testsuccess.output | |
8bd823d0 DK |
153 | testsuccess apt purge -y pkg-as-it-should-be |
154 | ||
155 | echo "Package: pkg-as-it-should-be | |
156 | Architecture: all | |
157 | Version: 0 | |
158 | Installed-Size: 2903 | |
159 | Filename: incoming/pkg-as-it-should-be_0_all.deb | |
160 | Size: $(stat -c %s incoming/pkg-as-it-should-be_0_all.deb) | |
161 | SHA256: $(sha256sum incoming/pkg-as-it-should-be_0_all.deb | cut -d' ' -f 1) | |
162 | " > Packages | |
163 | testdpkgnotinstalled 'pkg-as-it-should-be' | |
164 | testnopackage pkg-as-it-should-be | |
165 | testsuccess apt install --with-source ./Packages pkg-as-it-should-be -s | |
166 | testsuccess apt install --with-source ./Packages pkg-as-it-should-be --print-uris | |
167 | testsuccess apt show --with-source ./Packages pkg-as-it-should-be | |
168 | testequal 'Package: pkg-as-it-should-be' head -n1 rootdir/tmp/testsuccess.output | |
169 | testsuccess apt install -y --with-source ./Packages pkg-as-it-should-be | |
170 | testdpkginstalled 'pkg-as-it-should-be' |