4 TESTDIR
=$(readlink -f $(dirname $0))
8 configarchitecture
'amd64'
10 # note that in --print-uri we talk about .bz2 because that is the default.
11 # This doesn't mean it is actually attempt to download it.
12 configcompression
'.' 'gz'
14 buildsimplenativepackage
'foo' 'amd64' '1' 'unstable'
16 setupaptarchive
--no-update
19 testequal
"'http://localhost:8080/dists/unstable/InRelease' localhost:8080_dists_unstable_InRelease 0
20 'http://localhost:8080/dists/unstable/main/source/Sources.bz2' localhost:8080_dists_unstable_main_source_Sources 0
21 'http://localhost:8080/dists/unstable/main/binary-amd64/Packages.bz2' localhost:8080_dists_unstable_main_binary-amd64_Packages 0
22 'http://localhost:8080/dists/unstable/main/i18n/Translation-en.bz2' localhost:8080_dists_unstable_main_i18n_Translation-en 0 " aptget update
--print-uris
24 testsuccessequal
"Get:1 http://localhost:8080 unstable InRelease [$(stat -c%s aptarchive/dists/unstable/InRelease) B]
25 Get:2 http://localhost:8080 unstable/main Sources [$(stat -c%s aptarchive/dists/unstable/main/source/Sources.gz) B]
26 Get:3 http://localhost:8080 unstable/main amd64 Packages [$(stat -c%s aptarchive/dists/unstable/main/binary-amd64/Packages.gz) B]
27 Get:4 http://localhost:8080 unstable/main Translation-en [$(stat -c%s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B]
28 Reading package lists..." aptget update
30 testempty
find rootdir
/var
/lib
/apt
/lists
-name '*Contents*'
32 cat > rootdir
/etc
/apt
/apt.conf.d
/content
-target.conf
<<EOF
33 Acquire::IndexTargets::deb::Contents {
34 MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE)";
35 ShortDescription "Contents";
36 Description "\$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents";
40 testequal
"$(readlink -f ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64)" aptget indextargets
--no-release-info --format '$(FILENAME)' 'Created-By: Contents'
41 testempty aptget indextargets
--format '$(FILENAME)' 'Created-By: Contents'
42 # lets fake the existence of a compressed Contents file
43 touch .
/rootdir
/var
/lib
/apt
/lists
/localhost
:8080_dists_unstable_main_Contents
-amd64.gz
44 testequal
"$(readlink -f ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz)" aptget indextargets
--format '$(FILENAME)' 'Created-By: Contents'
46 testequal
"'http://localhost:8080/dists/unstable/InRelease' localhost:8080_dists_unstable_InRelease 0
47 'http://localhost:8080/dists/unstable/main/source/Sources.bz2' localhost:8080_dists_unstable_main_source_Sources 0
48 'http://localhost:8080/dists/unstable/main/binary-amd64/Packages.bz2' localhost:8080_dists_unstable_main_binary-amd64_Packages 0
49 'http://localhost:8080/dists/unstable/main/i18n/Translation-en.bz2' localhost:8080_dists_unstable_main_i18n_Translation-en 0
50 'http://localhost:8080/dists/unstable/main/Contents-amd64.bz2' localhost:8080_dists_unstable_main_Contents-amd64 0 " aptget update
--print-uris
52 testsuccessequal
"Hit:1 http://localhost:8080 unstable InRelease
53 Get:2 http://localhost:8080 unstable/main amd64 Contents [$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B]
54 Reading package lists..." aptget update
56 testequal
'rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64' find rootdir
/var
/lib
/apt
/lists
-name '*Contents*'
57 testequal
"$(readlink -f ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64)" aptget indextargets
--format '$(FILENAME)' 'Created-By: Contents'
58 testsuccess
cmp 'rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64' 'aptarchive/dists/unstable/main/Contents-amd64'
60 rm .
/rootdir
/var
/lib
/apt
/lists
/localhost
:8080_dists_unstable_main_Contents
-amd64
61 testempty aptget indextargets
--format '$(FILENAME)' 'Created-By: Contents'
63 # if we asked for keeping it compressed, keep it
64 echo 'Acquire::IndexTargets::deb::Contents::KeepCompressed "true";' >> rootdir
/etc
/apt
/apt.conf.d
/content
-target.conf
65 testsuccessequal
"Hit:1 http://localhost:8080 unstable InRelease
66 Get:2 http://localhost:8080 unstable/main amd64 Contents [$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B]
67 Reading package lists..." aptget update
69 testequal
'rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz' find rootdir
/var
/lib
/apt
/lists
-name '*Contents*'
70 testequal
"$(readlink -f ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz)" aptget indextargets
--format '$(FILENAME)' 'Created-By: Contents'
71 testsuccess
cmp 'rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz' 'aptarchive/dists/unstable/main/Contents-amd64.gz'
73 rm .
/rootdir
/var
/lib
/apt
/lists
/localhost
:8080_dists_unstable_main_Contents
-amd64.gz
74 testempty aptget indextargets
--format '$(FILENAME)' 'Created-By: Contents'
76 # and no automatic uncompress based on the name please,
77 # only if we downloaded a compressed file, but target was uncompressed
78 cat > rootdir
/etc
/apt
/apt.conf.d
/content
-target.conf
<<EOF
79 Acquire::IndexTargets::deb::Contents {
80 MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE).gz";
81 ShortDescription "Contents.gz";
82 Description "\$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents.gz";
86 # the last line is utter bogus of course, but how should apt know…
87 testequal
"'http://localhost:8080/dists/unstable/InRelease' localhost:8080_dists_unstable_InRelease 0
88 'http://localhost:8080/dists/unstable/main/source/Sources.bz2' localhost:8080_dists_unstable_main_source_Sources 0
89 'http://localhost:8080/dists/unstable/main/binary-amd64/Packages.bz2' localhost:8080_dists_unstable_main_binary-amd64_Packages 0
90 'http://localhost:8080/dists/unstable/main/i18n/Translation-en.bz2' localhost:8080_dists_unstable_main_i18n_Translation-en 0
91 'http://localhost:8080/dists/unstable/main/Contents-amd64.gz.bz2' localhost:8080_dists_unstable_main_Contents-amd64.gz 0 " aptget update
--print-uris
93 testsuccessequal
"Hit:1 http://localhost:8080 unstable InRelease
94 Get:2 http://localhost:8080 unstable/main amd64 Contents.gz [$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B]
95 Reading package lists..." aptget update
97 testequal
'rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz' find rootdir
/var
/lib
/apt
/lists
-name '*Contents*'
98 testequal
"$(readlink -f ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz)" aptget indextargets
--format '$(FILENAME)' 'Created-By: Contents'
99 testsuccess
cmp 'rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz' 'aptarchive/dists/unstable/main/Contents-amd64.gz'
101 rm -f rootdir
/etc
/apt
/apt.conf.d
/content
-target.conf
103 testequal
"'http://localhost:8080/dists/unstable/InRelease' localhost:8080_dists_unstable_InRelease 0
104 'http://localhost:8080/dists/unstable/main/source/Sources.bz2' localhost:8080_dists_unstable_main_source_Sources 0
105 'http://localhost:8080/dists/unstable/main/binary-amd64/Packages.bz2' localhost:8080_dists_unstable_main_binary-amd64_Packages 0
106 'http://localhost:8080/dists/unstable/main/i18n/Translation-en.bz2' localhost:8080_dists_unstable_main_i18n_Translation-en 0 " aptget update
--print-uris
108 testsuccessequal
"Hit:1 http://localhost:8080 unstable InRelease
109 Reading package lists..." aptget update
111 testempty
find rootdir
/var
/lib
/apt
/lists
-name '*Contents*'