]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-get-install-deb
deal with configured build-essential first
[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
87d6947d 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
5465192b 42
3dd64b9c 43testdpkgnotinstalled 'foo' 'foo:i386'
c9443c01 44testsuccess aptget install ./incoming/foo_1.0_i386.deb -o Debug::pkgCacheGen=1
b2640c0a 45testdpkginstalled 'foo:i386'
3dd64b9c
DK
46cd downloaded
47testsuccess aptget install "$(readlink -f ../incoming/foo_1.0_i386.deb)" -o Debug::pkgCacheGen=1 -y --allow-downgrades
48testsuccess aptget install ../incoming/foo_1.0_i386.deb -o Debug::pkgCacheGen=1 -y --allow-downgrades
49cd ..
5465192b
DK
50
51testsuccessequal "Reading package lists...
52Building dependency tree...
53Reading state information...
54Note, selecting 'foo' instead of './incoming/foo_1.0_amd64.deb'
55The following packages will be REMOVED:
56 foo:i386
57The following NEW packages will be installed:
58 foo
590 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
60Remv foo:i386 [1.0]
c9443c01 61Inst foo (1.0 local-deb [amd64])
87d6947d 62Conf foo (1.0 local-deb [amd64])" aptget install ./incoming/foo_1.0_amd64.deb -s
848fd2a6
JAK
63
64# Check that installing the local deb works if it is not the candidate
65echo "Package: foo
66Pin: version 1.0
67Pin-Priority: -1" > rootdir/etc/apt/preferences
68
69testsuccessequal "Reading package lists...
70Building dependency tree...
71Reading state information...
72Note, selecting 'foo' instead of './incoming/foo_1.0_amd64.deb'
73The following packages will be REMOVED:
74 foo:i386
75The following NEW packages will be installed:
76 foo
770 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
78Remv foo:i386 [1.0]
79Inst foo (1.0 local-deb [amd64])
87d6947d 80Conf foo (1.0 local-deb [amd64])" aptget install ./incoming/foo_1.0_amd64.deb -s
2f91076d
DK
81
82createpkg() {
83 local PKG="pkg-$1"
84 mkdir -p ./incoming/$PKG/DEBIAN
85 if [ -n "$2" ]; then
86 echo -n "$2" >> ./incoming/$PKG/DEBIAN/control
87 fi
88 echo "Package: $PKG
89Version: 0
90Priority: extra
91Maintainer: No Body <no@example.org>
92Architecture: all
93Description: test package" >> ./incoming/$PKG/DEBIAN/control
94 if [ -n "$3" ]; then
95 echo -n "$3" >> ./incoming/$PKG/DEBIAN/control
96 fi
97 testsuccess dpkg-deb --build ./incoming/$PKG/ ./incoming
98 #dpkg-deb -I ./incoming/${PKG}_0_all.deb control
99}
100createpkg 'as-it-should-be'
101createpkg 'leading-newline' '
102
103'
104createpkg 'trailing-newline' '' '
105'
106
107testsuccess aptget install ./incoming/pkg-as-it-should-be_0_all.deb
108testsuccess aptget install ./incoming/pkg-leading-newline_0_all.deb
109testsuccess aptget install ./incoming/pkg-trailing-newline_0_all.deb
514a25cb
DK
110
111# see if permission dropping is checked before usage
112if [ "$(id -u)" = '0' ]; then
113 apt clean
114 chmod 711 ./incoming
87d6947d 115 testsuccess aptget install -y --allow-downgrades ./incoming/pkg-as-it-should-be_0_all.deb
514a25cb 116 chmod 710 ./incoming
87d6947d 117 testsuccesswithnotice aptget install -y --allow-downgrades ./incoming/pkg-as-it-should-be_0_all.deb
514a25cb 118 chmod 700 ./incoming
87d6947d 119 testsuccesswithnotice aptget install -y --allow-downgrades ./incoming/pkg-as-it-should-be_0_all.deb
514a25cb 120fi