1 // -*- mode: cpp; mode: fold -*-
4 \brief pkgCache - Structure definitions for the cache file
6 The goal of the cache file is two fold:
7 Firstly to speed loading and processing of the package file array and
8 secondly to reduce memory consumption of the package file array.
10 The implementation is aimed at an environment with many primary package
11 files, for instance someone that has a Package file for their CD-ROM, a
12 Package file for the latest version of the distribution on the CD-ROM and a
13 package file for the development version. Always present is the information
14 contained in the status file which might be considered a separate package
17 Please understand, this is designed as a <b>Cache file</b> it is not meant to be
18 used on any system other than the one it was created for. It is not meant to
19 be authoritative either, i.e. if a system crash or software failure occurs it
20 must be perfectly acceptable for the cache file to be in an inconsistent
21 state. Furthermore at any time the cache file may be erased without losing
24 Also the structures and storage layout is optimized for use by the APT
25 and may not be suitable for all purposes. However it should be possible
26 to extend it with associate cache files that contain other information.
28 To keep memory use down the cache file only contains often used fields and
29 fields that are inexpensive to store, the Package file has a full list of
30 fields. Also the client may assume that all items are perfectly valid and
31 need not perform checks against their correctness. Removal of information
32 from the cache is possible, but blanks will be left in the file, and
33 unused strings will also be present. The recommended implementation is to
34 simply rebuild the cache each time any of the data files change. It is
35 possible to add a new package file to the cache without any negative side
38 <b>Note on Pointer access</b>
39 Clients should always use the CacheIterators classes for access to the
40 cache and the data in it. They also provide a simple STL-like method for
41 traversing the links of the datastructure.
43 Every item in every structure is stored as the index to that structure.
44 What this means is that once the files is mmaped every data access has to
45 go through a fix up stage to get a real memory pointer. This is done
46 by taking the index, multiplying it by the type size and then adding
47 it to the start address of the memory block. This sounds complex, but
48 in C it is a single array dereference. Because all items are aligned to
49 their size and indexes are stored as multiples of the size of the structure
50 the format is immediately portable to all possible architectures - BUT the
51 generated files are -NOT-.
53 This scheme allows code like this to be written:
55 void *Map = mmap(...);
56 Package *PkgList = (Package *)Map;
57 Header *Head = (Header *)Map;
58 char *Strings = (char *)Map;
59 cout << (Strings + PkgList[Head->HashTable[0]]->Name) << endl;
61 Notice the lack of casting or multiplication. The net result is to return
62 the name of the first package in the first hash bucket, without error
65 The generator uses allocation pools to group similarly sized structures in
66 large blocks to eliminate any alignment overhead. The generator also
67 assures that no structures overlap and all indexes are unique. Although
68 at first glance it may seem like there is the potential for two structures
69 to exist at the same point the generator never allows this to happen.
70 (See the discussion of free space pools)
72 See \ref pkgcachegen.h for more information about generating cache structures. */
74 #ifndef PKGLIB_PKGCACHE_H
75 #define PKGLIB_PKGCACHE_H
77 #include <apt-pkg/mmap.h>
78 #include <apt-pkg/macros.h>
84 #ifndef APT_8_CLEANER_HEADERS
88 #if APT_PKG_ABI >= 413
89 // storing file sizes of indexes, which are way below 4 GB for now
90 typedef uint32_t map_filesize_t
;
91 typedef map_filesize_t should_be_map_filesize_t
;
93 typedef unsigned long map_filesize_t
;
94 typedef unsigned int should_be_map_filesize_t
;
96 #if APT_PKG_ABI >= 413
97 // each package/group/dependency gets an id
98 typedef uint32_t map_id_t
;
99 typedef map_id_t should_be_map_id_t
;
101 typedef unsigned long map_id_t
;
102 typedef unsigned int should_be_map_id_t
;
104 #if APT_PKG_ABI >= 413
105 // some files get an id, too, but in far less absolute numbers
106 typedef uint16_t map_fileid_t
;
107 typedef map_fileid_t should_be_map_fileid_t
;
109 typedef unsigned long map_fileid_t
;
110 typedef unsigned int should_be_map_fileid_t
;
112 #if APT_PKG_ABI >= 413
113 // relative pointer from cache start
114 typedef uint32_t map_pointer_t
;
116 typedef unsigned int map_pointer_t
;
118 // same as the previous, but documented to be to a string item
119 typedef map_pointer_t map_stringitem_t
;
120 #if APT_PKG_ABI >= 413
121 typedef uint64_t should_be_uint64_t
;
122 typedef uint64_t should_be_uint64_small_t
;
124 typedef unsigned long long should_be_uint64_t
;
125 typedef unsigned long should_be_uint64_small_t
;
128 class pkgVersioningSystem
;
129 class pkgCache
/*{{{*/
132 // Cache element predeclarations
147 template<typename Str
, typename Itr
> class Iterator
;
154 class RlsFileIterator
;
155 class PkgFileIterator
;
156 class VerFileIterator
;
157 class DescFileIterator
;
161 // These are all the constants used in the cache structures
163 // WARNING - if you change these lists you must also edit
164 // the stringification in pkgcache.cc and also consider whether
165 // the cache file will become incompatible.
168 enum DepType
{Depends
=1,PreDepends
=2,Suggests
=3,Recommends
=4,
169 Conflicts
=5,Replaces
=6,Obsoletes
=7,DpkgBreaks
=8,Enhances
=9};
170 /** \brief available compare operators
172 The lower 4 bits are used to indicate what operator is being specified and
173 the upper 4 bits are flags. OR indicates that the next package is
174 or'd with the current package. */
175 enum DepCompareOp
{Or
=0x10,NoOp
=0,LessEq
=0x1,GreaterEq
=0x2,Less
=0x3,
176 Greater
=0x4,Equals
=0x5,NotEquals
=0x6};
181 /** \brief priority of a package version
183 Zero is used for unparsable or absent Priority fields. */
184 enum VerPriority
{Required
=1,Important
=2,Standard
=3,Optional
=4,Extra
=5};
185 enum PkgSelectedState
{Unknown
=0,Install
=1,Hold
=2,DeInstall
=3,Purge
=4};
186 enum PkgInstState
{Ok
=0,ReInstReq
=1,HoldInst
=2,HoldReInstReq
=3};
187 enum PkgCurrentState
{NotInstalled
=0,UnPacked
=1,HalfConfigured
=2,
188 HalfInstalled
=4,ConfigFiles
=5,Installed
=6,
189 TriggersAwaited
=7,TriggersPending
=8};
194 enum PkgFlags
{Auto
=(1<<0),Essential
=(1<<3),Important
=(1<<4)};
196 NotSource
=(1<<0), /*!< packages can't be fetched from here, e.g. dpkg/status file */
197 LocalSource
=(1<<1), /*!< local sources can't and will not be verified by hashes */
198 NoPackages
=(1<<2), /*!< the file includes no package records itself, but additions like Translations */
200 enum ReleaseFileFlags
{
201 NotAutomatic
=(1<<0), /*!< archive has a default pin of 1 */
202 ButAutomaticUpgrades
=(1<<1), /*!< (together with the previous) archive has a default pin of 100 */
208 // Memory mapped cache file
209 std::string CacheFile
;
212 map_id_t
sHash(const std::string
&S
) const APT_PURE
;
213 map_id_t
sHash(const char *S
) const APT_PURE
;
217 // Pointers to the arrays of items
223 ReleaseFile
*RlsFileP
;
224 PackageFile
*PkgFileP
;
229 APT_DEPRECATED StringItem
*StringItemP
;
232 virtual bool ReMap(bool const &Errorchecks
= true);
233 inline bool Sync() {return Map
.Sync();}
234 inline MMap
&GetMap() {return Map
;}
235 inline void *DataEnd() {return ((unsigned char *)Map
.Data()) + Map
.Size();}
237 // String hashing function (512 range)
238 inline map_id_t
Hash(const std::string
&S
) const {return sHash(S
);}
239 inline map_id_t
Hash(const char *S
) const {return sHash(S
);}
241 // Useful transformation things
242 const char *Priority(unsigned char Priority
);
245 GrpIterator
FindGrp(const std::string
&Name
);
246 PkgIterator
FindPkg(const std::string
&Name
);
247 PkgIterator
FindPkg(const std::string
&Name
, const std::string
&Arch
);
249 Header
&Head() {return *HeaderP
;}
250 inline GrpIterator
GrpBegin();
251 inline GrpIterator
GrpEnd();
252 inline PkgIterator
PkgBegin();
253 inline PkgIterator
PkgEnd();
254 inline PkgFileIterator
FileBegin();
255 inline PkgFileIterator
FileEnd();
256 inline RlsFileIterator
RlsFileBegin();
257 inline RlsFileIterator
RlsFileEnd();
259 inline bool MultiArchCache() const { return MultiArchEnabled
; }
260 inline char const * NativeArch();
262 // Make me a function
263 pkgVersioningSystem
*VS
;
266 static const char *CompTypeDeb(unsigned char Comp
) APT_CONST
;
267 static const char *CompType(unsigned char Comp
) APT_CONST
;
268 static const char *DepType(unsigned char Dep
);
270 pkgCache(MMap
*Map
,bool DoMap
= true);
271 virtual ~pkgCache() {}
274 bool MultiArchEnabled
;
275 APT_HIDDEN PkgIterator
SingleArchFindPkg(const std::string
&Name
);
278 // Header structure /*{{{*/
279 struct pkgCache::Header
281 /** \brief Signature information
283 This must contain the hex value 0x98FE76DC which is designed to
284 verify that the system loading the image has the same byte order
285 and byte size as the system saving the image */
286 unsigned long Signature
;
287 /** These contain the version of the cache file */
290 /** \brief indicates if the cache should be erased
292 Dirty is true if the cache file was opened for reading, the client
293 expects to have written things to it and have not fully synced it.
294 The file should be erased and rebuilt if it is true. */
297 /** \brief Size of structure values
299 All *Sz variables contains the sizeof() that particular structure.
300 It is used as an extra consistency check on the structure of the file.
302 If any of the size values do not exactly match what the client expects
303 then the client should refuse the load the file. */
304 unsigned short HeaderSz
;
305 unsigned short GroupSz
;
306 unsigned short PackageSz
;
307 unsigned short ReleaseFileSz
;
308 unsigned short PackageFileSz
;
309 unsigned short VersionSz
;
310 unsigned short DescriptionSz
;
311 unsigned short DependencySz
;
312 unsigned short ProvidesSz
;
313 unsigned short VerFileSz
;
314 unsigned short DescFileSz
;
316 /** \brief Structure counts
318 These indicate the number of each structure contained in the cache.
319 PackageCount is especially useful for generating user state structures.
320 See Package::Id for more info. */
322 map_id_t PackageCount
;
323 map_id_t VersionCount
;
324 map_id_t DescriptionCount
;
325 map_id_t DependsCount
;
326 map_fileid_t ReleaseFileCount
;
327 map_fileid_t PackageFileCount
;
328 map_fileid_t VerFileCount
;
329 map_fileid_t DescFileCount
;
330 map_id_t ProvidesCount
;
332 /** \brief index of the first PackageFile structure
334 The PackageFile structures are singly linked lists that represent
335 all package files that have been merged into the cache. */
336 map_pointer_t FileList
;
337 /** \brief index of the first ReleaseFile structure */
338 map_pointer_t RlsFileList
;
340 #if APT_PKG_ABI < 413
341 APT_DEPRECATED map_pointer_t StringList
;
343 /** \brief String representing the version system used */
344 map_pointer_t VerSysName
;
345 /** \brief native architecture the cache was built against */
346 map_pointer_t Architecture
;
347 #if APT_PKG_ABI >= 413
348 /** \brief all architectures the cache was built against */
349 map_pointer_t Architectures
;
351 /** \brief The maximum size of a raw entry from the original Package file */
352 map_filesize_t MaxVerFileSize
;
353 /** \brief The maximum size of a raw entry from the original Translation file */
354 map_filesize_t MaxDescFileSize
;
356 /** \brief The Pool structures manage the allocation pools that the generator uses
358 Start indicates the first byte of the pool, Count is the number of objects
359 remaining in the pool and ItemSize is the structure size (alignment factor)
360 of the pool. An ItemSize of 0 indicates the pool is empty. There should be
361 the same number of pools as there are structure types. The generator
362 stores this information so future additions can make use of any unused pool
364 DynamicMMap::Pool Pools
[9];
366 /** \brief hash tables providing rapid group/package name lookup
368 Each group/package name is inserted into a hash table using pkgCache::Hash(const &string)
369 By iterating over each entry in the hash table it is possible to iterate over
370 the entire list of packages. Hash Collisions are handled with a singly linked
371 list of packages based at the hash item. The linked list contains only
372 packages that match the hashing function.
373 In the PkgHashTable is it possible that multiple packages have the same name -
374 these packages are stored as a sequence in the list.
375 The size of both tables is the same. */
376 #if APT_PKG_ABI >= 413
377 unsigned int HashTableSize
;
378 unsigned int GetHashTableSize() const { return HashTableSize
; }
379 void SetHashTableSize(unsigned int const sz
) { HashTableSize
= sz
; }
380 map_pointer_t
GetArchitectures() const { return Architectures
; }
381 void SetArchitectures(map_pointer_t
const idx
) { Architectures
= idx
; }
383 // BEWARE: these tables are pretty much empty and just here for abi compat
384 map_ptrloc PkgHashTable
[2*1048];
385 map_ptrloc GrpHashTable
[2*1048];
386 unsigned int GetHashTableSize() const { return PkgHashTable
[0]; }
387 void SetHashTableSize(unsigned int const sz
) { PkgHashTable
[0] = sz
; }
388 map_pointer_t
GetArchitectures() const { return PkgHashTable
[1]; }
389 void SetArchitectures(map_pointer_t
const idx
) { PkgHashTable
[1] = idx
; }
391 map_pointer_t
* PkgHashTableP() const { return (map_pointer_t
*) (this + 1); }
392 map_pointer_t
* GrpHashTableP() const { return PkgHashTableP() + GetHashTableSize(); }
394 /** \brief Size of the complete cache file */
395 should_be_uint64_small_t CacheFileSize
;
397 bool CheckSizes(Header
&Against
) const APT_PURE
;
401 // Group structure /*{{{*/
402 /** \brief groups architecture depending packages together
404 On or more packages with the same name form a group, so we have
405 a simple way to access a package built for different architectures
406 Group exists in a singly linked list of group records starting at
407 the hash index of the name in the pkgCache::Header::GrpHashTable */
408 struct pkgCache::Group
410 /** \brief Name of the group */
411 map_stringitem_t Name
;
414 /** \brief Link to the first package which belongs to the group */
415 map_pointer_t FirstPackage
; // Package
416 /** \brief Link to the last package which belongs to the group */
417 map_pointer_t LastPackage
; // Package
418 /** \brief Link to the next Group */
419 map_pointer_t Next
; // Group
420 /** \brief unique sequel ID */
421 should_be_map_id_t ID
;
425 // Package structure /*{{{*/
426 /** \brief contains information for a single unique package
428 There can be any number of versions of a given package.
429 Package exists in a singly linked list of package records starting at
430 the hash index of the name in the pkgCache::Header::PkgHashTable
432 A package can be created for every architecture so package names are
433 not unique, but it is guaranteed that packages with the same name
434 are sequencel ordered in the list. Packages with the same name can be
435 accessed with the Group.
437 struct pkgCache::Package
439 /** \brief Name of the package
440 * Note that the access method Name() will remain. It is just this data member
441 * deprecated as this information is already stored and available via the
442 * associated Group – so it is wasting precious binary cache space */
443 APT_DEPRECATED map_stringitem_t Name
;
444 /** \brief Architecture of the package */
445 map_stringitem_t Arch
;
446 /** \brief Base of a singly linked list of versions
448 Each structure represents a unique version of the package.
449 The version structures contain links into PackageFile and the
450 original text file as well as detailed information about the size
451 and dependencies of the specific package. In this way multiple
452 versions of a package can be cleanly handled by the system.
453 Furthermore, this linked list is guaranteed to be sorted
454 from Highest version to lowest version with no duplicate entries. */
455 map_pointer_t VersionList
; // Version
456 /** \brief index to the installed version */
457 map_pointer_t CurrentVer
; // Version
458 /** \brief indicates nothing (consistently)
459 This field used to contain ONE section the package belongs to,
460 if those differs between versions it is a RANDOM one.
461 The Section() method tries to reproduce it, but the only sane
462 thing to do is use the Section field from the version! */
463 APT_DEPRECATED map_ptrloc Section
; // StringItem
464 /** \brief index of the group this package belongs to */
465 map_pointer_t Group
; // Group the Package belongs to
468 /** \brief Link to the next package in the same bucket */
469 map_pointer_t NextPackage
; // Package
470 /** \brief List of all dependencies on this package */
471 map_pointer_t RevDepends
; // Dependency
472 /** \brief List of all "packages" this package provide */
473 map_pointer_t ProvidesList
; // Provides
475 // Install/Remove/Purge etc
476 /** \brief state that the user wishes the package to be in */
477 unsigned char SelectedState
; // What
478 /** \brief installation state of the package
480 This should be "ok" but in case the installation failed
481 it will be different.
483 unsigned char InstState
; // Flags
484 /** \brief indicates if the package is installed */
485 unsigned char CurrentState
; // State
487 /** \brief unique sequel ID
489 ID is a unique value from 0 to Header->PackageCount assigned by the generator.
490 This allows clients to create an array of size PackageCount and use it to store
491 state information for the package map. For instance the status file emitter uses
492 this to track which packages have been emitted already. */
493 should_be_map_id_t ID
;
494 /** \brief some useful indicators of the package's state */
498 // Release File structure /*{{{*/
499 /** \brief stores information about the release files used to generate the cache
501 PackageFiles reference ReleaseFiles as we need to keep record of which
502 version belongs to which release e.g. for pinning. */
503 struct pkgCache::ReleaseFile
505 /** \brief physical disk file that this ReleaseFile represents */
506 map_stringitem_t FileName
;
507 /** \brief the release information
509 Please see the files document for a description of what the
510 release information means. */
511 map_stringitem_t Archive
;
512 map_stringitem_t Codename
;
513 map_stringitem_t Version
;
514 map_stringitem_t Origin
;
515 map_stringitem_t Label
;
516 /** \brief The site the index file was fetched from */
517 map_stringitem_t Site
;
519 /** \brief Size of the file
521 Used together with the modification time as a
522 simple check to ensure that the Packages
523 file has not been altered since Cache generation. */
525 /** \brief Modification time for the file */
528 /** @TODO document PackageFile::Flags */
532 /** \brief Link to the next ReleaseFile in the Cache */
533 map_pointer_t NextFile
;
534 /** \brief unique sequel ID */
535 should_be_map_fileid_t ID
;
538 // Package File structure /*{{{*/
539 /** \brief stores information about the files used to generate the cache
541 Package files are referenced by Version structures to be able to know
542 after the generation still from which Packages file includes this Version
543 as we need this information later on e.g. for pinning. */
544 struct pkgCache::PackageFile
546 /** \brief physical disk file that this PackageFile represents */
547 map_stringitem_t FileName
;
548 /** \brief the release information */
549 map_pointer_t Release
;
551 map_stringitem_t Component
;
552 map_stringitem_t Architecture
;
554 /** \brief indicates what sort of index file this is
556 @TODO enumerate at least the possible indexes */
557 map_stringitem_t IndexType
;
558 /** \brief Size of the file
560 Used together with the modification time as a
561 simple check to ensure that the Packages
562 file has not been altered since Cache generation. */
564 /** \brief Modification time for the file */
567 /** @TODO document PackageFile::Flags */
571 /** \brief Link to the next PackageFile in the Cache */
572 map_pointer_t NextFile
; // PackageFile
573 /** \brief unique sequel ID */
574 should_be_map_fileid_t ID
;
577 // VerFile structure /*{{{*/
578 /** \brief associates a version with a PackageFile
580 This allows a full description of all Versions in all files
581 (and hence all sources) under consideration. */
582 struct pkgCache::VerFile
584 /** \brief index of the package file that this version was found in */
585 map_pointer_t File
; // PackageFile
586 /** \brief next step in the linked list */
587 map_pointer_t NextFile
; // PkgVerFile
588 /** \brief position in the package file */
589 should_be_map_filesize_t Offset
; // File offset
590 /** @TODO document pkgCache::VerFile::Size */
594 // DescFile structure /*{{{*/
595 /** \brief associates a description with a Translation file */
596 struct pkgCache::DescFile
598 /** \brief index of the file that this description was found in */
599 map_pointer_t File
; // PackageFile
600 /** \brief next step in the linked list */
601 map_pointer_t NextFile
; // PkgVerFile
602 /** \brief position in the file */
603 should_be_map_filesize_t Offset
; // File offset
604 /** @TODO document pkgCache::DescFile::Size */
608 // Version structure /*{{{*/
609 /** \brief information for a single version of a package
611 The version list is always sorted from highest version to lowest
612 version by the generator. Equal version numbers are either merged
613 or handled as separate versions based on the Hash value. */
614 struct pkgCache::Version
616 /** \brief complete version string */
617 map_stringitem_t VerStr
;
618 /** \brief section this version is filled in */
619 map_stringitem_t Section
;
620 #if APT_PKG_ABI >= 413
621 /** \brief source package name this version comes from
622 Always contains the name, even if it is the same as the binary name */
623 map_stringitem_t SourcePkgName
;
624 /** \brief source version this version comes from
625 Always contains the version string, even if it is the same as the binary version */
626 map_stringitem_t SourceVerStr
;
629 /** \brief Multi-Arch capabilities of a package version */
630 enum VerMultiArch
{ None
= 0, /*!< is the default and doesn't trigger special behaviour */
631 All
= (1<<0), /*!< will cause that Ver.Arch() will report "all" */
632 Foreign
= (1<<1), /*!< can satisfy dependencies in another architecture */
633 Same
= (1<<2), /*!< can be co-installed with itself from other architectures */
634 Allowed
= (1<<3), /*!< other packages are allowed to depend on thispkg:any */
635 AllForeign
= All
| Foreign
,
636 AllAllowed
= All
| Allowed
};
637 /** \brief stores the MultiArch capabilities of this version
639 Flags used are defined in pkgCache::Version::VerMultiArch
641 unsigned char MultiArch
;
643 /** \brief references all the PackageFile's that this version came from
645 FileList can be used to determine what distribution(s) the Version
646 applies to. If FileList is 0 then this is a blank version.
647 The structure should also have a 0 in all other fields excluding
648 pkgCache::Version::VerStr and Possibly pkgCache::Version::NextVer. */
649 map_pointer_t FileList
; // VerFile
650 /** \brief next (lower or equal) version in the linked list */
651 map_pointer_t NextVer
; // Version
652 /** \brief next description in the linked list */
653 map_pointer_t DescriptionList
; // Description
654 /** \brief base of the dependency list */
655 map_pointer_t DependsList
; // Dependency
656 /** \brief links to the owning package
658 This allows reverse dependencies to determine the package */
659 map_pointer_t ParentPkg
; // Package
660 /** \brief list of pkgCache::Provides */
661 map_pointer_t ProvidesList
; // Provides
663 /** \brief archive size for this version
665 For Debian this is the size of the .deb file. */
666 should_be_uint64_t Size
; // These are the .deb size
667 /** \brief uncompressed size for this version */
668 should_be_uint64_t InstalledSize
;
669 /** \brief characteristic value representing this version
671 No two packages in existence should have the same VerStr
672 and Hash with different contents. */
674 /** \brief unique sequel ID */
675 should_be_map_id_t ID
;
676 /** \brief parsed priority value */
677 unsigned char Priority
;
680 // Description structure /*{{{*/
681 /** \brief datamember of a linked list of available description for a version */
682 struct pkgCache::Description
684 /** \brief Language code of this description (translation)
686 If the value has a 0 length then this is read using the Package
687 file else the Translation-CODE file is used. */
688 map_stringitem_t language_code
;
689 /** \brief MD5sum of the original description
691 Used to map Translations of a description to a version
692 and to check that the Translation is up-to-date. */
693 map_stringitem_t md5sum
;
695 /** @TODO document pkgCache::Description::FileList */
696 map_pointer_t FileList
; // DescFile
697 /** \brief next translation for this description */
698 map_pointer_t NextDesc
; // Description
699 /** \brief the text is a description of this package */
700 map_pointer_t ParentPkg
; // Package
702 /** \brief unique sequel ID */
703 should_be_map_id_t ID
;
706 // Dependency structure /*{{{*/
707 /** \brief information for a single dependency record
709 The records are split up like this to ease processing by the client.
710 The base of the linked list is pkgCache::Version::DependsList.
711 All forms of dependencies are recorded here including Depends,
712 Recommends, Suggests, Enhances, Conflicts, Replaces and Breaks. */
713 struct pkgCache::Dependency
715 /** \brief string of the version the dependency is applied against */
716 map_stringitem_t Version
;
717 /** \brief index of the package this depends applies to
719 The generator will - if the package does not already exist -
720 create a blank (no version records) package. */
721 map_pointer_t Package
; // Package
722 /** \brief next dependency of this version */
723 map_pointer_t NextDepends
; // Dependency
724 /** \brief next reverse dependency of this package */
725 map_pointer_t NextRevDepends
; // Dependency
726 /** \brief version of the package which has the reverse depends */
727 map_pointer_t ParentVer
; // Version
729 /** \brief unique sequel ID */
730 should_be_map_id_t ID
;
731 /** \brief Dependency type - Depends, Recommends, Conflicts, etc */
733 /** \brief comparison operator specified on the depends line
735 If the high bit is set then it is a logical OR with the previous record. */
736 unsigned char CompareOp
;
739 // Provides structure /*{{{*/
740 /** \brief handles virtual packages
742 When a Provides: line is encountered a new provides record is added
743 associating the package with a virtual package name.
744 The provides structures are linked off the package structures.
745 This simplifies the analysis of dependencies and other aspects A provides
746 refers to a specific version of a specific package, not all versions need to
747 provide that provides.*/
748 struct pkgCache::Provides
750 /** \brief index of the package providing this */
751 map_pointer_t ParentPkg
; // Package
752 /** \brief index of the version this provide line applies to */
753 map_pointer_t Version
; // Version
754 /** \brief version in the provides line (if any)
756 This version allows dependencies to depend on specific versions of a
757 Provides, as well as allowing Provides to override existing packages.
758 This is experimental. Note that Debian doesn't allow versioned provides */
759 map_stringitem_t ProvideVersion
;
760 /** \brief next provides (based of package) */
761 map_pointer_t NextProvides
; // Provides
762 /** \brief next provides (based of version) */
763 map_pointer_t NextPkgProv
; // Provides
766 // UNUSED StringItem structure /*{{{*/
767 struct APT_DEPRECATED
pkgCache::StringItem
769 /** \brief string this refers to */
770 map_ptrloc String
; // StringItem
771 /** \brief Next link in the chain */
772 map_ptrloc NextItem
; // StringItem
776 inline char const * pkgCache::NativeArch()
777 { return StrP
+ HeaderP
->Architecture
; }
779 #include <apt-pkg/cacheiterators.h>
781 inline pkgCache::GrpIterator
pkgCache::GrpBegin()
782 {return GrpIterator(*this);}
783 inline pkgCache::GrpIterator
pkgCache::GrpEnd()
784 {return GrpIterator(*this,GrpP
);}
785 inline pkgCache::PkgIterator
pkgCache::PkgBegin()
786 {return PkgIterator(*this);}
787 inline pkgCache::PkgIterator
pkgCache::PkgEnd()
788 {return PkgIterator(*this,PkgP
);}
789 inline pkgCache::PkgFileIterator
pkgCache::FileBegin()
790 {return PkgFileIterator(*this,PkgFileP
+ HeaderP
->FileList
);}
791 inline pkgCache::PkgFileIterator
pkgCache::FileEnd()
792 {return PkgFileIterator(*this,PkgFileP
);}
793 inline pkgCache::RlsFileIterator
pkgCache::RlsFileBegin()
794 {return RlsFileIterator(*this,RlsFileP
+ HeaderP
->RlsFileList
);}
795 inline pkgCache::RlsFileIterator
pkgCache::RlsFileEnd()
796 {return RlsFileIterator(*this,RlsFileP
);}
799 // Oh I wish for Real Name Space Support
800 class pkgCache::Namespace
/*{{{*/
803 typedef pkgCache::GrpIterator GrpIterator
;
804 typedef pkgCache::PkgIterator PkgIterator
;
805 typedef pkgCache::VerIterator VerIterator
;
806 typedef pkgCache::DescIterator DescIterator
;
807 typedef pkgCache::DepIterator DepIterator
;
808 typedef pkgCache::PrvIterator PrvIterator
;
809 typedef pkgCache::RlsFileIterator RlsFileIterator
;
810 typedef pkgCache::PkgFileIterator PkgFileIterator
;
811 typedef pkgCache::VerFileIterator VerFileIterator
;
812 typedef pkgCache::Version Version
;
813 typedef pkgCache::Description Description
;
814 typedef pkgCache::Package Package
;
815 typedef pkgCache::Header Header
;
816 typedef pkgCache::Dep Dep
;
817 typedef pkgCache::Flag Flag
;