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