APT Cache File Format
Chapter 3 Notes on the Generator
The pkgCache::MergePackageFile function is currently the only generator of the
cache file. It implements a conversion from the normal textual package file
into the cache file.
The generator assumes any package declaration with a Status: line is a 'Status
of the package' type of package declaration. A Package with a Target-Version
field should also really have a status field. The processing of a
Target-Version field can create a place-holder Version structure that is empty
to refer to the specified version (See Version for info on what a empty Version
looks like). The Target-Version syntax allows the specification of a specific
version and a target distribution.
Different section names on different versions is supported, but I do not expect
to use it. To simplify the GUI it will merely use the section in the Package
structure. This should be okay as I hope sections do not change much.
The generator goes through a number of post processing steps after producing a
disk file. It sorts all of the version lists to be in descending order and
then generates the reverse dependency lists for all of the packages. ID
numbers and count values are also generated in the post processing step.
It is possible to extend many of the structures in the cache with extra data.
This is done by using the ID member. ID will be a unique number from 0 to
Header->??Count. For example
struct MyPkgData;
MyPkgData *Data = new MyPkgData[Header->PackageCount];
Data[Package->ID]->Item = 0;
This provides a one way reference between package structures and user data. To
get a two way reference would require a member inside the MyPkgData structure.
The generators use of free space pools tend to make the package file quite
large, and quite full of blank space. This could be fixed with sparse files.