4 ensure_correct_packages_file
() {
5 testequal
"Package: foo
8 $(dpkg-deb -I ./aptarchive/pool/main/foo_1_i386.deb | grep 'Installed-Size:' | sed 's#^ ##')
9 Maintainer: Joe Sixpack <joe@example.org>
12 Filename: pool/main/foo_1_i386.deb" head -n8 .
/aptarchive
/dists
/test
/main
/binary
-i386/Packages
15 ensure_correct_contents_file
() {
16 testequal
"usr/bin/foo-i386 others/foo
17 usr/share/doc/foo/FEATURES others/foo
18 usr/share/doc/foo/changelog others/foo
19 usr/share/doc/foo/copyright others/foo" cat .
/aptarchive
/dists
/test
/Contents
-i386
25 TESTDIR
=$(readlink -f $(dirname $0))
28 configarchitecture
'i386'
30 mkdir -p aptarchive
/dists
/test
/main
/i
18n
/
31 mkdir -p aptarchive
/dists
/test
/main
/source
/
32 mkdir -p aptarchive
/dists
/test
/main
/binary
-i386
33 mkdir -p aptarchive
/pool
/main
35 mkdir aptarchive
-overrides
36 mkdir aptarchive
-cache
37 cat > ftparchive.conf
<<"EOF"
39 ArchiveDir "./aptarchive";
40 OverrideDir "./aptarchive-overrides";
41 CacheDir "./aptarchive-cache";
45 Packages::Compress ". gzip bzip2";
46 Contents::Compress ". gzip bzip2";
47 LongDescription "false";
51 BinCacheDB "packages-$(SECTION)-$(ARCH).db";
53 Directory "pool/$(SECTION)";
54 SrcDirectory "pool/$(SECTION)";
56 Packages "$(DIST)/$(SECTION)/binary-$(ARCH)/Packages";
57 Contents "$(DIST)/Contents-$(ARCH)";
68 buildsimplenativepackage 'foo' 'i386' '1' 'test'
69 mv incoming/* aptarchive/pool/main/
71 # generate (empty cachedb)
72 aptftparchive generate ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt
73 ensure_correct_packages_file
74 ensure_correct_contents_file
75 testequal " Misses in Cache: 2
76 dists/test/Contents-i386: New 402 B Misses in Cache: 0" grep Misses stats-out.txt
79 aptftparchive generate ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt
80 ensure_correct_packages_file
81 ensure_correct_contents_file
82 testequal " Misses in Cache: 0
83 dists/test/Contents-i386: Misses in Cache: 0" grep Misses stats-out.txt
85 # and again (with removing the Packages file)
86 rm -f ./aptarchive/dists/test/main/binary-i386/*
87 rm -f ./aptarchive/dists/test/Contents-i386
88 aptftparchive generate ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt
89 ensure_correct_packages_file
90 ensure_correct_contents_file
91 testequal " Misses in Cache: 0
92 dists/test/Contents-i386: New 402 B Misses in Cache: 0" grep Misses stats-out.txt
95 rm -rf aptarchive/pool/main/*
96 testequal "packages-main-i386.db" aptftparchive clean ftparchive.conf
97 aptftparchive clean ftparchive.conf -o Debug::APT::FTPArchive::Clean=1 > clean-out.txt 2>&1
98 testequal "0 Number of unique keys in the tree" grep unique clean-out.txt
99 testequal "packages-main-i386.db" grep packages-main-i386.db clean-out.txt