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