]> git.saurik.com Git - apt.git/blame - apt-pkg/cacheset.cc
* apt-pkg/algorithms.cc:
[apt.git] / apt-pkg / cacheset.cc
CommitLineData
ffee1c2b
DK
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
3/* ######################################################################
4
5 Simple wrapper around a std::set to provide a similar interface to
7959c5ed
DK
6 a set of cache structures as to the complete set of all structures
7 in the pkgCache. Currently only Package is supported.
ffee1c2b
DK
8
9 ##################################################################### */
10 /*}}}*/
11// Include Files /*{{{*/
ea542140
DK
12#include <config.h>
13
78c32596 14#include <apt-pkg/aptconfiguration.h>
472ff00e 15#include <apt-pkg/cachefile.h>
9ba5aa3b 16#include <apt-pkg/cachefilter.h>
8fde7239 17#include <apt-pkg/cacheset.h>
ffee1c2b 18#include <apt-pkg/error.h>
ffee1c2b 19#include <apt-pkg/strutl.h>
856d3b06 20#include <apt-pkg/versionmatch.h>
472ff00e
DK
21#include <apt-pkg/pkgrecords.h>
22#include <apt-pkg/policy.h>
ffee1c2b 23
78c32596
DK
24#include <vector>
25
ffee1c2b 26#include <regex.h>
ea542140
DK
27
28#include <apti18n.h>
ffee1c2b
DK
29 /*}}}*/
30namespace APT {
dc0f01f7 31// FromTask - Return all packages in the cache from a specific task /*{{{*/
70e706ad 32PackageSet PackageSet::FromTask(pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
bd631595 33 size_t const archfound = pattern.find_last_of(':');
dc0f01f7
DK
34 std::string arch = "native";
35 if (archfound != std::string::npos) {
36 arch = pattern.substr(archfound+1);
37 pattern.erase(archfound);
38 }
39
40 if (pattern[pattern.length() -1] != '^')
c8db3fff 41 return APT::PackageSet(TASK);
dc0f01f7
DK
42 pattern.erase(pattern.length()-1);
43
bd631595 44 if (unlikely(Cache.GetPkgCache() == 0 || Cache.GetDepCache() == 0))
c8db3fff 45 return APT::PackageSet(TASK);
bd631595 46
c8db3fff 47 PackageSet pkgset(TASK);
dc0f01f7
DK
48 // get the records
49 pkgRecords Recs(Cache);
50
51 // build regexp for the task
52 regex_t Pattern;
53 char S[300];
54 snprintf(S, sizeof(S), "^Task:.*[, ]%s([, ]|$)", pattern.c_str());
55 if(regcomp(&Pattern,S, REG_EXTENDED | REG_NOSUB | REG_NEWLINE) != 0) {
56 _error->Error("Failed to compile task regexp");
57 return pkgset;
58 }
59
60 for (pkgCache::GrpIterator Grp = Cache->GrpBegin(); Grp.end() == false; ++Grp) {
61 pkgCache::PkgIterator Pkg = Grp.FindPkg(arch);
62 if (Pkg.end() == true)
63 continue;
64 pkgCache::VerIterator ver = Cache[Pkg].CandidateVerIter(Cache);
65 if(ver.end() == true)
66 continue;
67
68 pkgRecords::Parser &parser = Recs.Lookup(ver.FileList());
69 const char *start, *end;
70 parser.GetRec(start,end);
71 unsigned int const length = end - start;
72 char buf[length];
73 strncpy(buf, start, length);
74 buf[length-1] = '\0';
70e706ad
DK
75 if (regexec(&Pattern, buf, 0, 0, 0) != 0)
76 continue;
77
78 pkgset.insert(Pkg);
dc0f01f7 79 }
70e706ad 80 regfree(&Pattern);
dc0f01f7
DK
81
82 if (pkgset.empty() == true)
70e706ad 83 return helper.canNotFindTask(Cache, pattern);
dc0f01f7 84
70e706ad 85 helper.showTaskSelection(pkgset, pattern);
dc0f01f7
DK
86 return pkgset;
87}
88 /*}}}*/
ffee1c2b 89// FromRegEx - Return all packages in the cache matching a pattern /*{{{*/
70e706ad 90PackageSet PackageSet::FromRegEx(pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
6e235c66 91 static const char * const isregex = ".?+*|[^$";
6e235c66 92 if (pattern.find_first_of(isregex) == std::string::npos)
c8db3fff 93 return PackageSet(REGEX);
ffee1c2b 94
6e235c66 95 size_t archfound = pattern.find_last_of(':');
dc0f01f7 96 std::string arch = "native";
6e235c66
DK
97 if (archfound != std::string::npos) {
98 arch = pattern.substr(archfound+1);
99 if (arch.find_first_of(isregex) == std::string::npos)
100 pattern.erase(archfound);
101 else
102 arch = "native";
103 }
104
bd631595 105 if (unlikely(Cache.GetPkgCache() == 0))
c8db3fff 106 return PackageSet(REGEX);
bd631595 107
9ba5aa3b
DK
108 APT::CacheFilter::PackageNameMatchesRegEx regexfilter(pattern);
109
c8db3fff 110 PackageSet pkgset(REGEX);
9ba5aa3b
DK
111 for (pkgCache::GrpIterator Grp = Cache.GetPkgCache()->GrpBegin(); Grp.end() == false; ++Grp) {
112 if (regexfilter(Grp) == false)
ffee1c2b 113 continue;
6e235c66 114 pkgCache::PkgIterator Pkg = Grp.FindPkg(arch);
78c32596 115 if (Pkg.end() == true) {
6e235c66
DK
116 if (archfound == std::string::npos) {
117 std::vector<std::string> archs = APT::Configuration::getArchitectures();
118 for (std::vector<std::string>::const_iterator a = archs.begin();
119 a != archs.end() && Pkg.end() != true; ++a)
120 Pkg = Grp.FindPkg(*a);
78c32596
DK
121 }
122 if (Pkg.end() == true)
123 continue;
124 }
ffee1c2b 125
ffee1c2b
DK
126 pkgset.insert(Pkg);
127 }
ffee1c2b 128
70e706ad
DK
129 if (pkgset.empty() == true)
130 return helper.canNotFindRegEx(Cache, pattern);
131
132 helper.showRegExSelection(pkgset, pattern);
78c32596
DK
133 return pkgset;
134}
135 /*}}}*/
bd631595
DK
136// FromName - Returns the package defined by this string /*{{{*/
137pkgCache::PkgIterator PackageSet::FromName(pkgCacheFile &Cache,
138 std::string const &str, CacheSetHelper &helper) {
139 std::string pkg = str;
140 size_t archfound = pkg.find_last_of(':');
141 std::string arch;
142 if (archfound != std::string::npos) {
143 arch = pkg.substr(archfound+1);
144 pkg.erase(archfound);
145 }
146
147 if (Cache.GetPkgCache() == 0)
148 return pkgCache::PkgIterator(Cache, 0);
149
150 pkgCache::PkgIterator Pkg(Cache, 0);
151 if (arch.empty() == true) {
152 pkgCache::GrpIterator Grp = Cache.GetPkgCache()->FindGrp(pkg);
153 if (Grp.end() == false)
154 Pkg = Grp.FindPreferredPkg();
155 } else
156 Pkg = Cache.GetPkgCache()->FindPkg(pkg, arch);
157
158 if (Pkg.end() == true)
159 return helper.canNotFindPkgName(Cache, str);
160 return Pkg;
161}
162 /*}}}*/
9cc83a6f
DK
163// GroupedFromCommandLine - Return all versions specified on commandline/*{{{*/
164std::map<unsigned short, PackageSet> PackageSet::GroupedFromCommandLine(
165 pkgCacheFile &Cache, const char **cmdline,
166 std::list<PackageSet::Modifier> const &mods,
70e706ad 167 unsigned short const &fallback, CacheSetHelper &helper) {
9cc83a6f
DK
168 std::map<unsigned short, PackageSet> pkgsets;
169 for (const char **I = cmdline; *I != 0; ++I) {
170 unsigned short modID = fallback;
171 std::string str = *I;
bd631595 172 bool modifierPresent = false;
9cc83a6f
DK
173 for (std::list<PackageSet::Modifier>::const_iterator mod = mods.begin();
174 mod != mods.end(); ++mod) {
175 size_t const alength = strlen(mod->Alias);
176 switch(mod->Pos) {
177 case PackageSet::Modifier::POSTFIX:
178 if (str.compare(str.length() - alength, alength,
55c59998 179 mod->Alias, 0, alength) != 0)
9cc83a6f
DK
180 continue;
181 str.erase(str.length() - alength);
182 modID = mod->ID;
183 break;
184 case PackageSet::Modifier::PREFIX:
185 continue;
186 case PackageSet::Modifier::NONE:
187 continue;
188 }
bd631595 189 modifierPresent = true;
9cc83a6f
DK
190 break;
191 }
bd631595
DK
192 if (modifierPresent == true) {
193 bool const errors = helper.showErrors(false);
194 pkgCache::PkgIterator Pkg = FromName(Cache, *I, helper);
195 helper.showErrors(errors);
196 if (Pkg.end() == false) {
197 pkgsets[fallback].insert(Pkg);
198 continue;
199 }
200 }
70e706ad 201 pkgsets[modID].insert(PackageSet::FromString(Cache, str, helper));
9cc83a6f
DK
202 }
203 return pkgsets;
204}
205 /*}}}*/
78c32596 206// FromCommandLine - Return all packages specified on commandline /*{{{*/
70e706ad 207PackageSet PackageSet::FromCommandLine(pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper) {
78c32596 208 PackageSet pkgset;
9f1f17cc 209 for (const char **I = cmdline; *I != 0; ++I) {
70e706ad 210 PackageSet pset = FromString(Cache, *I, helper);
856d3b06
DK
211 pkgset.insert(pset.begin(), pset.end());
212 }
213 return pkgset;
214}
215 /*}}}*/
216// FromString - Return all packages matching a specific string /*{{{*/
70e706ad 217PackageSet PackageSet::FromString(pkgCacheFile &Cache, std::string const &str, CacheSetHelper &helper) {
48c39e32
DK
218 _error->PushToStack();
219
bd631595
DK
220 PackageSet pkgset;
221 pkgCache::PkgIterator Pkg = FromName(Cache, str, helper);
222 if (Pkg.end() == false)
223 pkgset.insert(Pkg);
224 else {
225 pkgset = FromTask(Cache, str, helper);
226 if (pkgset.empty() == true) {
227 pkgset = FromRegEx(Cache, str, helper);
228 if (pkgset.empty() == true)
229 pkgset = helper.canNotFindPackage(Cache, str);
230 }
48c39e32 231 }
dc0f01f7 232
bd631595 233 if (pkgset.empty() == false)
48c39e32
DK
234 _error->RevertToStack();
235 else
236 _error->MergeWithStack();
bd631595 237 return pkgset;
856d3b06
DK
238}
239 /*}}}*/
55c59998
DK
240// GroupedFromCommandLine - Return all versions specified on commandline/*{{{*/
241std::map<unsigned short, VersionSet> VersionSet::GroupedFromCommandLine(
242 pkgCacheFile &Cache, const char **cmdline,
243 std::list<VersionSet::Modifier> const &mods,
70e706ad 244 unsigned short const &fallback, CacheSetHelper &helper) {
55c59998
DK
245 std::map<unsigned short, VersionSet> versets;
246 for (const char **I = cmdline; *I != 0; ++I) {
247 unsigned short modID = fallback;
248 VersionSet::Version select = VersionSet::NEWEST;
249 std::string str = *I;
bd631595 250 bool modifierPresent = false;
55c59998
DK
251 for (std::list<VersionSet::Modifier>::const_iterator mod = mods.begin();
252 mod != mods.end(); ++mod) {
253 if (modID == fallback && mod->ID == fallback)
254 select = mod->SelectVersion;
255 size_t const alength = strlen(mod->Alias);
256 switch(mod->Pos) {
257 case VersionSet::Modifier::POSTFIX:
258 if (str.compare(str.length() - alength, alength,
259 mod->Alias, 0, alength) != 0)
260 continue;
261 str.erase(str.length() - alength);
262 modID = mod->ID;
263 select = mod->SelectVersion;
264 break;
265 case VersionSet::Modifier::PREFIX:
266 continue;
267 case VersionSet::Modifier::NONE:
268 continue;
269 }
bd631595 270 modifierPresent = true;
55c59998
DK
271 break;
272 }
bd631595
DK
273
274 if (modifierPresent == true) {
275 bool const errors = helper.showErrors(false);
276 VersionSet const vset = VersionSet::FromString(Cache, std::string(*I), select, helper, true);
277 helper.showErrors(errors);
278 if (vset.empty() == false) {
279 versets[fallback].insert(vset);
280 continue;
281 }
282 }
70e706ad 283 versets[modID].insert(VersionSet::FromString(Cache, str, select , helper));
55c59998
DK
284 }
285 return versets;
286}
287 /*}}}*/
856d3b06
DK
288// FromCommandLine - Return all versions specified on commandline /*{{{*/
289APT::VersionSet VersionSet::FromCommandLine(pkgCacheFile &Cache, const char **cmdline,
70e706ad 290 APT::VersionSet::Version const &fallback, CacheSetHelper &helper) {
856d3b06 291 VersionSet verset;
bd631595
DK
292 for (const char **I = cmdline; *I != 0; ++I)
293 verset.insert(VersionSet::FromString(Cache, *I, fallback, helper));
55c59998
DK
294 return verset;
295}
296 /*}}}*/
297// FromString - Returns all versions spedcified by a string /*{{{*/
298APT::VersionSet VersionSet::FromString(pkgCacheFile &Cache, std::string pkg,
bd631595
DK
299 APT::VersionSet::Version const &fallback, CacheSetHelper &helper,
300 bool const &onlyFromName) {
55c59998
DK
301 std::string ver;
302 bool verIsRel = false;
303 size_t const vertag = pkg.find_last_of("/=");
472ff00e 304 if (vertag != std::string::npos) {
55c59998
DK
305 ver = pkg.substr(vertag+1);
306 verIsRel = (pkg[vertag] == '/');
307 pkg.erase(vertag);
308 }
bd631595
DK
309 PackageSet pkgset;
310 if (onlyFromName == false)
311 pkgset = PackageSet::FromString(Cache, pkg, helper);
312 else {
313 pkgset.insert(PackageSet::FromName(Cache, pkg, helper));
314 }
315
55c59998 316 VersionSet verset;
c8db3fff
DK
317 bool errors = true;
318 if (pkgset.getConstructor() != PackageSet::UNKNOWN)
319 errors = helper.showErrors(false);
55c59998
DK
320 for (PackageSet::const_iterator P = pkgset.begin();
321 P != pkgset.end(); ++P) {
472ff00e 322 if (vertag == std::string::npos) {
fb83c1d0 323 verset.insert(VersionSet::FromPackage(Cache, P, fallback, helper));
55c59998 324 continue;
856d3b06 325 }
55c59998
DK
326 pkgCache::VerIterator V;
327 if (ver == "installed")
70e706ad 328 V = getInstalledVer(Cache, P, helper);
55c59998 329 else if (ver == "candidate")
70e706ad 330 V = getCandidateVer(Cache, P, helper);
f1a58ff8
DK
331 else if (ver == "newest") {
332 if (P->VersionList != 0)
333 V = P.VersionList();
334 else
335 V = helper.canNotFindNewestVer(Cache, P);
336 } else {
55c59998
DK
337 pkgVersionMatch Match(ver, (verIsRel == true ? pkgVersionMatch::Release :
338 pkgVersionMatch::Version));
339 V = Match.Find(P);
340 if (V.end() == true) {
341 if (verIsRel == true)
342 _error->Error(_("Release '%s' for '%s' was not found"),
343 ver.c_str(), P.FullName(true).c_str());
344 else
345 _error->Error(_("Version '%s' for '%s' was not found"),
346 ver.c_str(), P.FullName(true).c_str());
84910ad5
DK
347 continue;
348 }
78c32596 349 }
55c59998
DK
350 if (V.end() == true)
351 continue;
70e706ad 352 helper.showSelectedVersion(P, V, ver, verIsRel);
55c59998 353 verset.insert(V);
78c32596 354 }
c8db3fff
DK
355 if (pkgset.getConstructor() != PackageSet::UNKNOWN)
356 helper.showErrors(errors);
856d3b06
DK
357 return verset;
358}
359 /*}}}*/
fb83c1d0
DK
360// FromPackage - versions from package based on fallback /*{{{*/
361VersionSet VersionSet::FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P,
362 VersionSet::Version const &fallback, CacheSetHelper &helper) {
363 VersionSet verset;
84910ad5 364 pkgCache::VerIterator V;
70e706ad 365 bool showErrors;
84910ad5
DK
366 switch(fallback) {
367 case VersionSet::ALL:
368 if (P->VersionList != 0)
369 for (V = P.VersionList(); V.end() != true; ++V)
370 verset.insert(V);
84910ad5 371 else
70e706ad 372 verset.insert(helper.canNotFindAllVer(Cache, P));
84910ad5
DK
373 break;
374 case VersionSet::CANDANDINST:
70e706ad
DK
375 verset.insert(getInstalledVer(Cache, P, helper));
376 verset.insert(getCandidateVer(Cache, P, helper));
84910ad5
DK
377 break;
378 case VersionSet::CANDIDATE:
70e706ad 379 verset.insert(getCandidateVer(Cache, P, helper));
84910ad5
DK
380 break;
381 case VersionSet::INSTALLED:
70e706ad 382 verset.insert(getInstalledVer(Cache, P, helper));
84910ad5
DK
383 break;
384 case VersionSet::CANDINST:
70e706ad
DK
385 showErrors = helper.showErrors(false);
386 V = getCandidateVer(Cache, P, helper);
84910ad5 387 if (V.end() == true)
70e706ad
DK
388 V = getInstalledVer(Cache, P, helper);
389 helper.showErrors(showErrors);
84910ad5
DK
390 if (V.end() == false)
391 verset.insert(V);
84910ad5 392 else
70e706ad 393 verset.insert(helper.canNotFindInstCandVer(Cache, P));
84910ad5
DK
394 break;
395 case VersionSet::INSTCAND:
70e706ad
DK
396 showErrors = helper.showErrors(false);
397 V = getInstalledVer(Cache, P, helper);
84910ad5 398 if (V.end() == true)
70e706ad
DK
399 V = getCandidateVer(Cache, P, helper);
400 helper.showErrors(showErrors);
84910ad5
DK
401 if (V.end() == false)
402 verset.insert(V);
84910ad5 403 else
70e706ad 404 verset.insert(helper.canNotFindInstCandVer(Cache, P));
84910ad5
DK
405 break;
406 case VersionSet::NEWEST:
407 if (P->VersionList != 0)
408 verset.insert(P.VersionList());
84910ad5 409 else
70e706ad 410 verset.insert(helper.canNotFindNewestVer(Cache, P));
84910ad5
DK
411 break;
412 }
fb83c1d0 413 return verset;
84910ad5
DK
414}
415 /*}}}*/
856d3b06
DK
416// getCandidateVer - Returns the candidate version of the given package /*{{{*/
417pkgCache::VerIterator VersionSet::getCandidateVer(pkgCacheFile &Cache,
70e706ad 418 pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper) {
a8ef7efd 419 pkgCache::VerIterator Cand;
2fbfb111
DK
420 if (Cache.IsPolicyBuilt() == true || Cache.IsDepCacheBuilt() == false)
421 {
bd631595
DK
422 if (unlikely(Cache.GetPolicy() == 0))
423 return pkgCache::VerIterator(Cache);
a8ef7efd 424 Cand = Cache.GetPolicy()->GetCandidateVer(Pkg);
2fbfb111
DK
425 } else {
426 Cand = Cache[Pkg].CandidateVerIter(Cache);
a8ef7efd 427 }
70e706ad
DK
428 if (Cand.end() == true)
429 return helper.canNotFindCandidateVer(Cache, Pkg);
856d3b06
DK
430 return Cand;
431}
432 /*}}}*/
433// getInstalledVer - Returns the installed version of the given package /*{{{*/
434pkgCache::VerIterator VersionSet::getInstalledVer(pkgCacheFile &Cache,
70e706ad
DK
435 pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper) {
436 if (Pkg->CurrentVer == 0)
437 return helper.canNotFindInstalledVer(Cache, Pkg);
856d3b06 438 return Pkg.CurrentVer();
ffee1c2b
DK
439}
440 /*}}}*/
bd631595
DK
441// canNotFindPkgName - handle the case no package has this name /*{{{*/
442pkgCache::PkgIterator CacheSetHelper::canNotFindPkgName(pkgCacheFile &Cache,
443 std::string const &str) {
444 if (ShowError == true)
cd7bbc47 445 _error->Insert(ErrorType, _("Unable to locate package %s"), str.c_str());
bd631595
DK
446 return pkgCache::PkgIterator(Cache, 0);
447}
448 /*}}}*/
70e706ad
DK
449// canNotFindTask - handle the case no package is found for a task /*{{{*/
450PackageSet CacheSetHelper::canNotFindTask(pkgCacheFile &Cache, std::string pattern) {
451 if (ShowError == true)
cd7bbc47 452 _error->Insert(ErrorType, _("Couldn't find task '%s'"), pattern.c_str());
70e706ad
DK
453 return PackageSet();
454}
455 /*}}}*/
456// canNotFindRegEx - handle the case no package is found by a regex /*{{{*/
457PackageSet CacheSetHelper::canNotFindRegEx(pkgCacheFile &Cache, std::string pattern) {
458 if (ShowError == true)
cd7bbc47 459 _error->Insert(ErrorType, _("Couldn't find any package by regex '%s'"), pattern.c_str());
70e706ad
DK
460 return PackageSet();
461}
462 /*}}}*/
463// canNotFindPackage - handle the case no package is found from a string/*{{{*/
464PackageSet CacheSetHelper::canNotFindPackage(pkgCacheFile &Cache, std::string const &str) {
70e706ad
DK
465 return PackageSet();
466}
467 /*}}}*/
468// canNotFindAllVer /*{{{*/
469VersionSet CacheSetHelper::canNotFindAllVer(pkgCacheFile &Cache,
470 pkgCache::PkgIterator const &Pkg) {
471 if (ShowError == true)
edc0ef10 472 _error->Insert(ErrorType, _("Can't select versions from package '%s' as it is purely virtual"), Pkg.FullName(true).c_str());
70e706ad
DK
473 return VersionSet();
474}
475 /*}}}*/
476// canNotFindInstCandVer /*{{{*/
477VersionSet CacheSetHelper::canNotFindInstCandVer(pkgCacheFile &Cache,
478 pkgCache::PkgIterator const &Pkg) {
479 if (ShowError == true)
cd7bbc47 480 _error->Insert(ErrorType, _("Can't select installed nor candidate version from package '%s' as it has neither of them"), Pkg.FullName(true).c_str());
70e706ad
DK
481 return VersionSet();
482}
483 /*}}}*/
cf28bcad
DK
484// canNotFindInstCandVer /*{{{*/
485VersionSet CacheSetHelper::canNotFindCandInstVer(pkgCacheFile &Cache,
486 pkgCache::PkgIterator const &Pkg) {
487 if (ShowError == true)
cd7bbc47 488 _error->Insert(ErrorType, _("Can't select installed nor candidate version from package '%s' as it has neither of them"), Pkg.FullName(true).c_str());
cf28bcad
DK
489 return VersionSet();
490}
491 /*}}}*/
70e706ad
DK
492// canNotFindNewestVer /*{{{*/
493pkgCache::VerIterator CacheSetHelper::canNotFindNewestVer(pkgCacheFile &Cache,
494 pkgCache::PkgIterator const &Pkg) {
495 if (ShowError == true)
cd7bbc47 496 _error->Insert(ErrorType, _("Can't select newest version from package '%s' as it is purely virtual"), Pkg.FullName(true).c_str());
c8db3fff 497 return pkgCache::VerIterator(Cache, 0);
70e706ad
DK
498}
499 /*}}}*/
500// canNotFindCandidateVer /*{{{*/
501pkgCache::VerIterator CacheSetHelper::canNotFindCandidateVer(pkgCacheFile &Cache,
502 pkgCache::PkgIterator const &Pkg) {
503 if (ShowError == true)
cd7bbc47 504 _error->Insert(ErrorType, _("Can't select candidate version from package %s as it has no candidate"), Pkg.FullName(true).c_str());
c8db3fff 505 return pkgCache::VerIterator(Cache, 0);
70e706ad
DK
506}
507 /*}}}*/
508// canNotFindInstalledVer /*{{{*/
509pkgCache::VerIterator CacheSetHelper::canNotFindInstalledVer(pkgCacheFile &Cache,
510 pkgCache::PkgIterator const &Pkg) {
511 if (ShowError == true)
cd7bbc47 512 _error->Insert(ErrorType, _("Can't select installed version from package %s as it is not installed"), Pkg.FullName(true).c_str());
c8db3fff 513 return pkgCache::VerIterator(Cache, 0);
70e706ad
DK
514}
515 /*}}}*/
ffee1c2b 516}