1 // -*- mode: cpp; mode: fold -*-
3 /* ######################################################################
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.
9 ##################################################################### */
11 // Include Files /*{{{*/
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>
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
);
49 if (pattern
[pattern
.length() -1] != '^')
51 pattern
.erase(pattern
.length()-1);
53 if (unlikely(Cache
.GetPkgCache() == 0 || Cache
.GetDepCache() == 0))
56 bool const wasEmpty
= pci
->empty();
58 pci
->setConstructor(TASK
);
61 pkgRecords
Recs(Cache
);
63 // build regexp for the task
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");
73 for (pkgCache::GrpIterator Grp
= Cache
->GrpBegin(); Grp
.end() == false; ++Grp
) {
74 pkgCache::PkgIterator Pkg
= Grp
.FindPkg(arch
);
75 if (Pkg
.end() == true)
77 pkgCache::VerIterator ver
= Cache
[Pkg
].CandidateVerIter(Cache
);
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))
88 strncpy(buf
, start
, length
);
90 if (regexec(&Pattern
, buf
, 0, 0, 0) != 0)
94 helper
.showTaskSelection(Pkg
, pattern
);
100 helper
.canNotFindTask(pci
, Cache
, pattern
);
101 pci
->setConstructor(UNKNOWN
);
105 if (wasEmpty
== false && pci
->getConstructor() != UNKNOWN
)
106 pci
->setConstructor(UNKNOWN
);
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
)
117 bool const wasEmpty
= pci
->empty();
118 if (wasEmpty
== true)
119 pci
->setConstructor(REGEX
);
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
);
131 if (unlikely(Cache
.GetPkgCache() == 0))
134 APT::CacheFilter::PackageNameMatchesRegEx
regexfilter(pattern
);
137 for (pkgCache::GrpIterator Grp
= Cache
.GetPkgCache()->GrpBegin(); Grp
.end() == false; ++Grp
) {
138 if (regexfilter(Grp
) == false)
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
);
148 if (Pkg
.end() == true)
153 helper
.showRegExSelection(Pkg
, pattern
);
157 if (found
== false) {
158 helper
.canNotFindRegEx(pci
, Cache
, pattern
);
159 pci
->setConstructor(UNKNOWN
);
163 if (wasEmpty
== false && pci
->getConstructor() != UNKNOWN
)
164 pci
->setConstructor(UNKNOWN
);
169 // FromFnmatch - Returns the package defined by this fnmatch /*{{{*/
171 PackageContainerInterface::FromFnmatch(PackageContainerInterface
* const pci
,
174 CacheSetHelper
&helper
)
176 static const char * const isfnmatch
= ".?*[]!";
177 if (pattern
.find_first_of(isfnmatch
) == std::string::npos
)
180 bool const wasEmpty
= pci
->empty();
181 if (wasEmpty
== true)
182 pci
->setConstructor(FNMATCH
);
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
);
194 if (unlikely(Cache
.GetPkgCache() == 0))
197 APT::CacheFilter::PackageNameMatchesFnmatch
filter(pattern
);
200 for (pkgCache::GrpIterator Grp
= Cache
.GetPkgCache()->GrpBegin(); Grp
.end() == false; ++Grp
) {
201 if (filter(Grp
) == false)
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
);
211 if (Pkg
.end() == true)
216 #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
217 helper
.showFnmatchSelection(Pkg
, pattern
);
219 helper
.showRegExSelection(Pkg
, pattern
);
224 if (found
== false) {
225 #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
226 helper
.canNotFindFnmatch(pci
, Cache
, pattern
);
228 helper
.canNotFindRegEx(pci
, Cache
, pattern
);
230 pci
->setConstructor(UNKNOWN
);
234 if (wasEmpty
== false && pci
->getConstructor() != UNKNOWN
)
235 pci
->setConstructor(UNKNOWN
);
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(':');
246 if (archfound
!= std::string::npos
) {
247 arch
= pkg
.substr(archfound
+1);
248 pkg
.erase(archfound
);
251 if (Cache
.GetPkgCache() == 0)
252 return pkgCache::PkgIterator(Cache
, 0);
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();
260 Pkg
= Cache
.GetPkgCache()->FindPkg(pkg
, arch
);
262 if (Pkg
.end() == true)
263 return helper
.canNotFindPkgName(Cache
, str
);
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))
273 size_t const archfound
= pkg
.find_last_of(':');
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");
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)
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)
301 if (isGlobal
== false)
309 pkgCache::PkgIterator Pkg
= helper
.canNotFindPkgName(Cache
, pkg
);
310 if (Pkg
.end() == true)
317 // FromString - Return all packages matching a specific string /*{{{*/
318 bool PackageContainerInterface::FromString(PackageContainerInterface
* const pci
, pkgCacheFile
&Cache
, std::string
const &str
, CacheSetHelper
&helper
) {
320 _error
->PushToStack();
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 &&
328 FromRegEx(pci
, Cache
, str
, helper
) == false)
330 helper
.canNotFindPackage(pci
, Cache
, str
);
335 _error
->RevertToStack();
337 _error
->MergeWithStack();
341 // FromCommandLine - Return all packages specified on commandline /*{{{*/
342 bool PackageContainerInterface::FromCommandLine(PackageContainerInterface
* const pci
, pkgCacheFile
&Cache
, const char **cmdline
, CacheSetHelper
&helper
) {
344 for (const char **I
= cmdline
; *I
!= 0; ++I
)
345 found
|= PackageContainerInterface::FromString(pci
, Cache
, *I
, helper
);
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
);
360 case Modifier::POSTFIX
:
361 if (str
.compare(str
.length() - alength
, alength
,
362 mod
->Alias
, 0, alength
) != 0)
364 str
.erase(str
.length() - alength
);
367 case Modifier::PREFIX
:
372 modifierPresent
= true;
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) {
385 return FromString(pci
, Cache
, str
, helper
);
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))
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
);
406 case Modifier::POSTFIX
:
407 if (str
.length() <= alength
||
408 str
.compare(str
.length() - alength
, alength
, mod
->Alias
, 0, alength
) != 0)
410 str
.erase(str
.length() - alength
);
412 select
= mod
->SelectVersion
;
414 case Modifier::PREFIX
:
419 modifierPresent
= true;
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
);
431 return FromString(vci
, Cache
, str
, select
, helper
);
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
) {
439 for (const char **I
= cmdline
; *I
!= 0; ++I
)
440 found
|= VersionContainerInterface::FromString(vci
, Cache
, *I
, fallback
, helper
);
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
) {
452 PackageContainerInterface::FromString(&pkgset
, Cache
, pkg
, helper
);
453 return VersionContainerInterface::FromPackage(vci
, Cache
, pkgset
.begin(), fallback
, helper
);
457 bool verIsRel
= false;
458 size_t const vertag
= pkg
.find_last_of("/=");
459 if (vertag
!= std::string::npos
) {
460 ver
= pkg
.substr(vertag
+1);
461 verIsRel
= (pkg
[vertag
] == '/');
464 if (onlyFromName
== false)
465 PackageContainerInterface::FromString(&pkgset
, Cache
, pkg
, helper
);
467 pkgset
.insert(PackageContainerInterface::FromName(Cache
, pkg
, helper
));
471 if (pkgset
.getConstructor() != PackageSet::UNKNOWN
)
472 errors
= helper
.showErrors(false);
475 for (PackageSet::const_iterator P
= pkgset
.begin();
476 P
!= pkgset
.end(); ++P
) {
477 if (vertag
== std::string::npos
) {
478 found
|= VersionContainerInterface::FromPackage(vci
, Cache
, P
, fallback
, helper
);
481 pkgCache::VerIterator V
;
482 if (ver
== "installed")
483 V
= getInstalledVer(Cache
, P
, helper
);
484 else if (ver
== "candidate")
485 V
= getCandidateVer(Cache
, P
, helper
);
486 else if (ver
== "newest") {
487 if (P
->VersionList
!= 0)
490 V
= helper
.canNotFindNewestVer(Cache
, P
);
492 pkgVersionMatch
Match(ver
, (verIsRel
== true ? pkgVersionMatch::Release
:
493 pkgVersionMatch::Version
));
495 if (V
.end() == true) {
496 if (verIsRel
== true)
497 _error
->Error(_("Release '%s' for '%s' was not found"),
498 ver
.c_str(), P
.FullName(true).c_str());
500 _error
->Error(_("Version '%s' for '%s' was not found"),
501 ver
.c_str(), P
.FullName(true).c_str());
507 helper
.showSelectedVersion(P
, V
, ver
, verIsRel
);
511 if (pkgset
.getConstructor() != PackageSet::UNKNOWN
)
512 helper
.showErrors(errors
);
516 // FromPackage - versions from package based on fallback /*{{{*/
517 bool VersionContainerInterface::FromPackage(VersionContainerInterface
* const vci
,
519 pkgCache::PkgIterator
const &P
,
520 Version
const &fallback
,
521 CacheSetHelper
&helper
) {
522 pkgCache::VerIterator V
;
527 if (P
->VersionList
!= 0)
528 for (V
= P
.VersionList(); V
.end() != true; ++V
)
529 found
|= vci
->insert(V
);
531 helper
.canNotFindAllVer(vci
, Cache
, P
);
534 found
|= vci
->insert(getInstalledVer(Cache
, P
, helper
));
535 found
|= vci
->insert(getCandidateVer(Cache
, P
, helper
));
538 found
|= vci
->insert(getCandidateVer(Cache
, P
, helper
));
541 found
|= vci
->insert(getInstalledVer(Cache
, P
, helper
));
544 showErrors
= helper
.showErrors(false);
545 V
= getCandidateVer(Cache
, P
, helper
);
547 V
= getInstalledVer(Cache
, P
, helper
);
548 helper
.showErrors(showErrors
);
549 if (V
.end() == false)
550 found
|= vci
->insert(V
);
552 helper
.canNotFindInstCandVer(vci
, Cache
, P
);
555 showErrors
= helper
.showErrors(false);
556 V
= getInstalledVer(Cache
, P
, helper
);
558 V
= getCandidateVer(Cache
, P
, helper
);
559 helper
.showErrors(showErrors
);
560 if (V
.end() == false)
561 found
|= vci
->insert(V
);
563 helper
.canNotFindInstCandVer(vci
, Cache
, P
);
566 if (P
->VersionList
!= 0)
567 found
|= vci
->insert(P
.VersionList());
569 helper
.canNotFindNewestVer(Cache
, P
);
575 // getCandidateVer - Returns the candidate version of the given package /*{{{*/
576 pkgCache::VerIterator
VersionContainerInterface::getCandidateVer(pkgCacheFile
&Cache
,
577 pkgCache::PkgIterator
const &Pkg
, CacheSetHelper
&helper
) {
578 pkgCache::VerIterator Cand
;
579 if (Cache
.IsPolicyBuilt() == true || Cache
.IsDepCacheBuilt() == false) {
580 if (unlikely(Cache
.GetPolicy() == 0))
581 return pkgCache::VerIterator(Cache
);
582 Cand
= Cache
.GetPolicy()->GetCandidateVer(Pkg
);
584 Cand
= Cache
[Pkg
].CandidateVerIter(Cache
);
586 if (Cand
.end() == true)
587 return helper
.canNotFindCandidateVer(Cache
, Pkg
);
591 // getInstalledVer - Returns the installed version of the given package /*{{{*/
592 pkgCache::VerIterator
VersionContainerInterface::getInstalledVer(pkgCacheFile
&Cache
,
593 pkgCache::PkgIterator
const &Pkg
, CacheSetHelper
&helper
) {
594 if (Pkg
->CurrentVer
== 0)
595 return helper
.canNotFindInstalledVer(Cache
, Pkg
);
596 return Pkg
.CurrentVer();
600 // canNotFindPkgName - handle the case no package has this name /*{{{*/
601 pkgCache::PkgIterator
CacheSetHelper::canNotFindPkgName(pkgCacheFile
&Cache
,
602 std::string
const &str
) {
603 if (ShowError
== true)
604 _error
->Insert(ErrorType
, _("Unable to locate package %s"), str
.c_str());
605 return pkgCache::PkgIterator(Cache
, 0);
608 // canNotFindTask - handle the case no package is found for a task /*{{{*/
609 void CacheSetHelper::canNotFindTask(PackageContainerInterface
* const /*pci*/, pkgCacheFile
&/*Cache*/, std::string pattern
) {
610 if (ShowError
== true)
611 _error
->Insert(ErrorType
, _("Couldn't find task '%s'"), pattern
.c_str());
614 // canNotFindRegEx - handle the case no package is found by a regex /*{{{*/
615 void CacheSetHelper::canNotFindRegEx(PackageContainerInterface
* const /*pci*/, pkgCacheFile
&/*Cache*/, std::string pattern
) {
616 if (ShowError
== true)
617 _error
->Insert(ErrorType
, _("Couldn't find any package by regex '%s'"), pattern
.c_str());
619 #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
620 // canNotFindFnmatch - handle the case no package is found by a fnmatch /*{{{*/
621 void CacheSetHelper::canNotFindFnmatch(PackageContainerInterface
* const /*pci*/, pkgCacheFile
&/*Cache*/, std::string pattern
) {
622 if (ShowError
== true)
623 _error
->Insert(ErrorType
, _("Couldn't find any package by glob '%s'"), pattern
.c_str());
626 // canNotFindPackage - handle the case no package is found from a string/*{{{*/
627 APT_CONST
void CacheSetHelper::canNotFindPackage(PackageContainerInterface
* const /*pci*/, pkgCacheFile
&/*Cache*/, std::string
const &/*str*/) {
630 // canNotFindAllVer /*{{{*/
631 void CacheSetHelper::canNotFindAllVer(VersionContainerInterface
* const /*vci*/, pkgCacheFile
&/*Cache*/,
632 pkgCache::PkgIterator
const &Pkg
) {
633 if (ShowError
== true)
634 _error
->Insert(ErrorType
, _("Can't select versions from package '%s' as it is purely virtual"), Pkg
.FullName(true).c_str());
637 // canNotFindInstCandVer /*{{{*/
638 void CacheSetHelper::canNotFindInstCandVer(VersionContainerInterface
* const /*vci*/, pkgCacheFile
&/*Cache*/,
639 pkgCache::PkgIterator
const &Pkg
) {
640 if (ShowError
== true)
641 _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 // canNotFindInstCandVer /*{{{*/
645 void CacheSetHelper::canNotFindCandInstVer(VersionContainerInterface
* const /*vci*/, pkgCacheFile
&/*Cache*/,
646 pkgCache::PkgIterator
const &Pkg
) {
647 if (ShowError
== true)
648 _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 // canNotFindNewestVer /*{{{*/
652 pkgCache::VerIterator
CacheSetHelper::canNotFindNewestVer(pkgCacheFile
&Cache
,
653 pkgCache::PkgIterator
const &Pkg
) {
654 if (ShowError
== true)
655 _error
->Insert(ErrorType
, _("Can't select newest version from package '%s' as it is purely virtual"), Pkg
.FullName(true).c_str());
656 return pkgCache::VerIterator(Cache
, 0);
659 // canNotFindCandidateVer /*{{{*/
660 pkgCache::VerIterator
CacheSetHelper::canNotFindCandidateVer(pkgCacheFile
&Cache
,
661 pkgCache::PkgIterator
const &Pkg
) {
662 if (ShowError
== true)
663 _error
->Insert(ErrorType
, _("Can't select candidate version from package %s as it has no candidate"), Pkg
.FullName(true).c_str());
664 return pkgCache::VerIterator(Cache
, 0);
667 // canNotFindInstalledVer /*{{{*/
668 pkgCache::VerIterator
CacheSetHelper::canNotFindInstalledVer(pkgCacheFile
&Cache
,
669 pkgCache::PkgIterator
const &Pkg
) {
670 if (ShowError
== true)
671 _error
->Insert(ErrorType
, _("Can't select installed version from package %s as it is not installed"), Pkg
.FullName(true).c_str());
672 return pkgCache::VerIterator(Cache
, 0);
675 // showTaskSelection /*{{{*/
676 APT_CONST
void CacheSetHelper::showTaskSelection(pkgCache::PkgIterator
const &/*pkg*/,
677 std::string
const &/*pattern*/) {
680 // showRegExSelection /*{{{*/
681 APT_CONST
void CacheSetHelper::showRegExSelection(pkgCache::PkgIterator
const &/*pkg*/,
682 std::string
const &/*pattern*/) {
685 #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
686 // showFnmatchSelection /*{{{*/
687 APT_CONST
void CacheSetHelper::showFnmatchSelection(pkgCache::PkgIterator
const &/*pkg*/,
688 std::string
const &/*pattern*/) {
692 // showSelectedVersion /*{{{*/
693 APT_CONST
void CacheSetHelper::showSelectedVersion(pkgCache::PkgIterator
const &/*Pkg*/,
694 pkgCache::VerIterator
const /*Ver*/,
695 std::string
const &/*ver*/,
696 bool const /*verIsRel*/) {