]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-get-install-deb
tests: fail testsuccess if notices are shown, too
[apt.git] / test / integration / test-apt-get-install-deb
CommitLineData
9c3e15ab
MV
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6
7setupenvironment
5465192b 8configarchitecture 'amd64' 'i386'
9c3e15ab
MV
9
10# regression test for #754904
14341a7e 11testfailureequal 'E: Unsupported file /dev/null given on commandline' aptget install -qq /dev/null
9c3e15ab 12
5465192b
DK
13# only consider .deb files
14cat > foo.rpm <<EOF
9c3e15ab
MV
15I'm not a deb, I'm a teapot.
16EOF
14341a7e 17testfailureequal 'E: Unsupported file ./foo.rpm given on commandline' aptget install -qq ./foo.rpm
5465192b
DK
18
19# and ensure we fail for invalid debs
20mv foo.rpm foo.deb
14341a7e
DK
21testfailuremsg "E: Sub-process Popen returned an error code (2)
22E: Encountered a section with no Package: header
c9443c01 23E: Problem with MergeList ${TMPWORKINGDIRECTORY}/foo.deb
14341a7e 24E: The package lists or status file could not be parsed or opened." aptget install ./foo.deb
9c3e15ab 25
5465192b
DK
26buildsimplenativepackage 'foo' 'i386,amd64' '1.0'
27
28testfailureequal "Reading package lists...
29Building dependency tree...
30Note, selecting 'foo:i386' instead of './incoming/foo_1.0_i386.deb'
31Note, selecting 'foo' instead of './incoming/foo_1.0_amd64.deb'
32Some packages could not be installed. This may mean that you have
33requested an impossible situation or if you are using the unstable
34distribution that some required packages have not yet been created
35or been moved out of Incoming.
36The following information may help to resolve the situation:
37
38The 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
41E: Unable to correct problems, you have held broken packages." aptget install ./incoming/foo_1.0_i386.deb ./incoming/foo_1.0_amd64.deb -s -q=0
42
d61960d9 43testdpkgnotinstalled 'foo'
c9443c01 44testsuccess aptget install ./incoming/foo_1.0_i386.deb -o Debug::pkgCacheGen=1
b2640c0a 45testdpkginstalled 'foo:i386'
5465192b
DK
46
47testsuccessequal "Reading package lists...
48Building dependency tree...
49Reading state information...
50Note, selecting 'foo' instead of './incoming/foo_1.0_amd64.deb'
51The following packages will be REMOVED:
52 foo:i386
53The following NEW packages will be installed:
54 foo
550 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
56Remv foo:i386 [1.0]
c9443c01
DK
57Inst foo (1.0 local-deb [amd64])
58Conf foo (1.0 local-deb [amd64])" aptget install ./incoming/foo_1.0_amd64.deb -s -q=0
848fd2a6
JAK
59
60# Check that installing the local deb works if it is not the candidate
61echo "Package: foo
62Pin: version 1.0
63Pin-Priority: -1" > rootdir/etc/apt/preferences
64
65testsuccessequal "Reading package lists...
66Building dependency tree...
67Reading state information...
68Note, selecting 'foo' instead of './incoming/foo_1.0_amd64.deb'
69The following packages will be REMOVED:
70 foo:i386
71The following NEW packages will be installed:
72 foo
730 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
74Remv foo:i386 [1.0]
75Inst foo (1.0 local-deb [amd64])
76Conf foo (1.0 local-deb [amd64])" aptget install ./incoming/foo_1.0_amd64.deb -s -q=0
2f91076d
DK
77
78createpkg() {
79 local PKG="pkg-$1"
80 mkdir -p ./incoming/$PKG/DEBIAN
81 if [ -n "$2" ]; then
82 echo -n "$2" >> ./incoming/$PKG/DEBIAN/control
83 fi
84 echo "Package: $PKG
85Version: 0
86Priority: extra
87Maintainer: No Body <no@example.org>
88Architecture: all
89Description: test package" >> ./incoming/$PKG/DEBIAN/control
90 if [ -n "$3" ]; then
91 echo -n "$3" >> ./incoming/$PKG/DEBIAN/control
92 fi
93 testsuccess dpkg-deb --build ./incoming/$PKG/ ./incoming
94 #dpkg-deb -I ./incoming/${PKG}_0_all.deb control
95}
96createpkg 'as-it-should-be'
97createpkg 'leading-newline' '
98
99'
100createpkg 'trailing-newline' '' '
101'
102
103testsuccess aptget install ./incoming/pkg-as-it-should-be_0_all.deb
104testsuccess aptget install ./incoming/pkg-leading-newline_0_all.deb
105testsuccess aptget install ./incoming/pkg-trailing-newline_0_all.deb