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 // size of (potentially big) files like debs or the install size of them
89 typedef uint64_t map_filesize_t
;
90 // storing file sizes of indexes, which are way below 4 GB for now
91 typedef uint32_t map_filesize_small_t
;
92 // each package/group/dependency gets an id
93 typedef uint32_t map_id_t
;
94 // some files get an id, too, but in far less absolute numbers
95 typedef uint16_t map_fileid_t
;
96 // relative pointer from cache start
97 typedef uint32_t map_pointer_t
;
98 // same as the previous, but documented to be to a string item
99 typedef map_pointer_t map_stringitem_t
;
100 // we have only a small amount of flags for each item
101 typedef uint8_t map_flags_t
;
102 typedef uint8_t map_number_t
;
104 class pkgVersioningSystem
;
105 class pkgCache
/*{{{*/
108 // Cache element predeclarations
118 struct DependencyData
;
124 template<typename Str
, typename Itr
> class Iterator
;
131 class RlsFileIterator
;
132 class PkgFileIterator
;
133 class VerFileIterator
;
134 class DescFileIterator
;
138 // These are all the constants used in the cache structures
140 // WARNING - if you change these lists you must also edit
141 // the stringification in pkgcache.cc and also consider whether
142 // the cache file will become incompatible.
145 enum DepType
{Depends
=1,PreDepends
=2,Suggests
=3,Recommends
=4,
146 Conflicts
=5,Replaces
=6,Obsoletes
=7,DpkgBreaks
=8,Enhances
=9};
147 /** \brief available compare operators
149 The lower 4 bits are used to indicate what operator is being specified and
150 the upper 4 bits are flags. OR indicates that the next package is
151 or'd with the current package. */
152 enum DepCompareOp
{NoOp
=0,LessEq
=0x1,GreaterEq
=0x2,Less
=0x3,
153 Greater
=0x4,Equals
=0x5,NotEquals
=0x6,
154 Or
=0x10, /*!< or'ed with the next dependency */
155 MultiArchImplicit
=0x20, /*!< generated internally, not spelled out in the index */
156 ArchSpecific
=0x40 /*!< was decorated with an explicit architecture in index */
162 /** \brief priority of a package version
164 Zero is used for unparsable or absent Priority fields. */
165 enum VerPriority
{Required
=1,Important
=2,Standard
=3,Optional
=4,Extra
=5};
166 enum PkgSelectedState
{Unknown
=0,Install
=1,Hold
=2,DeInstall
=3,Purge
=4};
167 enum PkgInstState
{Ok
=0,ReInstReq
=1,HoldInst
=2,HoldReInstReq
=3};
168 enum PkgCurrentState
{NotInstalled
=0,UnPacked
=1,HalfConfigured
=2,
169 HalfInstalled
=4,ConfigFiles
=5,Installed
=6,
170 TriggersAwaited
=7,TriggersPending
=8};
175 enum PkgFlags
{Auto
=(1<<0),Essential
=(1<<3),Important
=(1<<4)};
177 NotSource
=(1<<0), /*!< packages can't be fetched from here, e.g. dpkg/status file */
178 LocalSource
=(1<<1), /*!< local sources can't and will not be verified by hashes */
179 NoPackages
=(1<<2), /*!< the file includes no package records itself, but additions like Translations */
181 enum ReleaseFileFlags
{
182 NotAutomatic
=(1<<0), /*!< archive has a default pin of 1 */
183 ButAutomaticUpgrades
=(1<<1), /*!< (together with the previous) archive has a default pin of 100 */
186 MultiArchImplicit
=pkgCache::Dep::MultiArchImplicit
, /*!< generated internally, not spelled out in the index */
187 ArchSpecific
=pkgCache::Dep::ArchSpecific
/*!< was decorated with an explicit architecture in index */
193 // Memory mapped cache file
194 std::string CacheFile
;
197 map_id_t
sHash(const std::string
&S
) const APT_PURE
;
198 map_id_t
sHash(const char *S
) const APT_PURE
;
202 // Pointers to the arrays of items
208 ReleaseFile
*RlsFileP
;
209 PackageFile
*PkgFileP
;
214 DependencyData
*DepDataP
;
215 APT_DEPRECATED_MSG("Not used anymore in cache generation and without a replacement") StringItem
*StringItemP
;
218 virtual bool ReMap(bool const &Errorchecks
= true);
219 inline bool Sync() {return Map
.Sync();}
220 inline MMap
&GetMap() {return Map
;}
221 inline void *DataEnd() {return ((unsigned char *)Map
.Data()) + Map
.Size();}
223 // String hashing function (512 range)
224 inline map_id_t
Hash(const std::string
&S
) const {return sHash(S
);}
225 inline map_id_t
Hash(const char *S
) const {return sHash(S
);}
227 APT_HIDDEN
uint32_t CacheHash();
229 // Useful transformation things
230 static const char *Priority(unsigned char Priority
);
233 GrpIterator
FindGrp(const std::string
&Name
);
234 PkgIterator
FindPkg(const std::string
&Name
);
235 PkgIterator
FindPkg(const std::string
&Name
, const std::string
&Arch
);
237 Header
&Head() {return *HeaderP
;}
238 inline GrpIterator
GrpBegin();
239 inline GrpIterator
GrpEnd();
240 inline PkgIterator
PkgBegin();
241 inline PkgIterator
PkgEnd();
242 inline PkgFileIterator
FileBegin();
243 inline PkgFileIterator
FileEnd();
244 inline RlsFileIterator
RlsFileBegin();
245 inline RlsFileIterator
RlsFileEnd();
247 inline bool MultiArchCache() const { return MultiArchEnabled
; }
248 inline char const * NativeArch();
250 // Make me a function
251 pkgVersioningSystem
*VS
;
254 static const char *CompTypeDeb(unsigned char Comp
) APT_CONST
;
255 static const char *CompType(unsigned char Comp
) APT_CONST
;
256 static const char *DepType(unsigned char Dep
);
258 pkgCache(MMap
*Map
,bool DoMap
= true);
263 bool MultiArchEnabled
;
266 // Header structure /*{{{*/
267 struct pkgCache::Header
269 /** \brief Signature information
271 This must contain the hex value 0x98FE76DC which is designed to
272 verify that the system loading the image has the same byte order
273 and byte size as the system saving the image */
275 /** These contain the version of the cache file */
276 map_number_t MajorVersion
;
277 map_number_t MinorVersion
;
278 /** \brief indicates if the cache should be erased
280 Dirty is true if the cache file was opened for reading, the client
281 expects to have written things to it and have not fully synced it.
282 The file should be erased and rebuilt if it is true. */
285 /** \brief Size of structure values
287 All *Sz variables contains the sizeof() that particular structure.
288 It is used as an extra consistency check on the structure of the file.
290 If any of the size values do not exactly match what the client expects
291 then the client should refuse the load the file. */
293 map_number_t GroupSz
;
294 map_number_t PackageSz
;
295 map_number_t ReleaseFileSz
;
296 map_number_t PackageFileSz
;
297 map_number_t VersionSz
;
298 map_number_t DescriptionSz
;
299 map_number_t DependencySz
;
300 map_number_t DependencyDataSz
;
301 map_number_t ProvidesSz
;
302 map_number_t VerFileSz
;
303 map_number_t DescFileSz
;
305 /** \brief Structure counts
307 These indicate the number of each structure contained in the cache.
308 PackageCount is especially useful for generating user state structures.
309 See Package::Id for more info. */
311 map_id_t PackageCount
;
312 map_id_t VersionCount
;
313 map_id_t DescriptionCount
;
314 map_id_t DependsCount
;
315 map_id_t DependsDataCount
;
316 map_fileid_t ReleaseFileCount
;
317 map_fileid_t PackageFileCount
;
318 map_fileid_t VerFileCount
;
319 map_fileid_t DescFileCount
;
320 map_id_t ProvidesCount
;
322 /** \brief index of the first PackageFile structure
324 The PackageFile structures are singly linked lists that represent
325 all package files that have been merged into the cache. */
326 map_pointer_t FileList
;
327 /** \brief index of the first ReleaseFile structure */
328 map_pointer_t RlsFileList
;
330 /** \brief String representing the version system used */
331 map_pointer_t VerSysName
;
332 /** \brief native architecture the cache was built against */
333 map_pointer_t Architecture
;
334 /** \brief all architectures the cache was built against */
335 map_pointer_t Architectures
;
336 /** \brief The maximum size of a raw entry from the original Package file */
337 map_filesize_t MaxVerFileSize
;
338 /** \brief The maximum size of a raw entry from the original Translation file */
339 map_filesize_t MaxDescFileSize
;
341 /** \brief The Pool structures manage the allocation pools that the generator uses
343 Start indicates the first byte of the pool, Count is the number of objects
344 remaining in the pool and ItemSize is the structure size (alignment factor)
345 of the pool. An ItemSize of 0 indicates the pool is empty. There should be
346 the same number of pools as there are structure types. The generator
347 stores this information so future additions can make use of any unused pool
349 DynamicMMap::Pool Pools
[12];
351 /** \brief hash tables providing rapid group/package name lookup
353 Each group/package name is inserted into a hash table using pkgCache::Hash(const &string)
354 By iterating over each entry in the hash table it is possible to iterate over
355 the entire list of packages. Hash Collisions are handled with a singly linked
356 list of packages based at the hash item. The linked list contains only
357 packages that match the hashing function.
358 In the PkgHashTable is it possible that multiple packages have the same name -
359 these packages are stored as a sequence in the list.
360 The size of both tables is the same. */
361 uint32_t HashTableSize
;
362 uint32_t GetHashTableSize() const { return HashTableSize
; }
363 void SetHashTableSize(unsigned int const sz
) { HashTableSize
= sz
; }
364 map_pointer_t
GetArchitectures() const { return Architectures
; }
365 void SetArchitectures(map_pointer_t
const idx
) { Architectures
= idx
; }
366 map_pointer_t
* PkgHashTableP() const { return (map_pointer_t
*) (this + 1); }
367 map_pointer_t
* GrpHashTableP() const { return PkgHashTableP() + GetHashTableSize(); }
369 /** \brief Hash of the file (TODO: Rename) */
370 map_filesize_small_t CacheFileSize
;
372 bool CheckSizes(Header
&Against
) const APT_PURE
;
376 // Group structure /*{{{*/
377 /** \brief groups architecture depending packages together
379 On or more packages with the same name form a group, so we have
380 a simple way to access a package built for different architectures
381 Group exists in a singly linked list of group records starting at
382 the hash index of the name in the pkgCache::Header::GrpHashTable */
383 struct pkgCache::Group
385 /** \brief Name of the group */
386 map_stringitem_t Name
;
389 /** \brief Link to the first package which belongs to the group */
390 map_pointer_t FirstPackage
; // Package
391 /** \brief Link to the last package which belongs to the group */
392 map_pointer_t LastPackage
; // Package
393 /** \brief Link to the next Group */
394 map_pointer_t Next
; // Group
395 /** \brief unique sequel ID */
400 // Package structure /*{{{*/
401 /** \brief contains information for a single unique package
403 There can be any number of versions of a given package.
404 Package exists in a singly linked list of package records starting at
405 the hash index of the name in the pkgCache::Header::PkgHashTable
407 A package can be created for every architecture so package names are
408 not unique, but it is guaranteed that packages with the same name
409 are sequencel ordered in the list. Packages with the same name can be
410 accessed with the Group.
412 struct pkgCache::Package
414 /** \brief Name of the package
415 * Note that the access method Name() will remain. It is just this data member
416 * deprecated as this information is already stored and available via the
417 * associated Group – so it is wasting precious binary cache space */
418 APT_DEPRECATED_MSG("Use the .Name() method instead of accessing the member directly") map_stringitem_t Name
;
419 /** \brief Architecture of the package */
420 map_stringitem_t Arch
;
421 /** \brief Base of a singly linked list of versions
423 Each structure represents a unique version of the package.
424 The version structures contain links into PackageFile and the
425 original text file as well as detailed information about the size
426 and dependencies of the specific package. In this way multiple
427 versions of a package can be cleanly handled by the system.
428 Furthermore, this linked list is guaranteed to be sorted
429 from Highest version to lowest version with no duplicate entries. */
430 map_pointer_t VersionList
; // Version
431 /** \brief index to the installed version */
432 map_pointer_t CurrentVer
; // Version
433 /** \brief index of the group this package belongs to */
434 map_pointer_t Group
; // Group the Package belongs to
437 /** \brief Link to the next package in the same bucket */
438 map_pointer_t NextPackage
; // Package
439 /** \brief List of all dependencies on this package */
440 map_pointer_t RevDepends
; // Dependency
441 /** \brief List of all "packages" this package provide */
442 map_pointer_t ProvidesList
; // Provides
444 // Install/Remove/Purge etc
445 /** \brief state that the user wishes the package to be in */
446 map_number_t SelectedState
; // What
447 /** \brief installation state of the package
449 This should be "ok" but in case the installation failed
450 it will be different.
452 map_number_t InstState
; // Flags
453 /** \brief indicates if the package is installed */
454 map_number_t CurrentState
; // State
456 /** \brief unique sequel ID
458 ID is a unique value from 0 to Header->PackageCount assigned by the generator.
459 This allows clients to create an array of size PackageCount and use it to store
460 state information for the package map. For instance the status file emitter uses
461 this to track which packages have been emitted already. */
463 /** \brief some useful indicators of the package's state */
467 // Release File structure /*{{{*/
468 /** \brief stores information about the release files used to generate the cache
470 PackageFiles reference ReleaseFiles as we need to keep record of which
471 version belongs to which release e.g. for pinning. */
472 struct pkgCache::ReleaseFile
474 /** \brief physical disk file that this ReleaseFile represents */
475 map_stringitem_t FileName
;
476 /** \brief the release information
478 Please see the files document for a description of what the
479 release information means. */
480 map_stringitem_t Archive
;
481 map_stringitem_t Codename
;
482 map_stringitem_t Version
;
483 map_stringitem_t Origin
;
484 map_stringitem_t Label
;
485 /** \brief The site the index file was fetched from */
486 map_stringitem_t Site
;
488 /** \brief Size of the file
490 Used together with the modification time as a
491 simple check to ensure that the Packages
492 file has not been altered since Cache generation. */
494 /** \brief Modification time for the file */
497 /** @TODO document PackageFile::Flags */
501 /** \brief Link to the next ReleaseFile in the Cache */
502 map_pointer_t NextFile
;
503 /** \brief unique sequel ID */
507 // Package File structure /*{{{*/
508 /** \brief stores information about the files used to generate the cache
510 Package files are referenced by Version structures to be able to know
511 after the generation still from which Packages file includes this Version
512 as we need this information later on e.g. for pinning. */
513 struct pkgCache::PackageFile
515 /** \brief physical disk file that this PackageFile represents */
516 map_stringitem_t FileName
;
517 /** \brief the release information */
518 map_pointer_t Release
;
520 map_stringitem_t Component
;
521 map_stringitem_t Architecture
;
523 /** \brief indicates what sort of index file this is
525 @TODO enumerate at least the possible indexes */
526 map_stringitem_t IndexType
;
527 /** \brief Size of the file
529 Used together with the modification time as a
530 simple check to ensure that the Packages
531 file has not been altered since Cache generation. */
533 /** \brief Modification time for the file */
536 /** @TODO document PackageFile::Flags */
540 /** \brief Link to the next PackageFile in the Cache */
541 map_pointer_t NextFile
; // PackageFile
542 /** \brief unique sequel ID */
546 // VerFile structure /*{{{*/
547 /** \brief associates a version with a PackageFile
549 This allows a full description of all Versions in all files
550 (and hence all sources) under consideration. */
551 struct pkgCache::VerFile
553 /** \brief index of the package file that this version was found in */
554 map_pointer_t File
; // PackageFile
555 /** \brief next step in the linked list */
556 map_pointer_t NextFile
; // PkgVerFile
557 /** \brief position in the package file */
558 map_filesize_t Offset
; // File offset
559 /** @TODO document pkgCache::VerFile::Size */
563 // DescFile structure /*{{{*/
564 /** \brief associates a description with a Translation file */
565 struct pkgCache::DescFile
567 /** \brief index of the file that this description was found in */
568 map_pointer_t File
; // PackageFile
569 /** \brief next step in the linked list */
570 map_pointer_t NextFile
; // PkgVerFile
571 /** \brief position in the file */
572 map_filesize_t Offset
; // File offset
573 /** @TODO document pkgCache::DescFile::Size */
577 // Version structure /*{{{*/
578 /** \brief information for a single version of a package
580 The version list is always sorted from highest version to lowest
581 version by the generator. Equal version numbers are either merged
582 or handled as separate versions based on the Hash value. */
583 APT_IGNORE_DEPRECATED_PUSH
584 struct pkgCache::Version
586 /** \brief complete version string */
587 map_stringitem_t VerStr
;
588 /** \brief section this version is filled in */
589 map_stringitem_t Section
;
590 /** \brief source package name this version comes from
591 Always contains the name, even if it is the same as the binary name */
592 map_stringitem_t SourcePkgName
;
593 /** \brief source version this version comes from
594 Always contains the version string, even if it is the same as the binary version */
595 map_stringitem_t SourceVerStr
;
597 /** \brief Multi-Arch capabilities of a package version */
598 enum VerMultiArch
{ No
= 0, /*!< is the default and doesn't trigger special behaviour */
599 All
= (1<<0), /*!< will cause that Ver.Arch() will report "all" */
600 Foreign
= (1<<1), /*!< can satisfy dependencies in another architecture */
601 Same
= (1<<2), /*!< can be co-installed with itself from other architectures */
602 Allowed
= (1<<3), /*!< other packages are allowed to depend on thispkg:any */
603 AllForeign
= All
| Foreign
,
604 AllAllowed
= All
| Allowed
};
606 /** \brief deprecated variant of No */
607 static const APT_DEPRECATED_MSG("The default value of the Multi-Arch field is no, not none") VerMultiArch None
= No
;
609 /** \brief stores the MultiArch capabilities of this version
611 Flags used are defined in pkgCache::Version::VerMultiArch
613 map_number_t MultiArch
;
615 /** \brief references all the PackageFile's that this version came from
617 FileList can be used to determine what distribution(s) the Version
618 applies to. If FileList is 0 then this is a blank version.
619 The structure should also have a 0 in all other fields excluding
620 pkgCache::Version::VerStr and Possibly pkgCache::Version::NextVer. */
621 map_pointer_t FileList
; // VerFile
622 /** \brief next (lower or equal) version in the linked list */
623 map_pointer_t NextVer
; // Version
624 /** \brief next description in the linked list */
625 map_pointer_t DescriptionList
; // Description
626 /** \brief base of the dependency list */
627 map_pointer_t DependsList
; // Dependency
628 /** \brief links to the owning package
630 This allows reverse dependencies to determine the package */
631 map_pointer_t ParentPkg
; // Package
632 /** \brief list of pkgCache::Provides */
633 map_pointer_t ProvidesList
; // Provides
635 /** \brief archive size for this version
637 For Debian this is the size of the .deb file. */
638 map_filesize_t Size
; // These are the .deb size
639 /** \brief uncompressed size for this version */
640 map_filesize_t InstalledSize
;
641 /** \brief characteristic value representing this version
643 No two packages in existence should have the same VerStr
644 and Hash with different contents. */
646 /** \brief unique sequel ID */
648 /** \brief parsed priority value */
649 map_number_t Priority
;
651 APT_IGNORE_DEPRECATED_POP
653 // Description structure /*{{{*/
654 /** \brief datamember of a linked list of available description for a version */
655 struct pkgCache::Description
657 /** \brief Language code of this description (translation)
659 If the value has a 0 length then this is read using the Package
660 file else the Translation-CODE file is used. */
661 map_stringitem_t language_code
;
662 /** \brief MD5sum of the original description
664 Used to map Translations of a description to a version
665 and to check that the Translation is up-to-date. */
666 map_stringitem_t md5sum
;
668 /** @TODO document pkgCache::Description::FileList */
669 map_pointer_t FileList
; // DescFile
670 /** \brief next translation for this description */
671 map_pointer_t NextDesc
; // Description
672 /** \brief the text is a description of this package */
673 map_pointer_t ParentPkg
; // Package
675 /** \brief unique sequel ID */
679 // Dependency structure /*{{{*/
680 /** \brief information for a single dependency record
682 The records are split up like this to ease processing by the client.
683 The base of the linked list is pkgCache::Version::DependsList.
684 All forms of dependencies are recorded here including Depends,
685 Recommends, Suggests, Enhances, Conflicts, Replaces and Breaks. */
686 struct pkgCache::DependencyData
688 /** \brief string of the version the dependency is applied against */
689 map_stringitem_t Version
;
690 /** \brief index of the package this depends applies to
692 The generator will - if the package does not already exist -
693 create a blank (no version records) package. */
694 map_pointer_t Package
; // Package
696 /** \brief Dependency type - Depends, Recommends, Conflicts, etc */
698 /** \brief comparison operator specified on the depends line
700 If the high bit is set then it is a logical OR with the previous record. */
701 map_flags_t CompareOp
;
703 map_pointer_t NextData
;
705 struct pkgCache::Dependency
707 map_pointer_t DependencyData
; // DependencyData
708 /** \brief version of the package which has the depends */
709 map_pointer_t ParentVer
; // Version
710 /** \brief next reverse dependency of this package */
711 map_pointer_t NextRevDepends
; // Dependency
712 /** \brief next dependency of this version */
713 map_pointer_t NextDepends
; // Dependency
715 /** \brief unique sequel ID */
719 // Provides structure /*{{{*/
720 /** \brief handles virtual packages
722 When a Provides: line is encountered a new provides record is added
723 associating the package with a virtual package name.
724 The provides structures are linked off the package structures.
725 This simplifies the analysis of dependencies and other aspects A provides
726 refers to a specific version of a specific package, not all versions need to
727 provide that provides.*/
728 struct pkgCache::Provides
730 /** \brief index of the package providing this */
731 map_pointer_t ParentPkg
; // Package
732 /** \brief index of the version this provide line applies to */
733 map_pointer_t Version
; // Version
734 /** \brief version in the provides line (if any)
736 This version allows dependencies to depend on specific versions of a
737 Provides, as well as allowing Provides to override existing packages. */
738 map_stringitem_t ProvideVersion
;
740 /** \brief next provides (based of package) */
741 map_pointer_t NextProvides
; // Provides
742 /** \brief next provides (based of version) */
743 map_pointer_t NextPkgProv
; // Provides
746 // UNUSED StringItem structure /*{{{*/
747 struct APT_DEPRECATED_MSG("No longer used in cache generation without a replacement") pkgCache::StringItem
749 /** \brief string this refers to */
750 map_ptrloc String
; // StringItem
751 /** \brief Next link in the chain */
752 map_ptrloc NextItem
; // StringItem
756 inline char const * pkgCache::NativeArch()
757 { return StrP
+ HeaderP
->Architecture
; }
759 #include <apt-pkg/cacheiterators.h>
761 inline pkgCache::GrpIterator
pkgCache::GrpBegin()
762 {return GrpIterator(*this);}
763 inline pkgCache::GrpIterator
pkgCache::GrpEnd()
764 {return GrpIterator(*this,GrpP
);}
765 inline pkgCache::PkgIterator
pkgCache::PkgBegin()
766 {return PkgIterator(*this);}
767 inline pkgCache::PkgIterator
pkgCache::PkgEnd()
768 {return PkgIterator(*this,PkgP
);}
769 inline pkgCache::PkgFileIterator
pkgCache::FileBegin()
770 {return PkgFileIterator(*this,PkgFileP
+ HeaderP
->FileList
);}
771 inline pkgCache::PkgFileIterator
pkgCache::FileEnd()
772 {return PkgFileIterator(*this,PkgFileP
);}
773 inline pkgCache::RlsFileIterator
pkgCache::RlsFileBegin()
774 {return RlsFileIterator(*this,RlsFileP
+ HeaderP
->RlsFileList
);}
775 inline pkgCache::RlsFileIterator
pkgCache::RlsFileEnd()
776 {return RlsFileIterator(*this,RlsFileP
);}
779 // Oh I wish for Real Name Space Support
780 class pkgCache::Namespace
/*{{{*/
783 typedef pkgCache::GrpIterator GrpIterator
;
784 typedef pkgCache::PkgIterator PkgIterator
;
785 typedef pkgCache::VerIterator VerIterator
;
786 typedef pkgCache::DescIterator DescIterator
;
787 typedef pkgCache::DepIterator DepIterator
;
788 typedef pkgCache::PrvIterator PrvIterator
;
789 typedef pkgCache::RlsFileIterator RlsFileIterator
;
790 typedef pkgCache::PkgFileIterator PkgFileIterator
;
791 typedef pkgCache::VerFileIterator VerFileIterator
;
792 typedef pkgCache::Version Version
;
793 typedef pkgCache::Description Description
;
794 typedef pkgCache::Package Package
;
795 typedef pkgCache::Header Header
;
796 typedef pkgCache::Dep Dep
;
797 typedef pkgCache::Flag Flag
;