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