]> git.saurik.com Git - apt.git/blame - apt-pkg/pkgcache.cc
zh_CN.po: update simplified Chinese translation. (100%)
[apt.git] / apt-pkg / pkgcache.cc
CommitLineData
578bfd0a
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
bac2e715 3// $Id: pkgcache.cc,v 1.37 2003/02/10 01:40:58 doogie Exp $
578bfd0a
AL
4/* ######################################################################
5
6 Package Cache - Accessor code for the cache
7
094a497d 8 Please see doc/apt-pkg/cache.sgml for a more detailed description of
578bfd0a
AL
9 this format. Also be sure to keep that file up-to-date!!
10
1e3f4083 11 This is the general utility functions for cache management. They provide
578bfd0a
AL
12 a complete set of accessor functions for the cache. The cacheiterators
13 header contains the STL-like iterators that can be used to easially
14 navigate the cache as well as seemlessly dereference the mmap'd
15 indexes. Use these always.
16
17 The main class provides for ways to get package indexes and some
18 general lookup functions to start the iterators.
19
20 ##################################################################### */
21 /*}}}*/
22// Include Files /*{{{*/
ea542140
DK
23#include<config.h>
24
094a497d 25#include <apt-pkg/pkgcache.h>
af29ffb4 26#include <apt-pkg/policy.h>
094a497d
AL
27#include <apt-pkg/version.h>
28#include <apt-pkg/error.h>
231fea14 29#include <apt-pkg/strutl.h>
b2e465d6 30#include <apt-pkg/configuration.h>
45df0ad2 31#include <apt-pkg/aptconfiguration.h>
453b82a3 32#include <apt-pkg/mmap.h>
5c0d3668 33#include <apt-pkg/macros.h>
578bfd0a 34
453b82a3
DK
35#include <stddef.h>
36#include <string.h>
7f8c0eed
DK
37#include <sstream>
38#include <algorithm>
453b82a3 39#include <vector>
578bfd0a
AL
40#include <string>
41#include <sys/stat.h>
25c7a09d 42#include <zlib.h>
ea542140
DK
43
44#include <apti18n.h>
578bfd0a
AL
45 /*}}}*/
46
851a45a8 47using std::string;
eff0c22e 48using APT::StringView;
851a45a8 49
012b102a 50
578bfd0a
AL
51// Cache::Header::Header - Constructor /*{{{*/
52// ---------------------------------------------------------------------
53/* Simply initialize the header */
54pkgCache::Header::Header()
55{
dfe66c72
DK
56#define APT_HEADER_SET(X,Y) X = Y; static_assert(std::numeric_limits<decltype(X)>::max() > Y, "Size violation detected in pkgCache::Header")
57 APT_HEADER_SET(Signature, 0x98FE76DC);
58
578bfd0a
AL
59 /* Whenever the structures change the major version should be bumped,
60 whenever the generator changes the minor version should be bumped. */
dfe66c72 61 APT_HEADER_SET(MajorVersion, 10);
d17f2b1b 62 APT_HEADER_SET(MinorVersion, 5);
dfe66c72
DK
63 APT_HEADER_SET(Dirty, false);
64
65 APT_HEADER_SET(HeaderSz, sizeof(pkgCache::Header));
66 APT_HEADER_SET(GroupSz, sizeof(pkgCache::Group));
67 APT_HEADER_SET(PackageSz, sizeof(pkgCache::Package));
68 APT_HEADER_SET(ReleaseFileSz, sizeof(pkgCache::ReleaseFile));
69 APT_HEADER_SET(PackageFileSz, sizeof(pkgCache::PackageFile));
70 APT_HEADER_SET(VersionSz, sizeof(pkgCache::Version));
71 APT_HEADER_SET(DescriptionSz, sizeof(pkgCache::Description));
72 APT_HEADER_SET(DependencySz, sizeof(pkgCache::Dependency));
73 APT_HEADER_SET(DependencyDataSz, sizeof(pkgCache::DependencyData));
74 APT_HEADER_SET(ProvidesSz, sizeof(pkgCache::Provides));
75 APT_HEADER_SET(VerFileSz, sizeof(pkgCache::VerFile));
76 APT_HEADER_SET(DescFileSz, sizeof(pkgCache::DescFile));
77#undef APT_HEADER_SET
78
52c41485 79 GroupCount = 0;
578bfd0a
AL
80 PackageCount = 0;
81 VersionCount = 0;
a52f938b 82 DescriptionCount = 0;
578bfd0a 83 DependsCount = 0;
71c9e95b 84 DependsDataCount = 0;
b07aeb1a 85 ReleaseFileCount = 0;
578bfd0a 86 PackageFileCount = 0;
a7e66b17 87 VerFileCount = 0;
a52f938b 88 DescFileCount = 0;
a7e66b17 89 ProvidesCount = 0;
ad00ae81 90 MaxVerFileSize = 0;
a52f938b 91 MaxDescFileSize = 0;
dfe66c72 92
578bfd0a 93 FileList = 0;
b07aeb1a 94 RlsFileList = 0;
b2e465d6
AL
95 VerSysName = 0;
96 Architecture = 0;
32ab4bd0 97 SetArchitectures(0);
3b4cbca2 98 SetHashTableSize(_config->FindI("APT::Cache-HashTableSize", 50503));
578bfd0a 99 memset(Pools,0,sizeof(Pools));
0688ccd8
JAK
100
101 CacheFileSize = 0;
578bfd0a
AL
102}
103 /*}}}*/
104// Cache::Header::CheckSizes - Check if the two headers have same *sz /*{{{*/
105// ---------------------------------------------------------------------
106/* */
107bool pkgCache::Header::CheckSizes(Header &Against) const
108{
109 if (HeaderSz == Against.HeaderSz &&
52c41485 110 GroupSz == Against.GroupSz &&
578bfd0a 111 PackageSz == Against.PackageSz &&
b07aeb1a 112 ReleaseFileSz == Against.ReleaseFileSz &&
578bfd0a
AL
113 PackageFileSz == Against.PackageFileSz &&
114 VersionSz == Against.VersionSz &&
a52f938b 115 DescriptionSz == Against.DescriptionSz &&
dcb79bae 116 DependencySz == Against.DependencySz &&
71c9e95b 117 DependencyDataSz == Against.DependencyDataSz &&
dcb79bae 118 VerFileSz == Against.VerFileSz &&
a52f938b 119 DescFileSz == Against.DescFileSz &&
578bfd0a
AL
120 ProvidesSz == Against.ProvidesSz)
121 return true;
122 return false;
123}
124 /*}}}*/
125
126// Cache::pkgCache - Constructor /*{{{*/
127// ---------------------------------------------------------------------
128/* */
32ab4bd0 129APT_IGNORE_DEPRECATED_PUSH
f40fdaa4 130pkgCache::pkgCache(MMap *Map, bool DoMap) : Map(*Map), VS(nullptr), d(NULL)
578bfd0a 131{
4cbf323f
MV
132 // call getArchitectures() with cached=false to ensure that the
133 // architectures cache is re-evaulated. this is needed in cases
134 // when the APT::Architecture field changes between two cache creations
135 MultiArchEnabled = APT::Configuration::getArchitectures(false).size() > 1;
b2e465d6
AL
136 if (DoMap == true)
137 ReMap();
578bfd0a 138}
32ab4bd0 139APT_IGNORE_DEPRECATED_POP
578bfd0a
AL
140 /*}}}*/
141// Cache::ReMap - Reopen the cache file /*{{{*/
142// ---------------------------------------------------------------------
143/* If the file is already closed then this will open it open it. */
a9fe5928 144bool pkgCache::ReMap(bool const &Errorchecks)
578bfd0a
AL
145{
146 // Apply the typecasts.
147 HeaderP = (Header *)Map.Data();
5bf15716 148 GrpP = (Group *)Map.Data();
578bfd0a 149 PkgP = (Package *)Map.Data();
dcb79bae 150 VerFileP = (VerFile *)Map.Data();
a52f938b 151 DescFileP = (DescFile *)Map.Data();
b07aeb1a 152 RlsFileP = (ReleaseFile *)Map.Data();
578bfd0a
AL
153 PkgFileP = (PackageFile *)Map.Data();
154 VerP = (Version *)Map.Data();
a52f938b 155 DescP = (Description *)Map.Data();
578bfd0a
AL
156 ProvideP = (Provides *)Map.Data();
157 DepP = (Dependency *)Map.Data();
71c9e95b 158 DepDataP = (DependencyData *)Map.Data();
578bfd0a
AL
159 StrP = (char *)Map.Data();
160
a9fe5928
DK
161 if (Errorchecks == false)
162 return true;
163
b2e465d6
AL
164 if (Map.Size() == 0 || HeaderP == 0)
165 return _error->Error(_("Empty package cache"));
578bfd0a
AL
166
167 // Check the header
168 Header DefHeader;
169 if (HeaderP->Signature != DefHeader.Signature ||
170 HeaderP->Dirty == true)
b2e465d6 171 return _error->Error(_("The package cache file is corrupted"));
578bfd0a
AL
172
173 if (HeaderP->MajorVersion != DefHeader.MajorVersion ||
174 HeaderP->MinorVersion != DefHeader.MinorVersion ||
175 HeaderP->CheckSizes(DefHeader) == false)
b2e465d6
AL
176 return _error->Error(_("The package cache file is an incompatible version"));
177
32ab4bd0 178 if (HeaderP->VerSysName == 0 || HeaderP->Architecture == 0 || HeaderP->GetArchitectures() == 0)
7a223b93
DK
179 return _error->Error(_("The package cache file is corrupted"));
180
b2e465d6 181 // Locate our VS..
7a223b93 182 if ((VS = pkgVersioningSystem::GetVS(StrP + HeaderP->VerSysName)) == 0)
db0db9fe 183 return _error->Error(_("This APT does not support the versioning system '%s'"),StrP + HeaderP->VerSysName);
b2e465d6 184
7a223b93
DK
185 // Check the architecture
186 std::vector<std::string> archs = APT::Configuration::getArchitectures();
9de2fd4d
JAK
187 std::string list = "";
188 for (auto const & arch : archs) {
189 if (!list.empty())
190 list.append(",");
191 list.append(arch);
192 }
7a223b93 193 if (_config->Find("APT::Architecture") != StrP + HeaderP->Architecture ||
32ab4bd0
DK
194 list != StrP + HeaderP->GetArchitectures())
195 return _error->Error(_("The package cache was built for different architectures: %s vs %s"), StrP + HeaderP->GetArchitectures(), list.c_str());
7a223b93 196
25c7a09d
JAK
197
198 auto hash = CacheHash();
199 if (_config->FindB("Debug::pkgCacheGen", false))
200 std::clog << "Opened cache with hash " << hash << ", expecting " << HeaderP->CacheFileSize << "\n";
201 if (hash != HeaderP->CacheFileSize)
202 return _error->Error(_("The package cache file is corrupted, it has the wrong hash"));
203
578bfd0a
AL
204 return true;
205}
206 /*}}}*/
207// Cache::Hash - Hash a string /*{{{*/
208// ---------------------------------------------------------------------
209/* This is used to generate the hash entries for the HashTable. With my
210 package list from bo this function gets 94% table usage on a 512 item
211 table (480 used items) */
eff0c22e
JAK
212map_id_t pkgCache::sHash(StringView Str) const
213{
214 uint32_t Hash = 5381;
215 for (auto I = Str.begin(); I != Str.end(); ++I)
216 Hash = 33 * Hash + tolower_ascii(*I);
217 return Hash % HeaderP->GetHashTableSize();
218}
4ad8619b 219map_id_t pkgCache::sHash(const string &Str) const
578bfd0a 220{
0748f03a 221 uint32_t Hash = 5381;
f7f0d6c7 222 for (string::const_iterator I = Str.begin(); I != Str.end(); ++I)
38a5b1ce 223 Hash = 33 * Hash + tolower_ascii((signed char)*I);
32ab4bd0 224 return Hash % HeaderP->GetHashTableSize();
578bfd0a
AL
225}
226
4ad8619b 227map_id_t pkgCache::sHash(const char *Str) const
578bfd0a 228{
0748f03a
JAK
229 uint32_t Hash = 5381;
230 for (const char *I = Str; *I != 0; ++I)
38a5b1ce 231 Hash = 33 * Hash + tolower_ascii((signed char)*I);
32ab4bd0 232 return Hash % HeaderP->GetHashTableSize();
578bfd0a 233}
25c7a09d
JAK
234
235uint32_t pkgCache::CacheHash()
236{
237 pkgCache::Header header = {};
238 uLong adler = adler32(0L, Z_NULL, 0);
239
240 if (Map.Size() < sizeof(header))
241 return adler;
242 memcpy(&header, GetMap().Data(), sizeof(header));
243
244 header.Dirty = false;
245 header.CacheFileSize = 0;
246
247 adler = adler32(adler,
248 reinterpret_cast<const unsigned char *>(&header),
249 sizeof(header));
250
251 if (Map.Size() > sizeof(header)) {
252 adler = adler32(adler,
253 static_cast<const unsigned char *>(GetMap().Data()) + sizeof(header),
254 GetMap().Size() - sizeof(header));
255 }
256
257 return adler;
258}
8d4c859d 259 /*}}}*/
578bfd0a
AL
260// Cache::FindPkg - Locate a package by name /*{{{*/
261// ---------------------------------------------------------------------
262/* Returns 0 on error, pointer to the package otherwise */
25396fb0 263pkgCache::PkgIterator pkgCache::FindPkg(const string &Name) {
eff0c22e
JAK
264 return FindPkg(StringView(Name));
265}
266
267pkgCache::PkgIterator pkgCache::FindPkg(StringView Name) {
074564d4 268 auto const found = Name.rfind(':');
25396fb0 269 if (found == string::npos)
6c9937da 270 return FindPkg(Name, "native");
eff0c22e 271 auto const Arch = Name.substr(found+1);
8fec289a
DK
272 /* Beware: This is specialcased to handle pkg:any in dependencies
273 as these are linked to virtual pkg:any named packages.
274 If you want any arch from a pkg, use FindPkg(pkg,"any") */
4d174dc8
DK
275 if (Arch == "any")
276 return FindPkg(Name, "any");
277 return FindPkg(Name.substr(0, found), Arch);
25396fb0
DK
278}
279 /*}}}*/
280// Cache::FindPkg - Locate a package by name /*{{{*/
281// ---------------------------------------------------------------------
282/* Returns 0 on error, pointer to the package otherwise */
8d4c859d 283pkgCache::PkgIterator pkgCache::FindPkg(const string &Name, string const &Arch) {
eff0c22e
JAK
284 return FindPkg(StringView(Name), StringView(Arch));
285}
286
287pkgCache::PkgIterator pkgCache::FindPkg(StringView Name, StringView Arch) {
5bf15716
DK
288 /* We make a detour via the GrpIterator here as
289 on a multi-arch environment a group is easier to
290 find than a package (less entries in the buckets) */
291 pkgCache::GrpIterator Grp = FindGrp(Name);
292 if (Grp.end() == true)
293 return PkgIterator(*this,0);
294
295 return Grp.FindPkg(Arch);
296}
297 /*}}}*/
298// Cache::FindGrp - Locate a group by name /*{{{*/
299// ---------------------------------------------------------------------
300/* Returns End-Pointer on error, pointer to the group otherwise */
301pkgCache::GrpIterator pkgCache::FindGrp(const string &Name) {
eff0c22e
JAK
302 return FindGrp(StringView(Name));
303}
304
305pkgCache::GrpIterator pkgCache::FindGrp(StringView Name) {
5bf15716
DK
306 if (unlikely(Name.empty() == true))
307 return GrpIterator(*this,0);
308
309 // Look at the hash bucket for the group
32ab4bd0 310 Group *Grp = GrpP + HeaderP->GrpHashTableP()[sHash(Name)];
5bf15716 311 for (; Grp != GrpP; Grp = GrpP + Grp->Next) {
60d523e2 312 int const cmp = Name.compare(ViewString(Grp->Name));
aa0fe657 313 if (cmp == 0)
5bf15716 314 return GrpIterator(*this, Grp);
aa0fe657
DK
315 else if (cmp < 0)
316 break;
5bf15716
DK
317 }
318
319 return GrpIterator(*this,0);
578bfd0a
AL
320}
321 /*}}}*/
b2e465d6
AL
322// Cache::CompTypeDeb - Return a string describing the compare type /*{{{*/
323// ---------------------------------------------------------------------
324/* This returns a string representation of the dependency compare
325 type in the weird debian style.. */
326const char *pkgCache::CompTypeDeb(unsigned char Comp)
327{
69c2ecbd
DK
328 const char * const Ops[] = {"","<=",">=","<<",">>","=","!="};
329 if (unlikely((unsigned)(Comp & 0xF) >= sizeof(Ops)/sizeof(Ops[0])))
330 return "";
331 return Ops[Comp & 0xF];
b2e465d6
AL
332}
333 /*}}}*/
334// Cache::CompType - Return a string describing the compare type /*{{{*/
335// ---------------------------------------------------------------------
69c2ecbd 336/* This returns a string representation of the dependency compare
b2e465d6
AL
337 type */
338const char *pkgCache::CompType(unsigned char Comp)
339{
69c2ecbd
DK
340 const char * const Ops[] = {"","<=",">=","<",">","=","!="};
341 if (unlikely((unsigned)(Comp & 0xF) >= sizeof(Ops)/sizeof(Ops[0])))
342 return "";
343 return Ops[Comp & 0xF];
b2e465d6
AL
344}
345 /*}}}*/
346// Cache::DepType - Return a string describing the dep type /*{{{*/
347// ---------------------------------------------------------------------
348/* */
349const char *pkgCache::DepType(unsigned char Type)
350{
351 const char *Types[] = {"",_("Depends"),_("PreDepends"),_("Suggests"),
352 _("Recommends"),_("Conflicts"),_("Replaces"),
f8ae7e8b 353 _("Obsoletes"),_("Breaks"), _("Enhances")};
308c7d30 354 if (Type < sizeof(Types)/sizeof(*Types))
b2e465d6
AL
355 return Types[Type];
356 return "";
357}
358 /*}}}*/
0149949b
AL
359// Cache::Priority - Convert a priority value to a string /*{{{*/
360// ---------------------------------------------------------------------
361/* */
362const char *pkgCache::Priority(unsigned char Prio)
363{
2fcd25a9 364 const char *Mapping[] = {0,_("required"),_("important"),_("standard"),
b2e465d6 365 _("optional"),_("extra")};
0149949b
AL
366 if (Prio < _count(Mapping))
367 return Mapping[Prio];
368 return 0;
369}
370 /*}}}*/
5bf15716
DK
371// GrpIterator::FindPkg - Locate a package by arch /*{{{*/
372// ---------------------------------------------------------------------
373/* Returns an End-Pointer on error, pointer to the package otherwise */
e841200b 374pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(string Arch) const {
eff0c22e
JAK
375 return FindPkg(StringView(Arch));
376}
377pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(const char *Arch) const {
378 return FindPkg(StringView(Arch));
379}
380pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(StringView Arch) const {
5bf15716
DK
381 if (unlikely(IsGood() == false || S->FirstPackage == 0))
382 return PkgIterator(*Owner, 0);
383
60dcec6d 384 /* If we accept any package we simply return the "first"
8fec289a 385 package in this group */
60dcec6d
DK
386 if (Arch == "any")
387 return PkgIterator(*Owner, Owner->PkgP + S->FirstPackage);
8fec289a
DK
388 if (Arch == "native" || Arch == "all")
389 Arch = Owner->NativeArch();
5bf15716 390
5d1e330d 391 // Iterate over the list to find the matching arch
5bf15716 392 for (pkgCache::Package *Pkg = PackageList(); Pkg != Owner->PkgP;
32ab4bd0 393 Pkg = Owner->PkgP + Pkg->NextPackage) {
60d523e2 394 if (Arch == Owner->ViewString(Pkg->Arch))
5bf15716
DK
395 return PkgIterator(*Owner, Pkg);
396 if ((Owner->PkgP + S->LastPackage) == Pkg)
397 break;
398 }
399
bd2fb30a
DK
400 return PkgIterator(*Owner, 0);
401}
402 /*}}}*/
403// GrpIterator::FindPreferredPkg - Locate the "best" package /*{{{*/
404// ---------------------------------------------------------------------
405/* Returns an End-Pointer on error, pointer to the package otherwise */
3db58cf4 406pkgCache::PkgIterator pkgCache::GrpIterator::FindPreferredPkg(bool const &PreferNonVirtual) const {
eff0c22e 407 pkgCache::PkgIterator Pkg = FindPkg(StringView("native", 6));
3db58cf4 408 if (Pkg.end() == false && (PreferNonVirtual == false || Pkg->VersionList != 0))
bd2fb30a
DK
409 return Pkg;
410
411 std::vector<std::string> const archs = APT::Configuration::getArchitectures();
412 for (std::vector<std::string>::const_iterator a = archs.begin();
413 a != archs.end(); ++a) {
414 Pkg = FindPkg(*a);
3db58cf4 415 if (Pkg.end() == false && (PreferNonVirtual == false || Pkg->VersionList != 0))
bd2fb30a
DK
416 return Pkg;
417 }
c919ad6e 418 // packages without an architecture
eff0c22e 419 Pkg = FindPkg(StringView("none", 4));
c919ad6e
DK
420 if (Pkg.end() == false && (PreferNonVirtual == false || Pkg->VersionList != 0))
421 return Pkg;
bd2fb30a 422
3db58cf4
DK
423 if (PreferNonVirtual == true)
424 return FindPreferredPkg(false);
5bf15716
DK
425 return PkgIterator(*Owner, 0);
426}
427 /*}}}*/
428// GrpIterator::NextPkg - Locate the next package in the group /*{{{*/
429// ---------------------------------------------------------------------
430/* Returns an End-Pointer on error, pointer to the package otherwise.
c408e01e
DK
431 We can't simply ++ to the next as the next package of the last will
432 be from a different group (with the same hash value) */
e841200b 433pkgCache::PkgIterator pkgCache::GrpIterator::NextPkg(pkgCache::PkgIterator const &LastPkg) const {
5bf15716
DK
434 if (unlikely(IsGood() == false || S->FirstPackage == 0 ||
435 LastPkg.end() == true))
436 return PkgIterator(*Owner, 0);
437
c408e01e
DK
438 if (S->LastPackage == LastPkg.Index())
439 return PkgIterator(*Owner, 0);
5bf15716 440
32ab4bd0 441 return PkgIterator(*Owner, Owner->PkgP + LastPkg->NextPackage);
5bf15716
DK
442}
443 /*}}}*/
71c9e95b 444// GrpIterator::operator++ - Prefix incr /*{{{*/
25396fb0
DK
445// ---------------------------------------------------------------------
446/* This will advance to the next logical group in the hash table. */
3707fd4f 447pkgCache::GrpIterator& pkgCache::GrpIterator::operator++()
25396fb0
DK
448{
449 // Follow the current links
450 if (S != Owner->GrpP)
451 S = Owner->GrpP + S->Next;
452
453 // Follow the hash table
32ab4bd0 454 while (S == Owner->GrpP && (HashIndex+1) < (signed)Owner->HeaderP->GetHashTableSize())
25396fb0 455 {
71c9e95b 456 ++HashIndex;
32ab4bd0 457 S = Owner->GrpP + Owner->HeaderP->GrpHashTableP()[HashIndex];
25396fb0 458 }
3707fd4f 459 return *this;
d3e8fbb3 460}
f55a958f 461 /*}}}*/
71c9e95b 462// PkgIterator::operator++ - Prefix incr /*{{{*/
578bfd0a
AL
463// ---------------------------------------------------------------------
464/* This will advance to the next logical package in the hash table. */
71c9e95b 465pkgCache::PkgIterator& pkgCache::PkgIterator::operator++()
578bfd0a
AL
466{
467 // Follow the current links
773e2c1f 468 if (S != Owner->PkgP)
32ab4bd0 469 S = Owner->PkgP + S->NextPackage;
b2e465d6 470
578bfd0a 471 // Follow the hash table
32ab4bd0 472 while (S == Owner->PkgP && (HashIndex+1) < (signed)Owner->HeaderP->GetHashTableSize())
578bfd0a 473 {
71c9e95b 474 ++HashIndex;
32ab4bd0 475 S = Owner->PkgP + Owner->HeaderP->PkgHashTableP()[HashIndex];
578bfd0a 476 }
3707fd4f 477 return *this;
d3e8fbb3 478}
578bfd0a 479 /*}}}*/
71c9e95b
DK
480pkgCache::DepIterator& pkgCache::DepIterator::operator++() /*{{{*/
481{
482 if (S == Owner->DepP)
483 return *this;
484 S = Owner->DepP + (Type == DepVer ? S->NextDepends : S->NextRevDepends);
485 if (S == Owner->DepP)
486 S2 = Owner->DepDataP;
487 else
488 S2 = Owner->DepDataP + S->DependencyData;
489 return *this;
490}
491 /*}}}*/
578bfd0a
AL
492// PkgIterator::State - Check the State of the package /*{{{*/
493// ---------------------------------------------------------------------
494/* By this we mean if it is either cleanly installed or cleanly removed. */
495pkgCache::PkgIterator::OkState pkgCache::PkgIterator::State() const
d38b7b3d 496{
773e2c1f
DK
497 if (S->InstState == pkgCache::State::ReInstReq ||
498 S->InstState == pkgCache::State::HoldReInstReq)
c7c1b0f6
AL
499 return NeedsUnpack;
500
773e2c1f
DK
501 if (S->CurrentState == pkgCache::State::UnPacked ||
502 S->CurrentState == pkgCache::State::HalfConfigured)
8d89cda7 503 // we leave triggers alone completely. dpkg deals with
c6aa14e4
MV
504 // them in a hard-to-predict manner and if they get
505 // resolved by dpkg before apt run dpkg --configure on
506 // the TriggersPending package dpkg returns a error
09fab244 507 //Pkg->CurrentState == pkgCache::State::TriggersAwaited
c6aa14e4 508 //Pkg->CurrentState == pkgCache::State::TriggersPending)
578bfd0a
AL
509 return NeedsConfigure;
510
773e2c1f
DK
511 if (S->CurrentState == pkgCache::State::HalfInstalled ||
512 S->InstState != pkgCache::State::Ok)
578bfd0a
AL
513 return NeedsUnpack;
514
515 return NeedsNothing;
516}
517 /*}}}*/
af29ffb4
MV
518// PkgIterator::CandVersion - Returns the candidate version string /*{{{*/
519// ---------------------------------------------------------------------
520/* Return string representing of the candidate version. */
521const char *
d3e8fbb3 522pkgCache::PkgIterator::CandVersion() const
af29ffb4
MV
523{
524 //TargetVer is empty, so don't use it.
749eb4cf 525 VerIterator version = pkgPolicy(Owner).GetCandidateVer(*this);
af29ffb4
MV
526 if (version.IsGood())
527 return version.VerStr();
528 return 0;
d3e8fbb3 529}
af29ffb4
MV
530 /*}}}*/
531// PkgIterator::CurVersion - Returns the current version string /*{{{*/
532// ---------------------------------------------------------------------
533/* Return string representing of the current version. */
534const char *
d3e8fbb3 535pkgCache::PkgIterator::CurVersion() const
af29ffb4
MV
536{
537 VerIterator version = CurrentVer();
538 if (version.IsGood())
539 return CurrentVer().VerStr();
540 return 0;
d3e8fbb3 541}
af29ffb4
MV
542 /*}}}*/
543// ostream operator to handle string representation of a package /*{{{*/
544// ---------------------------------------------------------------------
545/* Output name < cur.rent.version -> candid.ate.version | new.est.version > (section)
1e3f4083 546 Note that the characters <|>() are all literal above. Versions will be omitted
af29ffb4
MV
547 if they provide no new information (e.g. there is no newer version than candidate)
548 If no version and/or section can be found "none" is used. */
549std::ostream&
8f3ba4e8 550operator<<(std::ostream& out, pkgCache::PkgIterator Pkg)
af29ffb4
MV
551{
552 if (Pkg.end() == true)
553 return out << "invalid package";
554
555 string current = string(Pkg.CurVersion() == 0 ? "none" : Pkg.CurVersion());
556 string candidate = string(Pkg.CandVersion() == 0 ? "none" : Pkg.CandVersion());
557 string newest = string(Pkg.VersionList().end() ? "none" : Pkg.VersionList().VerStr());
558
5dd4c8b8 559 out << Pkg.Name() << " [ " << Pkg.Arch() << " ] < " << current;
af29ffb4
MV
560 if (current != candidate)
561 out << " -> " << candidate;
562 if ( newest != "none" && candidate != newest)
563 out << " | " << newest;
7a669774
DK
564 if (Pkg->VersionList == 0)
565 out << " > ( none )";
566 else
567 out << " > ( " << string(Pkg.VersionList().Section()==0?"unknown":Pkg.VersionList().Section()) << " )";
af29ffb4
MV
568 return out;
569}
570 /*}}}*/
75ce2062
DK
571// PkgIterator::FullName - Returns Name and (maybe) Architecture /*{{{*/
572// ---------------------------------------------------------------------
573/* Returns a name:arch string */
574std::string pkgCache::PkgIterator::FullName(bool const &Pretty) const
575{
576 string fullname = Name();
577 if (Pretty == false ||
f6ce7ffc 578 (strcmp(Arch(), "all") != 0 && strcmp(Arch(), "any") != 0 &&
959470da 579 strcmp(Owner->NativeArch(), Arch()) != 0))
75ce2062
DK
580 return fullname.append(":").append(Arch());
581 return fullname;
582}
583 /*}}}*/
578bfd0a
AL
584// DepIterator::IsCritical - Returns true if the dep is important /*{{{*/
585// ---------------------------------------------------------------------
586/* Currently critical deps are defined as depends, predepends and
308c7d30 587 conflicts (including dpkg's Breaks fields). */
e841200b 588bool pkgCache::DepIterator::IsCritical() const
578bfd0a 589{
359e46db 590 if (IsNegative() == true ||
71c9e95b
DK
591 S2->Type == pkgCache::Dep::Depends ||
592 S2->Type == pkgCache::Dep::PreDepends)
578bfd0a
AL
593 return true;
594 return false;
595}
596 /*}}}*/
df77d8a5
DK
597// DepIterator::IsNegative - Returns true if the dep is a negative one /*{{{*/
598// ---------------------------------------------------------------------
599/* Some dependencies are positive like Depends and Recommends, others
600 are negative like Conflicts which can and should be handled differently */
601bool pkgCache::DepIterator::IsNegative() const
602{
71c9e95b
DK
603 return S2->Type == Dep::DpkgBreaks ||
604 S2->Type == Dep::Conflicts ||
605 S2->Type == Dep::Obsoletes;
df77d8a5
DK
606}
607 /*}}}*/
578bfd0a
AL
608// DepIterator::SmartTargetPkg - Resolve dep target pointers w/provides /*{{{*/
609// ---------------------------------------------------------------------
610/* This intellegently looks at dep target packages and tries to figure
611 out which package should be used. This is needed to nicely handle
612 provide mapping. If the target package has no other providing packages
613 then it returned. Otherwise the providing list is looked at to
614 see if there is one one unique providing package if so it is returned.
615 Otherwise true is returned and the target package is set. The return
b2e465d6
AL
616 result indicates whether the node should be expandable
617
618 In Conjunction with the DepCache the value of Result may not be
619 super-good since the policy may have made it uninstallable. Using
620 AllTargets is better in this case. */
e841200b 621bool pkgCache::DepIterator::SmartTargetPkg(PkgIterator &Result) const
578bfd0a
AL
622{
623 Result = TargetPkg();
624
625 // No provides at all
626 if (Result->ProvidesList == 0)
627 return false;
628
629 // There is the Base package and the providing ones which is at least 2
630 if (Result->VersionList != 0)
631 return true;
632
633 /* We have to skip over indirect provisions of the package that
634 owns the dependency. For instance, if libc5-dev depends on the
635 virtual package libc-dev which is provided by libc5-dev and libc6-dev
636 we must ignore libc5-dev when considering the provides list. */
637 PrvIterator PStart = Result.ProvidesList();
f7f0d6c7 638 for (; PStart.end() != true && PStart.OwnerPkg() == ParentPkg(); ++PStart);
578bfd0a
AL
639
640 // Nothing but indirect self provides
641 if (PStart.end() == true)
642 return false;
643
644 // Check for single packages in the provides list
645 PrvIterator P = PStart;
f7f0d6c7 646 for (; P.end() != true; ++P)
578bfd0a
AL
647 {
648 // Skip over self provides
649 if (P.OwnerPkg() == ParentPkg())
650 continue;
651 if (PStart.OwnerPkg() != P.OwnerPkg())
652 break;
653 }
b2e465d6
AL
654
655 Result = PStart.OwnerPkg();
578bfd0a
AL
656
657 // Check for non dups
658 if (P.end() != true)
659 return true;
b2e465d6 660
578bfd0a
AL
661 return false;
662}
663 /*}}}*/
664// DepIterator::AllTargets - Returns the set of all possible targets /*{{{*/
665// ---------------------------------------------------------------------
b2e465d6 666/* This is a more useful version of TargetPkg() that follows versioned
578bfd0a 667 provides. It includes every possible package-version that could satisfy
fbfb2a7c
AL
668 the dependency. The last item in the list has a 0. The resulting pointer
669 must be delete [] 'd */
e841200b 670pkgCache::Version **pkgCache::DepIterator::AllTargets() const
578bfd0a
AL
671{
672 Version **Res = 0;
673 unsigned long Size =0;
674 while (1)
675 {
676 Version **End = Res;
677 PkgIterator DPkg = TargetPkg();
678
679 // Walk along the actual package providing versions
f7f0d6c7 680 for (VerIterator I = DPkg.VersionList(); I.end() == false; ++I)
578bfd0a 681 {
85434114 682 if (IsIgnorable(I.ParentPkg()) == true)
578bfd0a 683 continue;
887c6940 684 if (IsSatisfied(I) == false)
578bfd0a 685 continue;
85434114 686
578bfd0a
AL
687 Size++;
688 if (Res != 0)
689 *End++ = I;
690 }
691
692 // Follow all provides
f7f0d6c7 693 for (PrvIterator I = DPkg.ProvidesList(); I.end() == false; ++I)
578bfd0a 694 {
85434114 695 if (IsIgnorable(I) == true)
578bfd0a 696 continue;
887c6940 697 if (IsSatisfied(I) == false)
85434114 698 continue;
5f909b67 699
578bfd0a
AL
700 Size++;
701 if (Res != 0)
702 *End++ = I.OwnerVer();
703 }
704
705 // Do it again and write it into the array
706 if (Res == 0)
707 {
708 Res = new Version *[Size+1];
709 Size = 0;
710 }
711 else
712 {
713 *End = 0;
714 break;
715 }
716 }
717
718 return Res;
719}
720 /*}}}*/
43d017d6
AL
721// DepIterator::GlobOr - Compute an OR group /*{{{*/
722// ---------------------------------------------------------------------
723/* This Takes an iterator, iterates past the current dependency grouping
724 and returns Start and End so that so End is the final element
725 in the group, if End == Start then D is End++ and End is the
726 dependency D was pointing to. Use in loops to iterate sensibly. */
727void pkgCache::DepIterator::GlobOr(DepIterator &Start,DepIterator &End)
728{
729 // Compute a single dependency element (glob or)
730 Start = *this;
731 End = *this;
018f1533 732 for (bool LastOR = true; end() == false && LastOR == true;)
43d017d6 733 {
71c9e95b 734 LastOR = (S2->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or;
3707fd4f 735 ++(*this);
43d017d6
AL
736 if (LastOR == true)
737 End = (*this);
738 }
739}
740 /*}}}*/
85434114
DK
741// DepIterator::IsIgnorable - should this packag/providr be ignored? /*{{{*/
742// ---------------------------------------------------------------------
743/* Deps like self-conflicts should be ignored as well as implicit conflicts
744 on virtual packages. */
fd23676e 745bool pkgCache::DepIterator::IsIgnorable(PkgIterator const &PT) const
85434114 746{
021626db
DK
747 if (IsNegative() == false)
748 return false;
749
fd23676e 750 pkgCache::PkgIterator const PP = ParentPkg();
021626db
DK
751 if (PP->Group != PT->Group)
752 return false;
753 // self-conflict
754 if (PP == PT)
755 return true;
fd23676e 756 pkgCache::VerIterator const PV = ParentVer();
021626db
DK
757 // ignore group-conflict on a M-A:same package - but not our implicit dependencies
758 // so that we can have M-A:same packages conflicting with their own real name
759 if ((PV->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same)
8c7af4d4 760 return IsMultiArchImplicit() == false;
85434114
DK
761
762 return false;
763}
764bool pkgCache::DepIterator::IsIgnorable(PrvIterator const &Prv) const
765{
766 if (IsNegative() == false)
767 return false;
768
769 PkgIterator const Pkg = ParentPkg();
770 /* Provides may never be applied against the same package (or group)
771 if it is a conflicts. See the comment above. */
772 if (Prv.OwnerPkg()->Group == Pkg->Group)
773 return true;
774 // Implicit group-conflicts should not be applied on providers of other groups
8c7af4d4 775 if (IsMultiArchImplicit() && Prv.OwnerPkg()->Group != Pkg->Group)
85434114
DK
776 return true;
777
778 return false;
779}
780 /*}}}*/
887c6940
DK
781// DepIterator::IsSatisfied - check if a version satisfied the dependency /*{{{*/
782bool pkgCache::DepIterator::IsSatisfied(VerIterator const &Ver) const
783{
71c9e95b 784 return Owner->VS->CheckDep(Ver.VerStr(),S2->CompareOp,TargetVer());
887c6940
DK
785}
786bool pkgCache::DepIterator::IsSatisfied(PrvIterator const &Prv) const
787{
71c9e95b 788 return Owner->VS->CheckDep(Prv.ProvideVersion(),S2->CompareOp,TargetVer());
887c6940
DK
789}
790 /*}}}*/
8c7af4d4
DK
791// DepIterator::IsImplicit - added by the cache generation /*{{{*/
792bool pkgCache::DepIterator::IsImplicit() const
793{
794 if (IsMultiArchImplicit() == true)
795 return true;
796 if (IsNegative() || S2->Type == pkgCache::Dep::Replaces)
797 {
798 if ((S2->CompareOp & pkgCache::Dep::ArchSpecific) != pkgCache::Dep::ArchSpecific &&
799 strcmp(ParentPkg().Arch(), TargetPkg().Arch()) != 0)
800 return true;
801 }
802 return false;
803}
804 /*}}}*/
8d89cda7 805// ostream operator to handle string representation of a dependency /*{{{*/
47f6d1b7
DK
806// ---------------------------------------------------------------------
807/* */
8f3ba4e8 808std::ostream& operator<<(std::ostream& out, pkgCache::DepIterator D)
47f6d1b7
DK
809{
810 if (D.end() == true)
811 return out << "invalid dependency";
812
813 pkgCache::PkgIterator P = D.ParentPkg();
814 pkgCache::PkgIterator T = D.TargetPkg();
815
816 out << (P.end() ? "invalid pkg" : P.FullName(false)) << " " << D.DepType()
817 << " on ";
818 if (T.end() == true)
819 out << "invalid pkg";
820 else
821 out << T;
822
823 if (D->Version != 0)
824 out << " (" << D.CompType() << " " << D.TargetVer() << ")";
825
826 return out;
827}
828 /*}}}*/
578bfd0a
AL
829// VerIterator::CompareVer - Fast version compare for same pkgs /*{{{*/
830// ---------------------------------------------------------------------
831/* This just looks over the version list to see if B is listed before A. In
832 most cases this will return in under 4 checks, ver lists are short. */
833int pkgCache::VerIterator::CompareVer(const VerIterator &B) const
834{
835 // Check if they are equal
836 if (*this == B)
837 return 0;
838 if (end() == true)
839 return -1;
840 if (B.end() == true)
841 return 1;
842
843 /* Start at A and look for B. If B is found then A > B otherwise
844 B was before A so A < B */
845 VerIterator I = *this;
f7f0d6c7 846 for (;I.end() == false; ++I)
578bfd0a
AL
847 if (I == B)
848 return 1;
849 return -1;
850}
851 /*}}}*/
b518cca6
AL
852// VerIterator::Downloadable - Checks if the version is downloadable /*{{{*/
853// ---------------------------------------------------------------------
854/* */
0e6fe58e 855APT_PURE bool pkgCache::VerIterator::Downloadable() const
b518cca6
AL
856{
857 VerFileIterator Files = FileList();
f7f0d6c7 858 for (; Files.end() == false; ++Files)
b07aeb1a 859 if (Files.File().Flagged(pkgCache::Flag::NotSource) == false)
b518cca6
AL
860 return true;
861 return false;
862}
863 /*}}}*/
3c124dde
AL
864// VerIterator::Automatic - Check if this version is 'automatic' /*{{{*/
865// ---------------------------------------------------------------------
866/* This checks to see if any of the versions files are not NotAutomatic.
867 True if this version is selectable for automatic installation. */
0e6fe58e 868APT_PURE bool pkgCache::VerIterator::Automatic() const
3c124dde
AL
869{
870 VerFileIterator Files = FileList();
f7f0d6c7 871 for (; Files.end() == false; ++Files)
5ed56f93 872 // Do not check ButAutomaticUpgrades here as it is kind of automatic…
b07aeb1a 873 if (Files.File().Flagged(pkgCache::Flag::NotAutomatic) == false)
3c124dde
AL
874 return true;
875 return false;
876}
877 /*}}}*/
878// VerIterator::NewestFile - Return the newest file version relation /*{{{*/
879// ---------------------------------------------------------------------
880/* This looks at the version numbers associated with all of the sources
881 this version is in and returns the highest.*/
882pkgCache::VerFileIterator pkgCache::VerIterator::NewestFile() const
883{
884 VerFileIterator Files = FileList();
885 VerFileIterator Highest = Files;
f7f0d6c7 886 for (; Files.end() == false; ++Files)
3c124dde 887 {
b2e465d6 888 if (Owner->VS->CmpReleaseVer(Files.File().Version(),Highest.File().Version()) > 0)
3c124dde
AL
889 Highest = Files;
890 }
891
892 return Highest;
893}
894 /*}}}*/
b2e465d6
AL
895// VerIterator::RelStr - Release description string /*{{{*/
896// ---------------------------------------------------------------------
897/* This describes the version from a release-centric manner. The output is a
898 list of Label:Version/Archive */
7f8c0eed
DK
899static std::string PkgFileIteratorToRelString(pkgCache::PkgFileIterator const &File)
900{
901 std::string Res;
902 if (File.Label() != 0)
903 Res = Res + File.Label() + ':';
904
905 if (File.Archive() != 0)
906 {
907 if (File.Version() == 0)
908 Res += File.Archive();
909 else
910 Res = Res + File.Version() + '/' + File.Archive();
911 }
912 else
913 {
914 // No release file, print the host name that this came from
915 if (File.Site() == 0 || File.Site()[0] == 0)
916 Res += "localhost";
917 else
918 Res += File.Site();
919 }
920 return Res;
921}
d4489d49 922string pkgCache::VerIterator::RelStr() const
b2e465d6 923{
7f8c0eed 924 std::vector<std::string> RelStrs;
f7f0d6c7 925 for (pkgCache::VerFileIterator I = this->FileList(); I.end() == false; ++I)
b2e465d6
AL
926 {
927 // Do not print 'not source' entries'
b07aeb1a
DK
928 pkgCache::PkgFileIterator const File = I.File();
929 if (File.Flagged(pkgCache::Flag::NotSource))
b2e465d6
AL
930 continue;
931
7f8c0eed
DK
932 std::string const RS = PkgFileIteratorToRelString(File);
933 if (std::find(RelStrs.begin(), RelStrs.end(), RS) != RelStrs.end())
b2e465d6 934 continue;
b2e465d6 935
7f8c0eed
DK
936 RelStrs.push_back(RS);
937 }
938 std::ostringstream os;
939 if (likely(RelStrs.empty() == false))
940 {
941 std::copy(RelStrs.begin(), RelStrs.end()-1, std::ostream_iterator<std::string>(os, ", "));
942 os << *RelStrs.rbegin();
5dd4c8b8 943 }
857e9c13 944 if (S->ParentPkg != 0)
7f8c0eed
DK
945 os << " [" << Arch() << "]";
946 return os.str();
b2e465d6
AL
947}
948 /*}}}*/
7a948ec7
DK
949// VerIterator::MultiArchType - string representing MultiArch flag /*{{{*/
950const char * pkgCache::VerIterator::MultiArchType() const
951{
952 if ((S->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same)
953 return "same";
954 else if ((S->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign)
955 return "foreign";
956 else if ((S->MultiArch & pkgCache::Version::Allowed) == pkgCache::Version::Allowed)
957 return "allowed";
958 return "none";
959}
960 /*}}}*/
b07aeb1a 961// RlsFileIterator::IsOk - Checks if the cache is in sync with the file /*{{{*/
578bfd0a
AL
962// ---------------------------------------------------------------------
963/* This stats the file and compares its stats with the ones that were
b07aeb1a 964 stored during generation. Date checks should probably also be
578bfd0a 965 included here. */
b07aeb1a 966bool pkgCache::RlsFileIterator::IsOk()
578bfd0a
AL
967{
968 struct stat Buf;
969 if (stat(FileName(),&Buf) != 0)
970 return false;
971
773e2c1f 972 if (Buf.st_size != (signed)S->Size || Buf.st_mtime != S->mtime)
578bfd0a
AL
973 return false;
974
975 return true;
976}
977 /*}}}*/
b07aeb1a
DK
978// RlsFileIterator::RelStr - Return the release string /*{{{*/
979string pkgCache::RlsFileIterator::RelStr()
af87ab54
AL
980{
981 string Res;
982 if (Version() != 0)
983 Res = Res + (Res.empty() == true?"v=":",v=") + Version();
984 if (Origin() != 0)
985 Res = Res + (Res.empty() == true?"o=":",o=") + Origin();
986 if (Archive() != 0)
987 Res = Res + (Res.empty() == true?"a=":",a=") + Archive();
efc487fb
DK
988 if (Codename() != 0)
989 Res = Res + (Res.empty() == true?"n=":",n=") + Codename();
af87ab54
AL
990 if (Label() != 0)
991 Res = Res + (Res.empty() == true?"l=":",l=") + Label();
b07aeb1a
DK
992 return Res;
993}
994 /*}}}*/
995// PkgFileIterator::IsOk - Checks if the cache is in sync with the file /*{{{*/
996// ---------------------------------------------------------------------
997/* This stats the file and compares its stats with the ones that were
998 stored during generation. Date checks should probably also be
999 included here. */
1000bool pkgCache::PkgFileIterator::IsOk()
1001{
1002 struct stat Buf;
1003 if (stat(FileName(),&Buf) != 0)
1004 return false;
1005
1006 if (Buf.st_size != (signed)S->Size || Buf.st_mtime != S->mtime)
1007 return false;
1008
1009 return true;
1010}
1011 /*}}}*/
1012string pkgCache::PkgFileIterator::RelStr() /*{{{*/
1013{
1014 std::string Res;
1015 if (ReleaseFile() == 0)
1016 {
1017 if (Component() != 0)
1018 Res = Res + (Res.empty() == true?"a=":",a=") + Component();
1019 }
1020 else
1021 {
1022 Res = ReleaseFile().RelStr();
1023 if (Component() != 0)
1024 Res = Res + (Res.empty() == true?"c=":",c=") + Component();
1025 }
5dd4c8b8
DK
1026 if (Architecture() != 0)
1027 Res = Res + (Res.empty() == true?"b=":",b=") + Architecture();
af87ab54
AL
1028 return Res;
1029}
1030 /*}}}*/
012b102a
MV
1031// VerIterator::TranslatedDescription - Return the a DescIter for locale/*{{{*/
1032// ---------------------------------------------------------------------
d3e8fbb3 1033/* return a DescIter for the current locale or the default if none is
012b102a
MV
1034 * found
1035 */
1036pkgCache::DescIterator pkgCache::VerIterator::TranslatedDescription() const
1037{
45df0ad2
DK
1038 std::vector<string> const lang = APT::Configuration::getLanguages();
1039 for (std::vector<string>::const_iterator l = lang.begin();
f7f0d6c7 1040 l != lang.end(); ++l)
45df0ad2 1041 {
4b625b95
DK
1042 pkgCache::DescIterator Desc = DescriptionList();
1043 for (; Desc.end() == false; ++Desc)
0e7c3313 1044 if (*l == Desc.LanguageCode())
45df0ad2 1045 break;
4b625b95 1046 if (Desc.end() == true)
0e7c3313
DK
1047 {
1048 if (*l == "en")
1049 {
1050 Desc = DescriptionList();
1051 for (; Desc.end() == false; ++Desc)
1052 if (strcmp(Desc.LanguageCode(), "") == 0)
1053 break;
1054 if (Desc.end() == true)
1055 continue;
1056 }
1057 else
1058 continue;
1059 }
45df0ad2
DK
1060 return Desc;
1061 }
4b625b95
DK
1062 for (pkgCache::DescIterator Desc = DescriptionList();
1063 Desc.end() == false; ++Desc)
1064 if (strcmp(Desc.LanguageCode(), "") == 0)
1065 return Desc;
45df0ad2 1066 return DescriptionList();
d3e8fbb3 1067}
012b102a
MV
1068
1069 /*}}}*/
c8a4ce6c
DK
1070
1071pkgCache::~pkgCache() {}