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