summaryrefslogtreecommitdiff
path: root/test/integration/test-apt-get-source
blob: 6791bdd983ab55880c556c50e341dd0fd911ca42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/sh
set -e

TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework

setupenvironment
configarchitecture "i386"

# we need to insert a package into "unstable" so that a Release file is
# create for the test
insertpackage 'wheezy' 'unreleated-package' 'all' '1.0'

# a "normal" package with source and binary
insertpackage 'unstable' 'foo' 'all' '2.0'
insertsource 'unstable' 'foo' 'all' '2.0'

# its possible to have multiple src versions in the sources file, ensure
# to pick the correct one in this case (bts #731853)
insertsource 'stable' 'foo' 'all' '1.5'
insertsource 'stable' 'foo' 'all' '0.5'
insertpackage 'stable' 'foo' 'all' '1.0'
insertsource 'stable' 'foo' 'all' '1.0'

# this packages exists only as sources, add two versions to ensure that
# apt will pick the higher version number (bts #731853)
insertsource 'wheezy' 'foo' 'all' '0.0.1'
insertsource 'wheezy' 'foo' 'all' '0.1'

setupaptarchive

APTARCHIVE=$(readlink -f ./aptarchive)

# normal operation gets highest version number
HEADER="Reading package lists...
Building dependency tree..."
DOWNLOAD1="Need to get 0 B/25 B of source archives.
'file://${APTARCHIVE}/foo_1.0.dsc' foo_1.0.dsc 11 SHA256:ed7c25c832596339bee13e4e7c45cf49f869b60d2bf57252f18191d75866c2a7
'file://${APTARCHIVE}/foo_1.0.tar.gz' foo_1.0.tar.gz 14 SHA256:f3da8c6ebc62c8ef2dae439a498dddcdacc1a07f45ff67ad12f44b6e2353c239"
DOWNLOAD2="Need to get 0 B/25 B of source archives.
'file://${APTARCHIVE}/foo_2.0.dsc' foo_2.0.dsc 11 SHA256:0fcb803ffbeef26db884625aaf06e75f3eda5c994634980e7c20fd37ed1fc104
'file://${APTARCHIVE}/foo_2.0.tar.gz' foo_2.0.tar.gz 14 SHA256:ca9b0b828ca22372502af2b80f61f0bd9063910ece9fc34eeaf9d9e31aa8195a"
testsuccessequal "$HEADER
$DOWNLOAD2" aptget source -q --print-uris foo

# select by release: suite
testsuccessequal "$HEADER
Selected version '1.0' (stable) for foo
$DOWNLOAD1" aptget source -q --print-uris foo/stable
testsuccessequal "$HEADER
Selected version '2.0' (unstable) for foo
$DOWNLOAD2" aptget source -q --print-uris foo/unstable
testsuccessequal "$HEADER
Selected version '1.0' (stable) for foo
$DOWNLOAD1" aptget source -q --print-uris foo -t stable
testsuccessequal "$HEADER
Selected version '2.0' (unstable) for foo
$DOWNLOAD2" aptget source -q --print-uris foo -t unstable

# select by release: codename
testsuccessequal "$HEADER
Selected version '2.0' (sid) for foo
$DOWNLOAD2" aptget source -q --print-uris foo/sid
testsuccessequal "$HEADER
Selected version '2.0' (sid) for foo
$DOWNLOAD2" aptget source -q --print-uris foo -t sid

# select by version
testsuccessequal "$HEADER
$DOWNLOAD1" aptget source -q --print-uris foo=1.0

# select by release with no binary package (Bug#731102) but ensure to get
# highest version
DOWNLOAD01="Need to get 0 B/25 B of source archives.
'file://${APTARCHIVE}/foo_0.1.dsc' foo_0.1.dsc 11 SHA256:72af24b0290fe1d13a3e25fddd2633e43c87ff79d249bc850009e47bcce73565
'file://${APTARCHIVE}/foo_0.1.tar.gz' foo_0.1.tar.gz 14 SHA256:ec748ad88a71f98bfdc012e1a7632377d05fe3ebbf9c0922e0691fe4d79c0585"
testsuccessequal "$HEADER
Selected version '0.1' (wheezy) for foo
$DOWNLOAD01" aptget source -q --print-uris foo/wheezy

# unavailable one
testfailureequal "$HEADER
E: Can not find version '9.9-not-there' of package 'foo'
E: Unable to find a source package for foo" aptget source -q --print-uris foo=9.9-not-there

# version and release
DOWNLOAD001="Need to get 0 B/29 B of source archives.
'file://${APTARCHIVE}/foo_0.0.1.dsc' foo_0.0.1.dsc 13 SHA256:649dfe03bbb70cebdfe7c6bf9036f9f2472510b8f52e823bdf5ade362ebaa76f
'file://${APTARCHIVE}/foo_0.0.1.tar.gz' foo_0.0.1.tar.gz 16 SHA256:ab7ba789d178362ecc808e49705e2338988a7f5b9410ec11a6c9555c017de907"
testsuccessequal "$HEADER
$DOWNLOAD001" aptget source -q --print-uris -t unstable foo=0.0.1

testsuccessequal "$HEADER
Need to get 0 B/25 B of source archives.
Fetch source foo" aptget source -q -s foo