Merge remote-tracking branch 'donkult/debian/sid' into debian/sid
[ntk/apt.git] / apt-pkg / cacheset.cc
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 /* ######################################################################
4
5 Simple wrapper around a std::set to provide a similar interface to
6 a set of cache structures as to the complete set of all structures
7 in the pkgCache. Currently only Package is supported.
8
9 ##################################################################### */
10 /*}}}*/
11 // Include Files /*{{{*/
12 #include <config.h>
13
14 #include <apt-pkg/aptconfiguration.h>
15 #include <apt-pkg/cachefile.h>
16 #include <apt-pkg/cachefilter.h>
17 #include <apt-pkg/cacheset.h>
18 #include <apt-pkg/error.h>
19 #include <apt-pkg/strutl.h>
20 #include <apt-pkg/versionmatch.h>
21 #include <apt-pkg/pkgrecords.h>
22 #include <apt-pkg/policy.h>
23
24 #include <vector>
25
26 #include <regex.h>
27
28 #include <apti18n.h>
29 /*}}}*/
30 namespace APT {
31 // FromTask - Return all packages in the cache from a specific task /*{{{*/
32 bool PackageContainerInterface::FromTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
33 size_t const archfound = pattern.find_last_of(':');
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] != '^')
41 return false;
42 pattern.erase(pattern.length()-1);
43
44 if (unlikely(Cache.GetPkgCache() == 0 || Cache.GetDepCache() == 0))
45 return false;
46
47 bool const wasEmpty = pci->empty();
48 if (wasEmpty == true)
49 pci->setConstructor(TASK);
50
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");
60 return false;
61 }
62
63 bool found = false;
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 if (unlikely(length == 0))
77 continue;
78 char buf[length];
79 strncpy(buf, start, length);
80 buf[length-1] = '\0';
81 if (regexec(&Pattern, buf, 0, 0, 0) != 0)
82 continue;
83
84 pci->insert(Pkg);
85 helper.showTaskSelection(Pkg, pattern);
86 found = true;
87 }
88 regfree(&Pattern);
89
90 if (found == false) {
91 helper.canNotFindTask(pci, Cache, pattern);
92 pci->setConstructor(UNKNOWN);
93 return false;
94 }
95
96 if (wasEmpty == false && pci->getConstructor() != UNKNOWN)
97 pci->setConstructor(UNKNOWN);
98
99 return true;
100 }
101 /*}}}*/
102 // FromRegEx - Return all packages in the cache matching a pattern /*{{{*/
103 bool PackageContainerInterface::FromRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
104 static const char * const isregex = ".?+*|[^$";
105 if (pattern.find_first_of(isregex) == std::string::npos)
106 return false;
107
108 bool const wasEmpty = pci->empty();
109 if (wasEmpty == true)
110 pci->setConstructor(REGEX);
111
112 size_t archfound = pattern.find_last_of(':');
113 std::string arch = "native";
114 if (archfound != std::string::npos) {
115 arch = pattern.substr(archfound+1);
116 if (arch.find_first_of(isregex) == std::string::npos)
117 pattern.erase(archfound);
118 else
119 arch = "native";
120 }
121
122 if (unlikely(Cache.GetPkgCache() == 0))
123 return false;
124
125 APT::CacheFilter::PackageNameMatchesRegEx regexfilter(pattern);
126
127 bool found = false;
128 for (pkgCache::GrpIterator Grp = Cache.GetPkgCache()->GrpBegin(); Grp.end() == false; ++Grp) {
129 if (regexfilter(Grp) == false)
130 continue;
131 pkgCache::PkgIterator Pkg = Grp.FindPkg(arch);
132 if (Pkg.end() == true) {
133 if (archfound == std::string::npos) {
134 std::vector<std::string> archs = APT::Configuration::getArchitectures();
135 for (std::vector<std::string>::const_iterator a = archs.begin();
136 a != archs.end() && Pkg.end() != true; ++a)
137 Pkg = Grp.FindPkg(*a);
138 }
139 if (Pkg.end() == true)
140 continue;
141 }
142
143 pci->insert(Pkg);
144 helper.showRegExSelection(Pkg, pattern);
145 found = true;
146 }
147
148 if (found == false) {
149 helper.canNotFindRegEx(pci, Cache, pattern);
150 pci->setConstructor(UNKNOWN);
151 return false;
152 }
153
154 if (wasEmpty == false && pci->getConstructor() != UNKNOWN)
155 pci->setConstructor(UNKNOWN);
156
157 return true;
158 }
159 /*}}}*/
160 // FromFnmatch - Returns the package defined by this fnmatch /*{{{*/
161 bool
162 PackageContainerInterface::FromFnmatch(PackageContainerInterface * const pci,
163 pkgCacheFile &Cache,
164 std::string pattern,
165 CacheSetHelper &helper)
166 {
167 static const char * const isfnmatch = ".?*[]!";
168 if (pattern.find_first_of(isfnmatch) == std::string::npos)
169 return false;
170
171 bool const wasEmpty = pci->empty();
172 if (wasEmpty == true)
173 pci->setConstructor(FNMATCH);
174
175 size_t archfound = pattern.find_last_of(':');
176 std::string arch = "native";
177 if (archfound != std::string::npos) {
178 arch = pattern.substr(archfound+1);
179 if (arch.find_first_of(isfnmatch) == std::string::npos)
180 pattern.erase(archfound);
181 else
182 arch = "native";
183 }
184
185 if (unlikely(Cache.GetPkgCache() == 0))
186 return false;
187
188 APT::CacheFilter::PackageNameMatchesFnmatch filter(pattern);
189
190 bool found = false;
191 for (pkgCache::GrpIterator Grp = Cache.GetPkgCache()->GrpBegin(); Grp.end() == false; ++Grp) {
192 if (filter(Grp) == false)
193 continue;
194 pkgCache::PkgIterator Pkg = Grp.FindPkg(arch);
195 if (Pkg.end() == true) {
196 if (archfound == std::string::npos) {
197 std::vector<std::string> archs = APT::Configuration::getArchitectures();
198 for (std::vector<std::string>::const_iterator a = archs.begin();
199 a != archs.end() && Pkg.end() != true; ++a)
200 Pkg = Grp.FindPkg(*a);
201 }
202 if (Pkg.end() == true)
203 continue;
204 }
205
206 pci->insert(Pkg);
207 helper.showRegExSelection(Pkg, pattern);
208 found = true;
209 }
210
211 if (found == false) {
212 helper.canNotFindRegEx(pci, Cache, pattern);
213 pci->setConstructor(UNKNOWN);
214 return false;
215 }
216
217 if (wasEmpty == false && pci->getConstructor() != UNKNOWN)
218 pci->setConstructor(UNKNOWN);
219
220 return true;
221 }
222 /*}}}*/
223 // FromName - Returns the package defined by this string /*{{{*/
224 pkgCache::PkgIterator PackageContainerInterface::FromName(pkgCacheFile &Cache,
225 std::string const &str, CacheSetHelper &helper) {
226 std::string pkg = str;
227 size_t archfound = pkg.find_last_of(':');
228 std::string arch;
229 if (archfound != std::string::npos) {
230 arch = pkg.substr(archfound+1);
231 pkg.erase(archfound);
232 }
233
234 if (Cache.GetPkgCache() == 0)
235 return pkgCache::PkgIterator(Cache, 0);
236
237 pkgCache::PkgIterator Pkg(Cache, 0);
238 if (arch.empty() == true) {
239 pkgCache::GrpIterator Grp = Cache.GetPkgCache()->FindGrp(pkg);
240 if (Grp.end() == false)
241 Pkg = Grp.FindPreferredPkg();
242 } else
243 Pkg = Cache.GetPkgCache()->FindPkg(pkg, arch);
244
245 if (Pkg.end() == true)
246 return helper.canNotFindPkgName(Cache, str);
247 return Pkg;
248 }
249 /*}}}*/
250 // FromGroup - Returns the package defined by this string /*{{{*/
251 bool PackageContainerInterface::FromGroup(PackageContainerInterface * const pci, pkgCacheFile &Cache,
252 std::string pkg, CacheSetHelper &helper) {
253 if (unlikely(Cache.GetPkgCache() == 0))
254 return false;
255
256 size_t const archfound = pkg.find_last_of(':');
257 std::string arch;
258 if (archfound != std::string::npos) {
259 arch = pkg.substr(archfound+1);
260 pkg.erase(archfound);
261 if (arch == "all" || arch == "native")
262 arch = _config->Find("APT::Architecture");
263 }
264
265 pkgCache::GrpIterator Grp = Cache.GetPkgCache()->FindGrp(pkg);
266 if (Grp.end() == false) {
267 if (arch.empty() == true) {
268 pkgCache::PkgIterator Pkg = Grp.FindPreferredPkg();
269 if (Pkg.end() == false)
270 {
271 pci->insert(Pkg);
272 return true;
273 }
274 } else {
275 bool found = false;
276 // for 'linux-any' return the first package matching, for 'linux-*' return all matches
277 bool const isGlobal = arch.find('*') != std::string::npos;
278 APT::CacheFilter::PackageArchitectureMatchesSpecification pams(arch);
279 for (pkgCache::PkgIterator Pkg = Grp.PackageList(); Pkg.end() == false; Pkg = Grp.NextPkg(Pkg)) {
280 if (pams(Pkg) == false)
281 continue;
282 pci->insert(Pkg);
283 found = true;
284 if (isGlobal == false)
285 break;
286 }
287 if (found == true)
288 return true;
289 }
290 }
291
292 pkgCache::PkgIterator Pkg = helper.canNotFindPkgName(Cache, pkg);
293 if (Pkg.end() == true)
294 return false;
295
296 pci->insert(Pkg);
297 return true;
298 }
299 /*}}}*/
300 // FromString - Return all packages matching a specific string /*{{{*/
301 bool PackageContainerInterface::FromString(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &str, CacheSetHelper &helper) {
302 bool found = true;
303 _error->PushToStack();
304
305 if (FromGroup(pci, Cache, str, helper) == false &&
306 FromTask(pci, Cache, str, helper) == false &&
307 FromFnmatch(pci, Cache, str, helper) == false &&
308 FromRegEx(pci, Cache, str, helper) == false)
309 {
310 helper.canNotFindPackage(pci, Cache, str);
311 found = false;
312 }
313
314 if (found == true)
315 _error->RevertToStack();
316 else
317 _error->MergeWithStack();
318 return found;
319 }
320 /*}}}*/
321 // FromCommandLine - Return all packages specified on commandline /*{{{*/
322 bool PackageContainerInterface::FromCommandLine(PackageContainerInterface * const pci, pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper) {
323 bool found = false;
324 for (const char **I = cmdline; *I != 0; ++I)
325 found |= PackageContainerInterface::FromString(pci, Cache, *I, helper);
326 return found;
327 }
328 /*}}}*/
329 // FromModifierCommandLine - helper doing the work for PKG:GroupedFromCommandLine /*{{{*/
330 bool PackageContainerInterface::FromModifierCommandLine(unsigned short &modID, PackageContainerInterface * const pci,
331 pkgCacheFile &Cache, const char * cmdline,
332 std::list<Modifier> const &mods, CacheSetHelper &helper) {
333 std::string str = cmdline;
334 unsigned short fallback = modID;
335 bool modifierPresent = false;
336 for (std::list<Modifier>::const_iterator mod = mods.begin();
337 mod != mods.end(); ++mod) {
338 size_t const alength = strlen(mod->Alias);
339 switch(mod->Pos) {
340 case Modifier::POSTFIX:
341 if (str.compare(str.length() - alength, alength,
342 mod->Alias, 0, alength) != 0)
343 continue;
344 str.erase(str.length() - alength);
345 modID = mod->ID;
346 break;
347 case Modifier::PREFIX:
348 continue;
349 case Modifier::NONE:
350 continue;
351 }
352 modifierPresent = true;
353 break;
354 }
355 if (modifierPresent == true) {
356 bool const errors = helper.showErrors(false);
357 pkgCache::PkgIterator Pkg = FromName(Cache, cmdline, helper);
358 helper.showErrors(errors);
359 if (Pkg.end() == false) {
360 pci->insert(Pkg);
361 modID = fallback;
362 return true;
363 }
364 }
365 return FromString(pci, Cache, str, helper);
366 }
367 /*}}}*/
368 // FromModifierCommandLine - helper doing the work for VER:GroupedFromCommandLine /*{{{*/
369 bool VersionContainerInterface::FromModifierCommandLine(unsigned short &modID,
370 VersionContainerInterface * const vci,
371 pkgCacheFile &Cache, const char * cmdline,
372 std::list<Modifier> const &mods,
373 CacheSetHelper &helper) {
374 Version select = NEWEST;
375 std::string str = cmdline;
376 bool modifierPresent = false;
377 unsigned short fallback = modID;
378 for (std::list<Modifier>::const_iterator mod = mods.begin();
379 mod != mods.end(); ++mod) {
380 if (modID == fallback && mod->ID == fallback)
381 select = mod->SelectVersion;
382 size_t const alength = strlen(mod->Alias);
383 switch(mod->Pos) {
384 case Modifier::POSTFIX:
385 if (str.compare(str.length() - alength, alength,
386 mod->Alias, 0, alength) != 0)
387 continue;
388 str.erase(str.length() - alength);
389 modID = mod->ID;
390 select = mod->SelectVersion;
391 break;
392 case Modifier::PREFIX:
393 continue;
394 case Modifier::NONE:
395 continue;
396 }
397 modifierPresent = true;
398 break;
399 }
400 if (modifierPresent == true) {
401 bool const errors = helper.showErrors(false);
402 bool const found = VersionContainerInterface::FromString(vci, Cache, cmdline, select, helper, true);
403 helper.showErrors(errors);
404 if (found == true) {
405 modID = fallback;
406 return true;
407 }
408 }
409 return FromString(vci, Cache, str, select, helper);
410 }
411 /*}}}*/
412 // FromCommandLine - Return all versions specified on commandline /*{{{*/
413 bool VersionContainerInterface::FromCommandLine(VersionContainerInterface * const vci,
414 pkgCacheFile &Cache, const char **cmdline,
415 Version const &fallback, CacheSetHelper &helper) {
416 bool found = false;
417 for (const char **I = cmdline; *I != 0; ++I)
418 found |= VersionContainerInterface::FromString(vci, Cache, *I, fallback, helper);
419 return found;
420 }
421 /*}}}*/
422 // FromString - Returns all versions spedcified by a string /*{{{*/
423 bool VersionContainerInterface::FromString(VersionContainerInterface * const vci,
424 pkgCacheFile &Cache, std::string pkg,
425 Version const &fallback, CacheSetHelper &helper,
426 bool const onlyFromName) {
427 std::string ver;
428 bool verIsRel = false;
429 size_t const vertag = pkg.find_last_of("/=");
430 if (vertag != std::string::npos) {
431 ver = pkg.substr(vertag+1);
432 verIsRel = (pkg[vertag] == '/');
433 pkg.erase(vertag);
434 }
435 PackageSet pkgset;
436 if (onlyFromName == false)
437 PackageContainerInterface::FromString(&pkgset, Cache, pkg, helper);
438 else {
439 pkgset.insert(PackageContainerInterface::FromName(Cache, pkg, helper));
440 }
441
442 bool errors = true;
443 if (pkgset.getConstructor() != PackageSet::UNKNOWN)
444 errors = helper.showErrors(false);
445
446 bool found = false;
447 for (PackageSet::const_iterator P = pkgset.begin();
448 P != pkgset.end(); ++P) {
449 if (vertag == std::string::npos) {
450 found |= VersionContainerInterface::FromPackage(vci, Cache, P, fallback, helper);
451 continue;
452 }
453 pkgCache::VerIterator V;
454 if (ver == "installed")
455 V = getInstalledVer(Cache, P, helper);
456 else if (ver == "candidate")
457 V = getCandidateVer(Cache, P, helper);
458 else if (ver == "newest") {
459 if (P->VersionList != 0)
460 V = P.VersionList();
461 else
462 V = helper.canNotFindNewestVer(Cache, P);
463 } else {
464 pkgVersionMatch Match(ver, (verIsRel == true ? pkgVersionMatch::Release :
465 pkgVersionMatch::Version));
466 V = Match.Find(P);
467 if (V.end() == true) {
468 if (verIsRel == true)
469 _error->Error(_("Release '%s' for '%s' was not found"),
470 ver.c_str(), P.FullName(true).c_str());
471 else
472 _error->Error(_("Version '%s' for '%s' was not found"),
473 ver.c_str(), P.FullName(true).c_str());
474 continue;
475 }
476 }
477 if (V.end() == true)
478 continue;
479 helper.showSelectedVersion(P, V, ver, verIsRel);
480 vci->insert(V);
481 found = true;
482 }
483 if (pkgset.getConstructor() != PackageSet::UNKNOWN)
484 helper.showErrors(errors);
485 return found;
486 }
487 /*}}}*/
488 // FromPackage - versions from package based on fallback /*{{{*/
489 bool VersionContainerInterface::FromPackage(VersionContainerInterface * const vci,
490 pkgCacheFile &Cache,
491 pkgCache::PkgIterator const &P,
492 Version const &fallback,
493 CacheSetHelper &helper) {
494 pkgCache::VerIterator V;
495 bool showErrors;
496 bool found = false;
497 switch(fallback) {
498 case ALL:
499 if (P->VersionList != 0)
500 for (V = P.VersionList(); V.end() != true; ++V)
501 found |= vci->insert(V);
502 else
503 helper.canNotFindAllVer(vci, Cache, P);
504 break;
505 case CANDANDINST:
506 found |= vci->insert(getInstalledVer(Cache, P, helper));
507 found |= vci->insert(getCandidateVer(Cache, P, helper));
508 break;
509 case CANDIDATE:
510 found |= vci->insert(getCandidateVer(Cache, P, helper));
511 break;
512 case INSTALLED:
513 found |= vci->insert(getInstalledVer(Cache, P, helper));
514 break;
515 case CANDINST:
516 showErrors = helper.showErrors(false);
517 V = getCandidateVer(Cache, P, helper);
518 if (V.end() == true)
519 V = getInstalledVer(Cache, P, helper);
520 helper.showErrors(showErrors);
521 if (V.end() == false)
522 found |= vci->insert(V);
523 else
524 helper.canNotFindInstCandVer(vci, Cache, P);
525 break;
526 case INSTCAND:
527 showErrors = helper.showErrors(false);
528 V = getInstalledVer(Cache, P, helper);
529 if (V.end() == true)
530 V = getCandidateVer(Cache, P, helper);
531 helper.showErrors(showErrors);
532 if (V.end() == false)
533 found |= vci->insert(V);
534 else
535 helper.canNotFindInstCandVer(vci, Cache, P);
536 break;
537 case NEWEST:
538 if (P->VersionList != 0)
539 found |= vci->insert(P.VersionList());
540 else
541 helper.canNotFindNewestVer(Cache, P);
542 break;
543 }
544 return found;
545 }
546 /*}}}*/
547 // getCandidateVer - Returns the candidate version of the given package /*{{{*/
548 pkgCache::VerIterator VersionContainerInterface::getCandidateVer(pkgCacheFile &Cache,
549 pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper) {
550 pkgCache::VerIterator Cand;
551 if (Cache.IsPolicyBuilt() == true || Cache.IsDepCacheBuilt() == false) {
552 if (unlikely(Cache.GetPolicy() == 0))
553 return pkgCache::VerIterator(Cache);
554 Cand = Cache.GetPolicy()->GetCandidateVer(Pkg);
555 } else {
556 Cand = Cache[Pkg].CandidateVerIter(Cache);
557 }
558 if (Cand.end() == true)
559 return helper.canNotFindCandidateVer(Cache, Pkg);
560 return Cand;
561 }
562 /*}}}*/
563 // getInstalledVer - Returns the installed version of the given package /*{{{*/
564 pkgCache::VerIterator VersionContainerInterface::getInstalledVer(pkgCacheFile &Cache,
565 pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper) {
566 if (Pkg->CurrentVer == 0)
567 return helper.canNotFindInstalledVer(Cache, Pkg);
568 return Pkg.CurrentVer();
569 }
570 /*}}}*/
571
572 // canNotFindPkgName - handle the case no package has this name /*{{{*/
573 pkgCache::PkgIterator CacheSetHelper::canNotFindPkgName(pkgCacheFile &Cache,
574 std::string const &str) {
575 if (ShowError == true)
576 _error->Insert(ErrorType, _("Unable to locate package %s"), str.c_str());
577 return pkgCache::PkgIterator(Cache, 0);
578 }
579 /*}}}*/
580 // canNotFindTask - handle the case no package is found for a task /*{{{*/
581 void CacheSetHelper::canNotFindTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern) {
582 if (ShowError == true)
583 _error->Insert(ErrorType, _("Couldn't find task '%s'"), pattern.c_str());
584 }
585 /*}}}*/
586 // canNotFindRegEx - handle the case no package is found by a regex /*{{{*/
587 void CacheSetHelper::canNotFindRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern) {
588 if (ShowError == true)
589 _error->Insert(ErrorType, _("Couldn't find any package by regex '%s'"), pattern.c_str());
590 }
591 /*}}}*/
592 // canNotFindPackage - handle the case no package is found from a string/*{{{*/
593 void CacheSetHelper::canNotFindPackage(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &str) {
594 }
595 /*}}}*/
596 // canNotFindAllVer /*{{{*/
597 void CacheSetHelper::canNotFindAllVer(VersionContainerInterface * const vci, pkgCacheFile &Cache,
598 pkgCache::PkgIterator const &Pkg) {
599 if (ShowError == true)
600 _error->Insert(ErrorType, _("Can't select versions from package '%s' as it is purely virtual"), Pkg.FullName(true).c_str());
601 }
602 /*}}}*/
603 // canNotFindInstCandVer /*{{{*/
604 void CacheSetHelper::canNotFindInstCandVer(VersionContainerInterface * const vci, pkgCacheFile &Cache,
605 pkgCache::PkgIterator const &Pkg) {
606 if (ShowError == true)
607 _error->Insert(ErrorType, _("Can't select installed nor candidate version from package '%s' as it has neither of them"), Pkg.FullName(true).c_str());
608 }
609 /*}}}*/
610 // canNotFindInstCandVer /*{{{*/
611 void CacheSetHelper::canNotFindCandInstVer(VersionContainerInterface * const vci, pkgCacheFile &Cache,
612 pkgCache::PkgIterator const &Pkg) {
613 if (ShowError == true)
614 _error->Insert(ErrorType, _("Can't select installed nor candidate version from package '%s' as it has neither of them"), Pkg.FullName(true).c_str());
615 }
616 /*}}}*/
617 // canNotFindNewestVer /*{{{*/
618 pkgCache::VerIterator CacheSetHelper::canNotFindNewestVer(pkgCacheFile &Cache,
619 pkgCache::PkgIterator const &Pkg) {
620 if (ShowError == true)
621 _error->Insert(ErrorType, _("Can't select newest version from package '%s' as it is purely virtual"), Pkg.FullName(true).c_str());
622 return pkgCache::VerIterator(Cache, 0);
623 }
624 /*}}}*/
625 // canNotFindCandidateVer /*{{{*/
626 pkgCache::VerIterator CacheSetHelper::canNotFindCandidateVer(pkgCacheFile &Cache,
627 pkgCache::PkgIterator const &Pkg) {
628 if (ShowError == true)
629 _error->Insert(ErrorType, _("Can't select candidate version from package %s as it has no candidate"), Pkg.FullName(true).c_str());
630 return pkgCache::VerIterator(Cache, 0);
631 }
632 /*}}}*/
633 // canNotFindInstalledVer /*{{{*/
634 pkgCache::VerIterator CacheSetHelper::canNotFindInstalledVer(pkgCacheFile &Cache,
635 pkgCache::PkgIterator const &Pkg) {
636 if (ShowError == true)
637 _error->Insert(ErrorType, _("Can't select installed version from package %s as it is not installed"), Pkg.FullName(true).c_str());
638 return pkgCache::VerIterator(Cache, 0);
639 }
640 /*}}}*/
641 // showTaskSelection /*{{{*/
642 void CacheSetHelper::showTaskSelection(pkgCache::PkgIterator const &pkg,
643 std::string const &pattern) {
644 }
645 /*}}}*/
646 // showRegExSelection /*{{{*/
647 void CacheSetHelper::showRegExSelection(pkgCache::PkgIterator const &pkg,
648 std::string const &pattern) {
649 }
650 /*}}}*/
651 // showSelectedVersion /*{{{*/
652 void CacheSetHelper::showSelectedVersion(pkgCache::PkgIterator const &Pkg,
653 pkgCache::VerIterator const Ver,
654 std::string const &ver,
655 bool const verIsRel) {
656 }
657 /*}}}*/
658 }