adapt to the new CacheSetHelper API
[apt.git] / apt-pkg / cacheset.cc
index 5d7f2851525f2e59c988b5de2f9211b78337e698..3c38895e972a67338bf2588f9094d9f4d602d4a3 100644 (file)
@@ -24,6 +24,7 @@
 #include <apt-pkg/depcache.h>
 #include <apt-pkg/macros.h>
 #include <apt-pkg/pkgcache.h>
+#include <apt-pkg/fileutl.h>
 
 #include <stddef.h>
 #include <stdio.h>
@@ -54,7 +55,7 @@ bool PackageContainerInterface::FromTask(PackageContainerInterface * const pci,
 
        bool const wasEmpty = pci->empty();
        if (wasEmpty == true)
-               pci->setConstructor(TASK);
+               pci->setConstructor(CacheSetHelper::TASK);
 
        // get the records
        pkgRecords Recs(Cache);
@@ -90,19 +91,19 @@ bool PackageContainerInterface::FromTask(PackageContainerInterface * const pci,
                        continue;
 
                pci->insert(Pkg);
-               helper.showTaskSelection(Pkg, pattern);
+               helper.showPackageSelection(Pkg, CacheSetHelper::TASK, pattern);
                found = true;
        }
        regfree(&Pattern);
 
        if (found == false) {
-               helper.canNotFindTask(pci, Cache, pattern);
-               pci->setConstructor(UNKNOWN);
+               helper.canNotFindPackage(CacheSetHelper::TASK, pci, Cache, pattern);
+               pci->setConstructor(CacheSetHelper::UNKNOWN);
                return false;
        }
 
-       if (wasEmpty == false && pci->getConstructor() != UNKNOWN)
-               pci->setConstructor(UNKNOWN);
+       if (wasEmpty == false && pci->getConstructor() != CacheSetHelper::UNKNOWN)
+               pci->setConstructor(CacheSetHelper::UNKNOWN);
 
        return true;
 }
@@ -115,7 +116,7 @@ bool PackageContainerInterface::FromRegEx(PackageContainerInterface * const pci,
 
        bool const wasEmpty = pci->empty();
        if (wasEmpty == true)
-               pci->setConstructor(REGEX);
+               pci->setConstructor(CacheSetHelper::REGEX);
 
        size_t archfound = pattern.find_last_of(':');
        std::string arch = "native";
@@ -149,18 +150,18 @@ bool PackageContainerInterface::FromRegEx(PackageContainerInterface * const pci,
                }
 
                pci->insert(Pkg);
-               helper.showRegExSelection(Pkg, pattern);
+               helper.showPackageSelection(Pkg, CacheSetHelper::REGEX, pattern);
                found = true;
        }
 
        if (found == false) {
-               helper.canNotFindRegEx(pci, Cache, pattern);
-               pci->setConstructor(UNKNOWN);
+               helper.canNotFindPackage(CacheSetHelper::REGEX, pci, Cache, pattern);
+               pci->setConstructor(CacheSetHelper::UNKNOWN);
                return false;
        }
 
-       if (wasEmpty == false && pci->getConstructor() != UNKNOWN)
-               pci->setConstructor(UNKNOWN);
+       if (wasEmpty == false && pci->getConstructor() != CacheSetHelper::UNKNOWN)
+               pci->setConstructor(CacheSetHelper::UNKNOWN);
 
        return true;
 }
@@ -178,7 +179,7 @@ PackageContainerInterface::FromFnmatch(PackageContainerInterface * const pci,
 
        bool const wasEmpty = pci->empty();
        if (wasEmpty == true)
-               pci->setConstructor(FNMATCH);
+               pci->setConstructor(CacheSetHelper::FNMATCH);
 
        size_t archfound = pattern.find_last_of(':');
        std::string arch = "native";
@@ -212,26 +213,18 @@ PackageContainerInterface::FromFnmatch(PackageContainerInterface * const pci,
                }
 
                pci->insert(Pkg);
-#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
-               helper.showFnmatchSelection(Pkg, pattern);
-#else
-               helper.showRegExSelection(Pkg, pattern);
-#endif
+               helper.showPackageSelection(Pkg, CacheSetHelper::FNMATCH, pattern);
                found = true;
        }
 
        if (found == false) {
-#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
-               helper.canNotFindFnmatch(pci, Cache, pattern);
-#else
-                helper.canNotFindRegEx(pci, Cache, pattern);
-#endif
-               pci->setConstructor(UNKNOWN);
+               helper.canNotFindPackage(CacheSetHelper::FNMATCH, pci, Cache, pattern);
+               pci->setConstructor(CacheSetHelper::UNKNOWN);
                return false;
        }
 
-       if (wasEmpty == false && pci->getConstructor() != UNKNOWN)
-               pci->setConstructor(UNKNOWN);
+       if (wasEmpty == false && pci->getConstructor() != CacheSetHelper::UNKNOWN)
+               pci->setConstructor(CacheSetHelper::UNKNOWN);
 
        return true;
 }
@@ -320,13 +313,11 @@ bool PackageContainerInterface::FromString(PackageContainerInterface * const pci
 
        if (FromGroup(pci, Cache, str, helper) == false &&
                 FromTask(pci, Cache, str, helper) == false &&
-#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
-                 // FIXME: hm, hm, regexp/fnmatch incompatible?
+                // FIXME: hm, hm, regexp/fnmatch incompatible?
                 FromFnmatch(pci, Cache, str, helper) == false &&
-#endif
                 FromRegEx(pci, Cache, str, helper) == false)
        {
-               helper.canNotFindPackage(pci, Cache, str);
+               helper.canNotFindPackage(CacheSetHelper::PACKAGENAME, pci, Cache, str);
                found = false;
        }
 
@@ -390,7 +381,7 @@ bool VersionContainerInterface::FromModifierCommandLine(unsigned short &modID,
                                                        pkgCacheFile &Cache, const char * cmdline,
                                                        std::list<Modifier> const &mods,
                                                        CacheSetHelper &helper) {
-       Version select = NEWEST;
+       CacheSetHelper::VerSelector select = CacheSetHelper::NEWEST;
        std::string str = cmdline;
        if (unlikely(str.empty() == true))
                return false;
@@ -433,7 +424,8 @@ bool VersionContainerInterface::FromModifierCommandLine(unsigned short &modID,
 // FromCommandLine - Return all versions specified on commandline      /*{{{*/
 bool VersionContainerInterface::FromCommandLine(VersionContainerInterface * const vci,
                                                pkgCacheFile &Cache, const char **cmdline,
-                                               Version const &fallback, CacheSetHelper &helper) {
+                                               CacheSetHelper::VerSelector const fallback,
+                                               CacheSetHelper &helper) {
        bool found = false;
        for (const char **I = cmdline; *I != 0; ++I)
                found |= VersionContainerInterface::FromString(vci, Cache, *I, fallback, helper);
@@ -443,8 +435,18 @@ bool VersionContainerInterface::FromCommandLine(VersionContainerInterface * cons
 // FromString - Returns all versions spedcified by a string            /*{{{*/
 bool VersionContainerInterface::FromString(VersionContainerInterface * const vci,
                                           pkgCacheFile &Cache, std::string pkg,
-                                          Version const &fallback, CacheSetHelper &helper,
+                                          CacheSetHelper::VerSelector const fallback,
+                                          CacheSetHelper &helper,
                                           bool const onlyFromName) {
+        PackageSet pkgset;
+        if(FileExists(pkg))
+        {
+                PackageContainerInterface::FromString(&pkgset, Cache, pkg, helper);
+                if(pkgset.size() == 0)
+                   return false;
+                return VersionContainerInterface::FromPackage(vci, Cache, pkgset.begin(), fallback, helper);
+        }
+
        std::string ver;
        bool verIsRel = false;
        size_t const vertag = pkg.find_last_of("/=");
@@ -453,7 +455,6 @@ bool VersionContainerInterface::FromString(VersionContainerInterface * const vci
                verIsRel = (pkg[vertag] == '/');
                pkg.erase(vertag);
        }
-       PackageSet pkgset;
        if (onlyFromName == false)
                PackageContainerInterface::FromString(&pkgset, Cache, pkg, helper);
        else {
@@ -461,7 +462,7 @@ bool VersionContainerInterface::FromString(VersionContainerInterface * const vci
        }
 
        bool errors = true;
-       if (pkgset.getConstructor() != PackageSet::UNKNOWN)
+       if (pkgset.getConstructor() != CacheSetHelper::UNKNOWN)
                errors = helper.showErrors(false);
 
        bool found = false;
@@ -480,7 +481,7 @@ bool VersionContainerInterface::FromString(VersionContainerInterface * const vci
                        if (P->VersionList != 0)
                                V = P.VersionList();
                        else
-                               V = helper.canNotFindNewestVer(Cache, P);
+                               V = helper.canNotGetVersion(CacheSetHelper::NEWEST, Cache, P);
                } else {
                        pkgVersionMatch Match(ver, (verIsRel == true ? pkgVersionMatch::Release :
                                        pkgVersionMatch::Version));
@@ -497,11 +498,14 @@ bool VersionContainerInterface::FromString(VersionContainerInterface * const vci
                }
                if (V.end() == true)
                        continue;
-               helper.showSelectedVersion(P, V, ver, verIsRel);
+               if (verIsRel == true)
+                       helper.showVersionSelection(P, V, CacheSetHelper::RELEASE, ver);
+               else
+                       helper.showVersionSelection(P, V, CacheSetHelper::VERSIONNUMBER, ver);
                vci->insert(V);
                found = true;
        }
-       if (pkgset.getConstructor() != PackageSet::UNKNOWN)
+       if (pkgset.getConstructor() != CacheSetHelper::UNKNOWN)
                helper.showErrors(errors);
        return found;
 }
@@ -510,30 +514,30 @@ bool VersionContainerInterface::FromString(VersionContainerInterface * const vci
 bool VersionContainerInterface::FromPackage(VersionContainerInterface * const vci,
                                            pkgCacheFile &Cache,
                                            pkgCache::PkgIterator const &P,
-                                           Version const &fallback,
+                                           CacheSetHelper::VerSelector const fallback,
                                            CacheSetHelper &helper) {
        pkgCache::VerIterator V;
        bool showErrors;
        bool found = false;
        switch(fallback) {
-       case ALL:
+       case CacheSetHelper::ALL:
                if (P->VersionList != 0)
                        for (V = P.VersionList(); V.end() != true; ++V)
                                found |= vci->insert(V);
                else
-                       helper.canNotFindAllVer(vci, Cache, P);
+                       helper.canNotFindVersion(CacheSetHelper::ALL, vci, Cache, P);
                break;
-       case CANDANDINST:
+       case CacheSetHelper::CANDANDINST:
                found |= vci->insert(getInstalledVer(Cache, P, helper));
                found |= vci->insert(getCandidateVer(Cache, P, helper));
                break;
-       case CANDIDATE:
+       case CacheSetHelper::CANDIDATE:
                found |= vci->insert(getCandidateVer(Cache, P, helper));
                break;
-       case INSTALLED:
+       case CacheSetHelper::INSTALLED:
                found |= vci->insert(getInstalledVer(Cache, P, helper));
                break;
-       case CANDINST:
+       case CacheSetHelper::CANDINST:
                showErrors = helper.showErrors(false);
                V = getCandidateVer(Cache, P, helper);
                if (V.end() == true)
@@ -542,9 +546,9 @@ bool VersionContainerInterface::FromPackage(VersionContainerInterface * const vc
                if (V.end() == false)
                        found |= vci->insert(V);
                else
-                       helper.canNotFindInstCandVer(vci, Cache, P);
+                       helper.canNotFindVersion(CacheSetHelper::CANDINST, vci, Cache, P);
                break;
-       case INSTCAND:
+       case CacheSetHelper::INSTCAND:
                showErrors = helper.showErrors(false);
                V = getInstalledVer(Cache, P, helper);
                if (V.end() == true)
@@ -553,14 +557,18 @@ bool VersionContainerInterface::FromPackage(VersionContainerInterface * const vc
                if (V.end() == false)
                        found |= vci->insert(V);
                else
-                       helper.canNotFindInstCandVer(vci, Cache, P);
+                       helper.canNotFindVersion(CacheSetHelper::INSTCAND, vci, Cache, P);
                break;
-       case NEWEST:
+       case CacheSetHelper::NEWEST:
                if (P->VersionList != 0)
                        found |= vci->insert(P.VersionList());
                else
-                       helper.canNotFindNewestVer(Cache, P);
+                       helper.canNotFindVersion(CacheSetHelper::NEWEST, vci, Cache, P);
                break;
+       case CacheSetHelper::RELEASE:
+       case CacheSetHelper::VERSIONNUMBER:
+               // both make no sense here, so always false
+               return false;
        }
        return found;
 }
@@ -577,7 +585,7 @@ pkgCache::VerIterator VersionContainerInterface::getCandidateVer(pkgCacheFile &C
                Cand = Cache[Pkg].CandidateVerIter(Cache);
        }
        if (Cand.end() == true)
-               return helper.canNotFindCandidateVer(Cache, Pkg);
+               return helper.canNotGetVersion(CacheSetHelper::CANDIDATE, Cache, Pkg);
        return Cand;
 }
                                                                        /*}}}*/
@@ -585,19 +593,30 @@ pkgCache::VerIterator VersionContainerInterface::getCandidateVer(pkgCacheFile &C
 pkgCache::VerIterator VersionContainerInterface::getInstalledVer(pkgCacheFile &Cache,
                pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper) {
        if (Pkg->CurrentVer == 0)
-               return helper.canNotFindInstalledVer(Cache, Pkg);
+               return helper.canNotGetVersion(CacheSetHelper::INSTALLED, Cache, Pkg);
        return Pkg.CurrentVer();
 }
                                                                        /*}}}*/
 
-// canNotFindPkgName - handle the case no package has this name                /*{{{*/
-pkgCache::PkgIterator CacheSetHelper::canNotFindPkgName(pkgCacheFile &Cache,
-                       std::string const &str) {
-       if (ShowError == true)
-               _error->Insert(ErrorType, _("Unable to locate package %s"), str.c_str());
-       return pkgCache::PkgIterator(Cache, 0);
+// canNotFindPackage - with the given selector and pattern             /*{{{*/
+void CacheSetHelper::canNotFindPackage(enum PkgSelector const select,
+      PackageContainerInterface * const pci, pkgCacheFile &Cache,
+      std::string const &pattern) {
+       switch (select) {
+#if __GNUC__ >= 4
+       #pragma GCC diagnostic push
+       #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+       case REGEX: canNotFindRegEx(pci, Cache, pattern); break;
+       case TASK: canNotFindTask(pci, Cache, pattern); break;
+       case FNMATCH: canNotFindFnmatch(pci, Cache, pattern); break;
+       case PACKAGENAME: canNotFindPackage(pci, Cache, pattern); break;
+       case UNKNOWN: break;
+#if __GNUC__ >= 4
+       #pragma GCC diagnostic pop
+#endif
+       }
 }
-                                                                       /*}}}*/
 // canNotFindTask - handle the case no package is found for a task     /*{{{*/
 void CacheSetHelper::canNotFindTask(PackageContainerInterface * const /*pci*/, pkgCacheFile &/*Cache*/, std::string pattern) {
        if (ShowError == true)
@@ -609,17 +628,50 @@ void CacheSetHelper::canNotFindRegEx(PackageContainerInterface * const /*pci*/,
        if (ShowError == true)
                _error->Insert(ErrorType, _("Couldn't find any package by regex '%s'"), pattern.c_str());
 }
-#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
+                                                                       /*}}}*/
 // canNotFindFnmatch - handle the case no package is found by a fnmatch        /*{{{*/
    void CacheSetHelper::canNotFindFnmatch(PackageContainerInterface * const /*pci*/, pkgCacheFile &/*Cache*/, std::string pattern) {
        if (ShowError == true)
                _error->Insert(ErrorType, _("Couldn't find any package by glob '%s'"), pattern.c_str());
 }
-#endif                                                                 /*}}}*/
+                                                                       /*}}}*/
 // canNotFindPackage - handle the case no package is found from a string/*{{{*/
 APT_CONST void CacheSetHelper::canNotFindPackage(PackageContainerInterface * const /*pci*/, pkgCacheFile &/*Cache*/, std::string const &/*str*/) {
 }
                                                                        /*}}}*/
+                                                                       /*}}}*/
+// canNotFindPkgName - handle the case no package has this name                /*{{{*/
+pkgCache::PkgIterator CacheSetHelper::canNotFindPkgName(pkgCacheFile &Cache,
+                       std::string const &str) {
+       if (ShowError == true)
+               _error->Insert(ErrorType, _("Unable to locate package %s"), str.c_str());
+       return pkgCache::PkgIterator(Cache, 0);
+}
+                                                                       /*}}}*/
+// canNotFindVersion - for package by selector                         /*{{{*/
+void CacheSetHelper::canNotFindVersion(enum VerSelector const select, VersionContainerInterface * const vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg)
+{
+       switch (select) {
+#if __GNUC__ >= 4
+       #pragma GCC diagnostic push
+       #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+       case ALL: canNotFindAllVer(vci, Cache, Pkg); break;
+       case INSTCAND: canNotFindInstCandVer(vci, Cache, Pkg); break;
+       case CANDINST: canNotFindCandInstVer(vci, Cache, Pkg); break;
+       case NEWEST: canNotFindNewestVer(Cache, Pkg); break;
+       case CANDIDATE: canNotFindCandidateVer(Cache, Pkg); break;
+       case INSTALLED: canNotFindInstalledVer(Cache, Pkg); break;
+#if __GNUC__ >= 4
+       #pragma GCC diagnostic pop
+#endif
+       case CANDANDINST: canNotGetCandInstVer(Cache, Pkg); break;
+       case RELEASE:
+       case VERSIONNUMBER:
+               // invalid in this branch
+               break;
+       }
+}
 // canNotFindAllVer                                                    /*{{{*/
 void CacheSetHelper::canNotFindAllVer(VersionContainerInterface * const /*vci*/, pkgCacheFile &/*Cache*/,
                pkgCache::PkgIterator const &Pkg) {
@@ -628,19 +680,42 @@ void CacheSetHelper::canNotFindAllVer(VersionContainerInterface * const /*vci*/,
 }
                                                                        /*}}}*/
 // canNotFindInstCandVer                                               /*{{{*/
-void CacheSetHelper::canNotFindInstCandVer(VersionContainerInterface * const /*vci*/, pkgCacheFile &/*Cache*/,
+void CacheSetHelper::canNotFindInstCandVer(VersionContainerInterface * const /*vci*/, pkgCacheFile &Cache,
                pkgCache::PkgIterator const &Pkg) {
-       if (ShowError == true)
-               _error->Insert(ErrorType, _("Can't select installed nor candidate version from package '%s' as it has neither of them"), Pkg.FullName(true).c_str());
+       canNotGetInstCandVer(Cache, Pkg);
 }
                                                                        /*}}}*/
 // canNotFindInstCandVer                                               /*{{{*/
-void CacheSetHelper::canNotFindCandInstVer(VersionContainerInterface * const /*vci*/, pkgCacheFile &/*Cache*/,
+void CacheSetHelper::canNotFindCandInstVer(VersionContainerInterface * const /*vci*/, pkgCacheFile &Cache,
                pkgCache::PkgIterator const &Pkg) {
-       if (ShowError == true)
-               _error->Insert(ErrorType, _("Can't select installed nor candidate version from package '%s' as it has neither of them"), Pkg.FullName(true).c_str());
+       canNotGetCandInstVer(Cache, Pkg);
 }
                                                                        /*}}}*/
+                                                                       /*}}}*/
+// canNotGetVersion - for package by selector                          /*{{{*/
+pkgCache::VerIterator CacheSetHelper::canNotGetVersion(enum VerSelector const select, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) {
+       switch (select) {
+#if __GNUC__ >= 4
+       #pragma GCC diagnostic push
+       #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+       case NEWEST: return canNotFindNewestVer(Cache, Pkg);
+       case CANDIDATE: return canNotFindCandidateVer(Cache, Pkg);
+       case INSTALLED: return canNotFindInstalledVer(Cache, Pkg);
+#if __GNUC__ >= 4
+       #pragma GCC diagnostic pop
+#endif
+       case CANDINST: return canNotGetCandInstVer(Cache, Pkg);
+       case INSTCAND: return canNotGetInstCandVer(Cache, Pkg);
+       case ALL:
+       case CANDANDINST:
+       case RELEASE:
+       case VERSIONNUMBER:
+               // invalid in this branch
+               return pkgCache::VerIterator(Cache, 0);
+       }
+       return pkgCache::VerIterator(Cache, 0);
+}
 // canNotFindNewestVer                                                 /*{{{*/
 pkgCache::VerIterator CacheSetHelper::canNotFindNewestVer(pkgCacheFile &Cache,
                pkgCache::PkgIterator const &Pkg) {
@@ -665,6 +740,41 @@ pkgCache::VerIterator CacheSetHelper::canNotFindInstalledVer(pkgCacheFile &Cache
        return pkgCache::VerIterator(Cache, 0);
 }
                                                                        /*}}}*/
+// canNotFindInstCandVer                                               /*{{{*/
+pkgCache::VerIterator CacheSetHelper::canNotGetInstCandVer(pkgCacheFile &Cache,
+               pkgCache::PkgIterator const &Pkg) {
+       if (ShowError == true)
+               _error->Insert(ErrorType, _("Can't select installed nor candidate version from package '%s' as it has neither of them"), Pkg.FullName(true).c_str());
+       return pkgCache::VerIterator(Cache, 0);
+}
+                                                                       /*}}}*/
+// canNotFindInstCandVer                                               /*{{{*/
+pkgCache::VerIterator CacheSetHelper::canNotGetCandInstVer(pkgCacheFile &Cache,
+               pkgCache::PkgIterator const &Pkg) {
+       if (ShowError == true)
+               _error->Insert(ErrorType, _("Can't select installed nor candidate version from package '%s' as it has neither of them"), Pkg.FullName(true).c_str());
+       return pkgCache::VerIterator(Cache, 0);
+}
+                                                                       /*}}}*/
+                                                                       /*}}}*/
+// showPackageSelection - by selector and given pattern                        /*{{{*/
+APT_CONST void CacheSetHelper::showPackageSelection(pkgCache::PkgIterator const &pkg, enum PkgSelector const select,
+                                      std::string const &pattern) {
+       switch (select) {
+#if __GNUC__ >= 4
+       #pragma GCC diagnostic push
+       #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+       case REGEX: showRegExSelection(pkg, pattern); break;
+       case TASK: showTaskSelection(pkg, pattern); break;
+       case FNMATCH: showFnmatchSelection(pkg, pattern); break;
+#if __GNUC__ >= 4
+       #pragma GCC diagnostic pop
+#endif
+       case PACKAGENAME: /* no suprises here */ break;
+       case UNKNOWN: break;
+       }
+}
 // showTaskSelection                                                   /*{{{*/
 APT_CONST void CacheSetHelper::showTaskSelection(pkgCache::PkgIterator const &/*pkg*/,
                                       std::string const &/*pattern*/) {
@@ -675,14 +785,41 @@ APT_CONST void CacheSetHelper::showRegExSelection(pkgCache::PkgIterator const &/
                                        std::string const &/*pattern*/) {
 }
                                                                        /*}}}*/
-#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
 // showFnmatchSelection                                                        /*{{{*/
 APT_CONST void CacheSetHelper::showFnmatchSelection(pkgCache::PkgIterator const &/*pkg*/,
                                          std::string const &/*pattern*/) {
 }
                                                                        /*}}}*/
+                                                                       /*}}}*/
+// showVersionSelection                                                        /*{{{*/
+APT_CONST void CacheSetHelper::showVersionSelection(pkgCache::PkgIterator const &Pkg,
+      pkgCache::VerIterator const &Ver, enum VerSelector const select, std::string const &pattern) {
+       switch (select) {
+#if __GNUC__ >= 4
+       #pragma GCC diagnostic push
+       #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+       case RELEASE:
+               showSelectedVersion(Pkg, Ver, pattern, true);
+               break;
+       case VERSIONNUMBER:
+               showSelectedVersion(Pkg, Ver, pattern, false);
+               break;
+#if __GNUC__ >= 4
+       #pragma GCC diagnostic pop
+       #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 #endif
-// showSelectedVersion                                                 /*{{{*/
+       case NEWEST:
+       case CANDIDATE:
+       case INSTALLED:
+       case CANDINST:
+       case INSTCAND:
+       case ALL:
+       case CANDANDINST:
+               // not really suprises, but in fact: just not implemented
+               break;
+       }
+}
 APT_CONST void CacheSetHelper::showSelectedVersion(pkgCache::PkgIterator const &/*Pkg*/,
                                         pkgCache::VerIterator const /*Ver*/,
                                         std::string const &/*ver*/,