]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-ftparchive-cachedb
Replace --force-yes by various options starting with --allow
[apt.git] / test / integration / test-apt-ftparchive-cachedb
CommitLineData
0a3b93fc
MV
1#!/bin/sh
2set -e
3
4ensure_correct_packages_file() {
5 testequal "Package: foo
e8fb1cdf
DK
6Architecture: i386
7Version: 1
0a3b93fc
MV
8Priority: optional
9Section: others
0a3b93fc 10Maintainer: Joe Sixpack <joe@example.org>
e8fb1cdf 11$(dpkg-deb -I ./aptarchive/pool/main/foo_1_i386.deb | grep 'Installed-Size:' | sed 's#^ ##')
25b86db1 12Filename: pool/main/foo_1_i386.deb" head -n8 ./aptarchive/dists/test/main/binary-i386/Packages
0a3b93fc
MV
13}
14
15ensure_correct_contents_file() {
25b86db1 16 testfileequal ./aptarchive/dists/test/Contents-i386 "usr/bin/foo-i386 others/foo
0a3b93fc
MV
17usr/share/doc/foo/FEATURES others/foo
18usr/share/doc/foo/changelog others/foo
25b86db1 19usr/share/doc/foo/copyright others/foo"
0a3b93fc
MV
20}
21
22#
23# main()
24#
25TESTDIR=$(readlink -f $(dirname $0))
26. $TESTDIR/framework
27setupenvironment
2a64259c 28configarchitecture 'i386'
0a3b93fc
MV
29
30mkdir -p aptarchive/dists/test/main/i18n/
31mkdir -p aptarchive/dists/test/main/source/
32mkdir -p aptarchive/dists/test/main/binary-i386
33mkdir -p aptarchive/pool/main
34
35mkdir aptarchive-overrides
36mkdir aptarchive-cache
37cat > ftparchive.conf <<"EOF"
38Dir {
39 ArchiveDir "./aptarchive";
40 OverrideDir "./aptarchive-overrides";
41 CacheDir "./aptarchive-cache";
42};
43
44Default {
45 Packages::Compress ". gzip bzip2";
46 Contents::Compress ". gzip bzip2";
47 LongDescription "false";
48};
49
50TreeDefault {
51 BinCacheDB "packages-$(SECTION)-$(ARCH).db";
52
53 Directory "pool/$(SECTION)";
54 SrcDirectory "pool/$(SECTION)";
55
56 Packages "$(DIST)/$(SECTION)/binary-$(ARCH)/Packages";
57 Contents "$(DIST)/Contents-$(ARCH)";
58};
59
60Tree "dists/test" {
61 Sections "main";
62 Architectures "i386";
63
64};
65EOF
66
67# build one pacakge
68buildsimplenativepackage 'foo' 'i386' '1' 'test'
69mv incoming/* aptarchive/pool/main/
70
71# generate (empty cachedb)
d9e518c6
DK
72testsuccess aptftparchive generate ftparchive.conf -q=0 -o APT::FTPArchive::ShowCacheMisses=1
73cp rootdir/tmp/testsuccess.output stats-out.txt
0a3b93fc
MV
74ensure_correct_packages_file
75ensure_correct_contents_file
d9e518c6
DK
76testsuccess grep Misses stats-out.txt
77testfileequal 'rootdir/tmp/testsuccess.output' ' Misses in Cache: 2
78 dists/test/Contents-i386: New 402 B Misses in Cache: 0'
0a3b93fc
MV
79
80# generate again
d9e518c6
DK
81testsuccess aptftparchive generate ftparchive.conf -q=0 -o APT::FTPArchive::ShowCacheMisses=1
82cp rootdir/tmp/testsuccess.output stats-out.txt
0a3b93fc
MV
83ensure_correct_packages_file
84ensure_correct_contents_file
d9e518c6
DK
85testsuccess grep Misses stats-out.txt
86testfileequal 'rootdir/tmp/testsuccess.output' ' Misses in Cache: 0
87 dists/test/Contents-i386: Misses in Cache: 0'
0a3b93fc
MV
88
89# and again (with removing the Packages file)
90rm -f ./aptarchive/dists/test/main/binary-i386/*
91rm -f ./aptarchive/dists/test/Contents-i386
d9e518c6
DK
92testsuccess aptftparchive generate ftparchive.conf -q=0 -o APT::FTPArchive::ShowCacheMisses=1
93cp rootdir/tmp/testsuccess.output stats-out.txt
0a3b93fc
MV
94ensure_correct_packages_file
95ensure_correct_contents_file
d9e518c6
DK
96testsuccess grep Misses stats-out.txt
97testfileequal 'rootdir/tmp/testsuccess.output' ' Misses in Cache: 0
98 dists/test/Contents-i386: New 402 B Misses in Cache: 0'
0a3b93fc 99
53ba4e2c
MV
100# and clean
101rm -rf aptarchive/pool/main/*
25b86db1 102testsuccessequal "packages-main-i386.db" aptftparchive clean ftparchive.conf -q=0
d9e518c6
DK
103testsuccess aptftparchive clean ftparchive.conf -q=0 -o Debug::APT::FTPArchive::Clean=1
104cp rootdir/tmp/testsuccess.output clean-out.txt
25b86db1
DK
105testsuccessequal "0 Number of unique keys in the tree" grep unique clean-out.txt
106testsuccessequal "packages-main-i386.db" grep packages-main-i386.db clean-out.txt