]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/cacheset.cc
report warnings&errors consistently in edit-sources
[apt.git] / apt-pkg / cacheset.cc
index 0147f7e8662845656c48d90ddd110c8cc0b36ae6..816925c4dbc00bbbbe5b13d21fa6b969919cba00 100644 (file)
 #include <apt-pkg/cachefilter.h>
 #include <apt-pkg/cacheset.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/cachefilter.h>
 #include <apt-pkg/cacheset.h>
 #include <apt-pkg/error.h>
-#include <apt-pkg/strutl.h>
 #include <apt-pkg/versionmatch.h>
 #include <apt-pkg/pkgrecords.h>
 #include <apt-pkg/policy.h>
 #include <apt-pkg/versionmatch.h>
 #include <apt-pkg/pkgrecords.h>
 #include <apt-pkg/policy.h>
-
-#include <vector>
-
+#include <apt-pkg/cacheiterators.h>
+#include <apt-pkg/configuration.h>
+#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>
+#include <string.h>
 #include <regex.h>
 #include <regex.h>
+#include <list>
+#include <string>
+#include <vector>
 
 #include <apti18n.h>
                                                                        /*}}}*/
 namespace APT {
 
 #include <apti18n.h>
                                                                        /*}}}*/
 namespace APT {
-// FromTask - Return all packages in the cache from a specific task    /*{{{*/
-bool PackageContainerInterface::FromTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
+// PackageFrom - selecting the appropriate method for package selection        /*{{{*/
+bool CacheSetHelper::PackageFrom(enum PkgSelector const select, PackageContainerInterface * const pci,
+      pkgCacheFile &Cache, std::string const &pattern) {
+       switch (select) {
+       case UNKNOWN: return false;
+       case REGEX: return PackageFromRegEx(pci, Cache, pattern);
+       case TASK: return PackageFromTask(pci, Cache, pattern);
+       case FNMATCH: return PackageFromFnmatch(pci, Cache, pattern);
+       case PACKAGENAME: return PackageFromPackageName(pci, Cache, pattern);
+       case STRING: return PackageFromString(pci, Cache, pattern);
+       }
+       return false;
+}
+                                                                       /*}}}*/
+// PackageFromTask - Return all packages in the cache from a specific task /*{{{*/
+bool CacheSetHelper::PackageFromTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern) {
        size_t const archfound = pattern.find_last_of(':');
        std::string arch = "native";
        if (archfound != std::string::npos) {
        size_t const archfound = pattern.find_last_of(':');
        std::string arch = "native";
        if (archfound != std::string::npos) {
@@ -46,7 +69,7 @@ bool PackageContainerInterface::FromTask(PackageContainerInterface * const pci,
 
        bool const wasEmpty = pci->empty();
        if (wasEmpty == true)
 
        bool const wasEmpty = pci->empty();
        if (wasEmpty == true)
-               pci->setConstructor(TASK);
+               pci->setConstructor(CacheSetHelper::TASK);
 
        // get the records
        pkgRecords Recs(Cache);
 
        // get the records
        pkgRecords Recs(Cache);
@@ -73,6 +96,8 @@ bool PackageContainerInterface::FromTask(PackageContainerInterface * const pci,
                const char *start, *end;
                parser.GetRec(start,end);
                unsigned int const length = end - start;
                const char *start, *end;
                parser.GetRec(start,end);
                unsigned int const length = end - start;
+               if (unlikely(length == 0))
+                  continue;
                char buf[length];
                strncpy(buf, start, length);
                buf[length-1] = '\0';
                char buf[length];
                strncpy(buf, start, length);
                buf[length-1] = '\0';
@@ -80,32 +105,32 @@ bool PackageContainerInterface::FromTask(PackageContainerInterface * const pci,
                        continue;
 
                pci->insert(Pkg);
                        continue;
 
                pci->insert(Pkg);
-               helper.showTaskSelection(Pkg, pattern);
+               showPackageSelection(Pkg, CacheSetHelper::TASK, pattern);
                found = true;
        }
        regfree(&Pattern);
 
        if (found == false) {
                found = true;
        }
        regfree(&Pattern);
 
        if (found == false) {
-               helper.canNotFindTask(pci, Cache, pattern);
-               pci->setConstructor(UNKNOWN);
+               canNotFindPackage(CacheSetHelper::TASK, pci, Cache, pattern);
+               pci->setConstructor(CacheSetHelper::UNKNOWN);
                return false;
        }
 
                return false;
        }
 
-       if (wasEmpty == false && pci->getConstructor() != UNKNOWN)
-               pci->setConstructor(UNKNOWN);
+       if (wasEmpty == false && pci->getConstructor() != CacheSetHelper::UNKNOWN)
+               pci->setConstructor(CacheSetHelper::UNKNOWN);
 
        return true;
 }
                                                                        /*}}}*/
 
        return true;
 }
                                                                        /*}}}*/
-// FromRegEx - Return all packages in the cache matching a pattern     /*{{{*/
-bool PackageContainerInterface::FromRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
+// PackageFromRegEx - Return all packages in the cache matching a pattern /*{{{*/
+bool CacheSetHelper::PackageFromRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern) {
        static const char * const isregex = ".?+*|[^$";
        if (pattern.find_first_of(isregex) == std::string::npos)
                return false;
 
        bool const wasEmpty = pci->empty();
        if (wasEmpty == true)
        static const char * const isregex = ".?+*|[^$";
        if (pattern.find_first_of(isregex) == std::string::npos)
                return false;
 
        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";
 
        size_t archfound = pattern.find_last_of(':');
        std::string arch = "native";
@@ -128,39 +153,32 @@ bool PackageContainerInterface::FromRegEx(PackageContainerInterface * const pci,
                        continue;
                pkgCache::PkgIterator Pkg = Grp.FindPkg(arch);
                if (Pkg.end() == true) {
                        continue;
                pkgCache::PkgIterator Pkg = Grp.FindPkg(arch);
                if (Pkg.end() == true) {
-                       if (archfound == std::string::npos) {
-                               std::vector<std::string> archs = APT::Configuration::getArchitectures();
-                               for (std::vector<std::string>::const_iterator a = archs.begin();
-                                    a != archs.end() && Pkg.end() != true; ++a)
-                                       Pkg = Grp.FindPkg(*a);
-                       }
+                       if (archfound == std::string::npos)
+                               Pkg = Grp.FindPreferredPkg(true);
                        if (Pkg.end() == true)
                                continue;
                }
 
                pci->insert(Pkg);
                        if (Pkg.end() == true)
                                continue;
                }
 
                pci->insert(Pkg);
-               helper.showRegExSelection(Pkg, pattern);
+               showPackageSelection(Pkg, CacheSetHelper::REGEX, pattern);
                found = true;
        }
 
        if (found == false) {
                found = true;
        }
 
        if (found == false) {
-               helper.canNotFindRegEx(pci, Cache, pattern);
-               pci->setConstructor(UNKNOWN);
+               canNotFindPackage(CacheSetHelper::REGEX, pci, Cache, pattern);
+               pci->setConstructor(CacheSetHelper::UNKNOWN);
                return false;
        }
 
                return false;
        }
 
-       if (wasEmpty == false && pci->getConstructor() != UNKNOWN)
-               pci->setConstructor(UNKNOWN);
+       if (wasEmpty == false && pci->getConstructor() != CacheSetHelper::UNKNOWN)
+               pci->setConstructor(CacheSetHelper::UNKNOWN);
 
        return true;
 }
                                                                        /*}}}*/
 
        return true;
 }
                                                                        /*}}}*/
-// FromFnmatch - Returns the package defined  by this fnmatch          /*{{{*/
-bool 
-PackageContainerInterface::FromFnmatch(PackageContainerInterface * const pci, 
-                                       pkgCacheFile &Cache,
-                                       std::string pattern,
-                                       CacheSetHelper &helper)
+// PackageFromFnmatch - Returns the package defined  by this fnmatch   /*{{{*/
+bool CacheSetHelper::PackageFromFnmatch(PackageContainerInterface * const pci,
+                                       pkgCacheFile &Cache, std::string pattern)
 {
        static const char * const isfnmatch = ".?*[]!";
        if (pattern.find_first_of(isfnmatch) == std::string::npos)
 {
        static const char * const isfnmatch = ".?*[]!";
        if (pattern.find_first_of(isfnmatch) == std::string::npos)
@@ -168,7 +186,7 @@ PackageContainerInterface::FromFnmatch(PackageContainerInterface * const pci,
 
        bool const wasEmpty = pci->empty();
        if (wasEmpty == true)
 
        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";
 
        size_t archfound = pattern.find_last_of(':');
        std::string arch = "native";
@@ -191,36 +209,32 @@ PackageContainerInterface::FromFnmatch(PackageContainerInterface * const pci,
                        continue;
                pkgCache::PkgIterator Pkg = Grp.FindPkg(arch);
                if (Pkg.end() == true) {
                        continue;
                pkgCache::PkgIterator Pkg = Grp.FindPkg(arch);
                if (Pkg.end() == true) {
-                       if (archfound == std::string::npos) {
-                               std::vector<std::string> archs = APT::Configuration::getArchitectures();
-                               for (std::vector<std::string>::const_iterator a = archs.begin();
-                                    a != archs.end() && Pkg.end() != true; ++a)
-                                       Pkg = Grp.FindPkg(*a);
-                       }
+                       if (archfound == std::string::npos)
+                               Pkg = Grp.FindPreferredPkg(true);
                        if (Pkg.end() == true)
                                continue;
                }
 
                pci->insert(Pkg);
                        if (Pkg.end() == true)
                                continue;
                }
 
                pci->insert(Pkg);
-               helper.showRegExSelection(Pkg, pattern);
+               showPackageSelection(Pkg, CacheSetHelper::FNMATCH, pattern);
                found = true;
        }
 
        if (found == false) {
                found = true;
        }
 
        if (found == false) {
-               helper.canNotFindRegEx(pci, Cache, pattern);
-               pci->setConstructor(UNKNOWN);
+               canNotFindPackage(CacheSetHelper::FNMATCH, pci, Cache, pattern);
+               pci->setConstructor(CacheSetHelper::UNKNOWN);
                return false;
        }
 
                return false;
        }
 
-       if (wasEmpty == false && pci->getConstructor() != UNKNOWN)
-               pci->setConstructor(UNKNOWN);
+       if (wasEmpty == false && pci->getConstructor() != CacheSetHelper::UNKNOWN)
+               pci->setConstructor(CacheSetHelper::UNKNOWN);
 
        return true;
 }
                                                                        /*}}}*/
 
        return true;
 }
                                                                        /*}}}*/
-// FromName - Returns the package defined  by this string              /*{{{*/
-pkgCache::PkgIterator PackageContainerInterface::FromName(pkgCacheFile &Cache,
-                       std::string const &str, CacheSetHelper &helper) {
+// PackageFromName - Returns the package defined  by this string       /*{{{*/
+pkgCache::PkgIterator CacheSetHelper::PackageFromName(pkgCacheFile &Cache,
+                       std::string const &str) {
        std::string pkg = str;
        size_t archfound = pkg.find_last_of(':');
        std::string arch;
        std::string pkg = str;
        size_t archfound = pkg.find_last_of(':');
        std::string arch;
@@ -241,16 +255,17 @@ pkgCache::PkgIterator PackageContainerInterface::FromName(pkgCacheFile &Cache,
                Pkg = Cache.GetPkgCache()->FindPkg(pkg, arch);
 
        if (Pkg.end() == true)
                Pkg = Cache.GetPkgCache()->FindPkg(pkg, arch);
 
        if (Pkg.end() == true)
-               return helper.canNotFindPkgName(Cache, str);
+               return canNotFindPkgName(Cache, str);
        return Pkg;
 }
                                                                        /*}}}*/
        return Pkg;
 }
                                                                        /*}}}*/
-// FromGroup - Returns the package defined  by this string             /*{{{*/
-bool PackageContainerInterface::FromGroup(PackageContainerInterface * const pci, pkgCacheFile &Cache,
-                       std::string pkg, CacheSetHelper &helper) {
+// PackageFromPackageName - Returns the package defined  by this string /*{{{*/
+bool CacheSetHelper::PackageFromPackageName(PackageContainerInterface * const pci, pkgCacheFile &Cache,
+                       std::string pkg) {
        if (unlikely(Cache.GetPkgCache() == 0))
                return false;
 
        if (unlikely(Cache.GetPkgCache() == 0))
                return false;
 
+       std::string const pkgstring = pkg;
        size_t const archfound = pkg.find_last_of(':');
        std::string arch;
        if (archfound != std::string::npos) {
        size_t const archfound = pkg.find_last_of(':');
        std::string arch;
        if (archfound != std::string::npos) {
@@ -287,7 +302,7 @@ bool PackageContainerInterface::FromGroup(PackageContainerInterface * const pci,
                }
        }
 
                }
        }
 
-       pkgCache::PkgIterator Pkg = helper.canNotFindPkgName(Cache, pkg);
+       pkgCache::PkgIterator Pkg = canNotFindPkgName(Cache, pkgstring);
        if (Pkg.end() == true)
           return false;
 
        if (Pkg.end() == true)
           return false;
 
@@ -295,17 +310,18 @@ bool PackageContainerInterface::FromGroup(PackageContainerInterface * const pci,
        return true;
 }
                                                                        /*}}}*/
        return true;
 }
                                                                        /*}}}*/
-// FromString - Return all packages matching a specific string         /*{{{*/
-bool PackageContainerInterface::FromString(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &str, CacheSetHelper &helper) {
+// PackageFromString - Return all packages matching a specific string  /*{{{*/
+bool CacheSetHelper::PackageFromString(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &str) {
        bool found = true;
        _error->PushToStack();
 
        bool found = true;
        _error->PushToStack();
 
-       if (FromGroup(pci, Cache, str, helper) == false &&
-                FromTask(pci, Cache, str, helper) == false &&
-                FromFnmatch(pci, Cache, str, helper) == false &&
-                FromRegEx(pci, Cache, str, helper) == false)
+       if (PackageFrom(CacheSetHelper::PACKAGENAME, pci, Cache, str) == false &&
+                PackageFrom(CacheSetHelper::TASK, pci, Cache, str) == false &&
+                // FIXME: hm, hm, regexp/fnmatch incompatible?
+                PackageFrom(CacheSetHelper::FNMATCH, pci, Cache, str) == false &&
+                PackageFrom(CacheSetHelper::REGEX, pci, Cache, str) == false)
        {
        {
-               helper.canNotFindPackage(pci, Cache, str);
+               canNotFindPackage(CacheSetHelper::PACKAGENAME, pci, Cache, str);
                found = false;
        }
 
                found = false;
        }
 
@@ -316,51 +332,50 @@ bool PackageContainerInterface::FromString(PackageContainerInterface * const pci
        return found;
 }
                                                                        /*}}}*/
        return found;
 }
                                                                        /*}}}*/
-// FromCommandLine - Return all packages specified on commandline      /*{{{*/
-bool PackageContainerInterface::FromCommandLine(PackageContainerInterface * const pci, pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper) {
+// PackageFromCommandLine - Return all packages specified on commandline /*{{{*/
+bool CacheSetHelper::PackageFromCommandLine(PackageContainerInterface * const pci, pkgCacheFile &Cache, const char **cmdline) {
        bool found = false;
        for (const char **I = cmdline; *I != 0; ++I)
        bool found = false;
        for (const char **I = cmdline; *I != 0; ++I)
-               found |= PackageContainerInterface::FromString(pci, Cache, *I, helper);
+               found |= PackageFrom(CacheSetHelper::STRING, pci, Cache, *I);
        return found;
 }
                                                                        /*}}}*/
 // FromModifierCommandLine - helper doing the work for PKG:GroupedFromCommandLine      /*{{{*/
        return found;
 }
                                                                        /*}}}*/
 // FromModifierCommandLine - helper doing the work for PKG:GroupedFromCommandLine      /*{{{*/
-bool PackageContainerInterface::FromModifierCommandLine(unsigned short &modID, PackageContainerInterface * const pci,
+bool CacheSetHelper::PackageFromModifierCommandLine(unsigned short &modID, PackageContainerInterface * const pci,
                                                        pkgCacheFile &Cache, const char * cmdline,
                                                        pkgCacheFile &Cache, const char * cmdline,
-                                                       std::list<Modifier> const &mods, CacheSetHelper &helper) {
+                                                       std::list<PkgModifier> const &mods) {
        std::string str = cmdline;
        unsigned short fallback = modID;
        bool modifierPresent = false;
        std::string str = cmdline;
        unsigned short fallback = modID;
        bool modifierPresent = false;
-       for (std::list<Modifier>::const_iterator mod = mods.begin();
+       for (std::list<PkgModifier>::const_iterator mod = mods.begin();
             mod != mods.end(); ++mod) {
                size_t const alength = strlen(mod->Alias);
                switch(mod->Pos) {
             mod != mods.end(); ++mod) {
                size_t const alength = strlen(mod->Alias);
                switch(mod->Pos) {
-               case Modifier::POSTFIX:
+               case PkgModifier::POSTFIX:
                        if (str.compare(str.length() - alength, alength,
                                        mod->Alias, 0, alength) != 0)
                                continue;
                        str.erase(str.length() - alength);
                        modID = mod->ID;
                        break;
                        if (str.compare(str.length() - alength, alength,
                                        mod->Alias, 0, alength) != 0)
                                continue;
                        str.erase(str.length() - alength);
                        modID = mod->ID;
                        break;
-               case Modifier::PREFIX:
+               case PkgModifier::PREFIX:
                        continue;
                        continue;
-               case Modifier::NONE:
+               case PkgModifier::NONE:
                        continue;
                }
                modifierPresent = true;
                break;
        }
        if (modifierPresent == true) {
                        continue;
                }
                modifierPresent = true;
                break;
        }
        if (modifierPresent == true) {
-               bool const errors = helper.showErrors(false);
-               pkgCache::PkgIterator Pkg = FromName(Cache, cmdline, helper);
-               helper.showErrors(errors);
-               if (Pkg.end() == false) {
-                       pci->insert(Pkg);
+               bool const errors = showErrors(false);
+               bool const found = PackageFrom(PACKAGENAME, pci, Cache, cmdline);
+               showErrors(errors);
+               if (found == true) {
                        modID = fallback;
                        return true;
                }
        }
                        modID = fallback;
                        return true;
                }
        }
-       return FromString(pci, Cache, str, helper);
+       return PackageFrom(CacheSetHelper::PACKAGENAME, pci, Cache, str);
 }
                                                                        /*}}}*/
 // FromModifierCommandLine - helper doing the work for VER:GroupedFromCommandLine      /*{{{*/
 }
                                                                        /*}}}*/
 // FromModifierCommandLine - helper doing the work for VER:GroupedFromCommandLine      /*{{{*/
@@ -369,8 +384,10 @@ bool VersionContainerInterface::FromModifierCommandLine(unsigned short &modID,
                                                        pkgCacheFile &Cache, const char * cmdline,
                                                        std::list<Modifier> const &mods,
                                                        CacheSetHelper &helper) {
                                                        pkgCacheFile &Cache, const char * cmdline,
                                                        std::list<Modifier> const &mods,
                                                        CacheSetHelper &helper) {
-       Version select = NEWEST;
+       CacheSetHelper::VerSelector select = CacheSetHelper::NEWEST;
        std::string str = cmdline;
        std::string str = cmdline;
+       if (unlikely(str.empty() == true))
+               return false;
        bool modifierPresent = false;
        unsigned short fallback = modID;
        for (std::list<Modifier>::const_iterator mod = mods.begin();
        bool modifierPresent = false;
        unsigned short fallback = modID;
        for (std::list<Modifier>::const_iterator mod = mods.begin();
@@ -380,8 +397,8 @@ bool VersionContainerInterface::FromModifierCommandLine(unsigned short &modID,
                size_t const alength = strlen(mod->Alias);
                switch(mod->Pos) {
                case Modifier::POSTFIX:
                size_t const alength = strlen(mod->Alias);
                switch(mod->Pos) {
                case Modifier::POSTFIX:
-                       if (str.compare(str.length() - alength, alength,
-                                       mod->Alias, 0, alength) != 0)
+                       if (str.length() <= alength ||
+                             str.compare(str.length() - alength, alength, mod->Alias, 0, alength) != 0)
                                continue;
                        str.erase(str.length() - alength);
                        modID = mod->ID;
                                continue;
                        str.erase(str.length() - alength);
                        modID = mod->ID;
@@ -410,7 +427,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,
 // 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);
        bool found = false;
        for (const char **I = cmdline; *I != 0; ++I)
                found |= VersionContainerInterface::FromString(vci, Cache, *I, fallback, helper);
@@ -420,7 +438,8 @@ bool VersionContainerInterface::FromCommandLine(VersionContainerInterface * cons
 // FromString - Returns all versions spedcified by a string            /*{{{*/
 bool VersionContainerInterface::FromString(VersionContainerInterface * const vci,
                                           pkgCacheFile &Cache, std::string pkg,
 // 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) {
        std::string ver;
        bool verIsRel = false;
                                           bool const onlyFromName) {
        std::string ver;
        bool verIsRel = false;
@@ -430,15 +449,16 @@ bool VersionContainerInterface::FromString(VersionContainerInterface * const vci
                verIsRel = (pkg[vertag] == '/');
                pkg.erase(vertag);
        }
                verIsRel = (pkg[vertag] == '/');
                pkg.erase(vertag);
        }
+
        PackageSet pkgset;
        if (onlyFromName == false)
        PackageSet pkgset;
        if (onlyFromName == false)
-               PackageContainerInterface::FromString(&pkgset, Cache, pkg, helper);
+               helper.PackageFrom(CacheSetHelper::STRING, &pkgset, Cache, pkg);
        else {
        else {
-               pkgset.insert(PackageContainerInterface::FromName(Cache, pkg, helper));
+               helper.PackageFrom(CacheSetHelper::PACKAGENAME, &pkgset, Cache, pkg);
        }
 
        bool errors = true;
        }
 
        bool errors = true;
-       if (pkgset.getConstructor() != PackageSet::UNKNOWN)
+       if (pkgset.getConstructor() != CacheSetHelper::UNKNOWN)
                errors = helper.showErrors(false);
 
        bool found = false;
                errors = helper.showErrors(false);
 
        bool found = false;
@@ -457,7 +477,7 @@ bool VersionContainerInterface::FromString(VersionContainerInterface * const vci
                        if (P->VersionList != 0)
                                V = P.VersionList();
                        else
                        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));
                } else {
                        pkgVersionMatch Match(ver, (verIsRel == true ? pkgVersionMatch::Release :
                                        pkgVersionMatch::Version));
@@ -474,11 +494,14 @@ bool VersionContainerInterface::FromString(VersionContainerInterface * const vci
                }
                if (V.end() == true)
                        continue;
                }
                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;
        }
                vci->insert(V);
                found = true;
        }
-       if (pkgset.getConstructor() != PackageSet::UNKNOWN)
+       if (pkgset.getConstructor() != CacheSetHelper::UNKNOWN)
                helper.showErrors(errors);
        return found;
 }
                helper.showErrors(errors);
        return found;
 }
@@ -487,30 +510,30 @@ bool VersionContainerInterface::FromString(VersionContainerInterface * const vci
 bool VersionContainerInterface::FromPackage(VersionContainerInterface * const vci,
                                            pkgCacheFile &Cache,
                                            pkgCache::PkgIterator const &P,
 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) {
                                            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
                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;
                break;
-       case CANDANDINST:
+       case CacheSetHelper::CANDANDINST:
                found |= vci->insert(getInstalledVer(Cache, P, helper));
                found |= vci->insert(getCandidateVer(Cache, P, helper));
                break;
                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;
                found |= vci->insert(getCandidateVer(Cache, P, helper));
                break;
-       case INSTALLED:
+       case CacheSetHelper::INSTALLED:
                found |= vci->insert(getInstalledVer(Cache, P, helper));
                break;
                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)
                showErrors = helper.showErrors(false);
                V = getCandidateVer(Cache, P, helper);
                if (V.end() == true)
@@ -519,9 +542,9 @@ bool VersionContainerInterface::FromPackage(VersionContainerInterface * const vc
                if (V.end() == false)
                        found |= vci->insert(V);
                else
                if (V.end() == false)
                        found |= vci->insert(V);
                else
-                       helper.canNotFindInstCandVer(vci, Cache, P);
+                       helper.canNotFindVersion(CacheSetHelper::CANDINST, vci, Cache, P);
                break;
                break;
-       case INSTCAND:
+       case CacheSetHelper::INSTCAND:
                showErrors = helper.showErrors(false);
                V = getInstalledVer(Cache, P, helper);
                if (V.end() == true)
                showErrors = helper.showErrors(false);
                V = getInstalledVer(Cache, P, helper);
                if (V.end() == true)
@@ -530,14 +553,128 @@ bool VersionContainerInterface::FromPackage(VersionContainerInterface * const vc
                if (V.end() == false)
                        found |= vci->insert(V);
                else
                if (V.end() == false)
                        found |= vci->insert(V);
                else
-                       helper.canNotFindInstCandVer(vci, Cache, P);
+                       helper.canNotFindVersion(CacheSetHelper::INSTCAND, vci, Cache, P);
                break;
                break;
-       case NEWEST:
+       case CacheSetHelper::NEWEST:
                if (P->VersionList != 0)
                        found |= vci->insert(P.VersionList());
                else
                if (P->VersionList != 0)
                        found |= vci->insert(P.VersionList());
                else
-                       helper.canNotFindNewestVer(Cache, P);
+                       helper.canNotFindVersion(CacheSetHelper::NEWEST, vci, Cache, P);
                break;
                break;
+       case CacheSetHelper::RELEASE:
+       case CacheSetHelper::VERSIONNUMBER:
+               // both make no sense here, so always false
+               return false;
+       }
+       return found;
+}
+                                                                       /*}}}*/
+// FromDependency - versions satisfying a given dependency             /*{{{*/
+bool VersionContainerInterface::FromDependency(VersionContainerInterface * const vci,
+                                              pkgCacheFile &Cache,
+                                              pkgCache::DepIterator const &D,
+                                              CacheSetHelper::VerSelector const selector,
+                                              CacheSetHelper &helper)
+{
+       bool found = false;
+       switch(selector) {
+       case CacheSetHelper::ALL:
+       {
+               pkgCache::PkgIterator const T = D.TargetPkg();
+               for (pkgCache::VerIterator Ver = T.VersionList(); Ver.end() == false; ++Ver)
+               {
+                  if (D.IsSatisfied(Ver) == true)
+                  {
+                     vci->insert(Ver);
+                     found = true;
+                  }
+                  for (pkgCache::PrvIterator Prv = T.ProvidesList(); Prv.end() != true; ++Prv)
+                  {
+                     pkgCache::VerIterator const V = Prv.OwnerVer();
+                     if (unlikely(V.end() == true) || D.IsSatisfied(Prv) == false)
+                        continue;
+                     vci->insert(V);
+                     found = true;
+                  }
+               }
+               return found;
+       }
+       case CacheSetHelper::CANDANDINST:
+       {
+               found = FromDependency(vci, Cache, D, CacheSetHelper::CANDIDATE, helper);
+               found &= FromDependency(vci, Cache, D, CacheSetHelper::INSTALLED, helper);
+               return found;
+       }
+       case CacheSetHelper::CANDIDATE:
+       {
+               pkgCache::PkgIterator const T = D.TargetPkg();
+               pkgCache::VerIterator const Cand = Cache[T].CandidateVerIter(Cache);
+               if (Cand.end() == false && D.IsSatisfied(Cand) == true)
+               {
+                  vci->insert(Cand);
+                  found = true;
+               }
+               for (pkgCache::PrvIterator Prv = T.ProvidesList(); Prv.end() != true; ++Prv)
+               {
+                  pkgCache::VerIterator const V = Prv.OwnerVer();
+                  pkgCache::VerIterator const Cand = Cache[Prv.OwnerPkg()].CandidateVerIter(Cache);
+                  if (Cand.end() == true || V != Cand || D.IsSatisfied(Prv) == false)
+                     continue;
+                  vci->insert(Cand);
+                  found = true;
+               }
+               return found;
+       }
+       case CacheSetHelper::INSTALLED:
+       {
+               pkgCache::PkgIterator const T = D.TargetPkg();
+               pkgCache::VerIterator const Cand = T.CurrentVer();
+               if (Cand.end() == false && D.IsSatisfied(Cand) == true)
+               {
+                  vci->insert(Cand);
+                  found = true;
+               }
+               for (pkgCache::PrvIterator Prv = T.ProvidesList(); Prv.end() != true; ++Prv)
+               {
+                  pkgCache::VerIterator const V = Prv.OwnerVer();
+                  pkgCache::VerIterator const Cand = Prv.OwnerPkg().CurrentVer();
+                  if (Cand.end() == true || V != Cand || D.IsSatisfied(Prv) == false)
+                     continue;
+                  vci->insert(Cand);
+                  found = true;
+               }
+               return found;
+       }
+       case CacheSetHelper::CANDINST:
+               return FromDependency(vci, Cache, D, CacheSetHelper::CANDIDATE, helper) ||
+                  FromDependency(vci, Cache, D, CacheSetHelper::INSTALLED, helper);
+       case CacheSetHelper::INSTCAND:
+               return FromDependency(vci, Cache, D, CacheSetHelper::INSTALLED, helper) ||
+                  FromDependency(vci, Cache, D, CacheSetHelper::CANDIDATE, helper);
+       case CacheSetHelper::NEWEST:
+       {
+               pkgCache::PkgIterator const T = D.TargetPkg();
+               pkgCache::VerIterator const Cand = T.VersionList();
+               if (Cand.end() == false && D.IsSatisfied(Cand) == true)
+               {
+                  vci->insert(Cand);
+                  found = true;
+               }
+               for (pkgCache::PrvIterator Prv = T.ProvidesList(); Prv.end() != true; ++Prv)
+               {
+                  pkgCache::VerIterator const V = Prv.OwnerVer();
+                  pkgCache::VerIterator const Cand = Prv.OwnerPkg().VersionList();
+                  if (Cand.end() == true || V != Cand || D.IsSatisfied(Prv) == false)
+                     continue;
+                  vci->insert(Cand);
+                  found = true;
+               }
+               return found;
+       }
+       case CacheSetHelper::RELEASE:
+       case CacheSetHelper::VERSIONNUMBER:
+               // both make no sense here, so always false
+               return false;
        }
        return found;
 }
        }
        return found;
 }
@@ -546,15 +683,15 @@ bool VersionContainerInterface::FromPackage(VersionContainerInterface * const vc
 pkgCache::VerIterator VersionContainerInterface::getCandidateVer(pkgCacheFile &Cache,
                pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper) {
        pkgCache::VerIterator Cand;
 pkgCache::VerIterator VersionContainerInterface::getCandidateVer(pkgCacheFile &Cache,
                pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper) {
        pkgCache::VerIterator Cand;
-       if (Cache.IsPolicyBuilt() == true || Cache.IsDepCacheBuilt() == false) {
-               if (unlikely(Cache.GetPolicy() == 0))
-                       return pkgCache::VerIterator(Cache);
-               Cand = Cache.GetPolicy()->GetCandidateVer(Pkg);
-       } else {
+       if (Cache.IsDepCacheBuilt() == true) {
                Cand = Cache[Pkg].CandidateVerIter(Cache);
                Cand = Cache[Pkg].CandidateVerIter(Cache);
+       } else if (unlikely(Cache.GetPolicy() == nullptr)) {
+               return pkgCache::VerIterator(Cache);
+       } else {
+               Cand = Cache.GetPolicy()->GetCandidateVer(Pkg);
        }
        if (Cand.end() == true)
        }
        if (Cand.end() == true)
-               return helper.canNotFindCandidateVer(Cache, Pkg);
+               return helper.canNotGetVersion(CacheSetHelper::CANDIDATE, Cache, Pkg);
        return Cand;
 }
                                                                        /*}}}*/
        return Cand;
 }
                                                                        /*}}}*/
@@ -562,56 +699,115 @@ pkgCache::VerIterator VersionContainerInterface::getCandidateVer(pkgCacheFile &C
 pkgCache::VerIterator VersionContainerInterface::getInstalledVer(pkgCacheFile &Cache,
                pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper) {
        if (Pkg->CurrentVer == 0)
 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();
 }
                                                                        /*}}}*/
 
        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) {
+APT_IGNORE_DEPRECATED_PUSH
+       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 STRING: canNotFindPackage(pci, Cache, pattern); break;
+       case UNKNOWN: break;
+APT_IGNORE_DEPRECATED_POP
+       }
 }
 }
-                                                                       /*}}}*/
 // canNotFindTask - handle the case no package is found for a task     /*{{{*/
 // canNotFindTask - handle the case no package is found for a task     /*{{{*/
-void CacheSetHelper::canNotFindTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern) {
+void CacheSetHelper::canNotFindTask(PackageContainerInterface * const /*pci*/, pkgCacheFile &/*Cache*/, std::string pattern) {
        if (ShowError == true)
                _error->Insert(ErrorType, _("Couldn't find task '%s'"), pattern.c_str());
 }
                                                                        /*}}}*/
 // canNotFindRegEx - handle the case no package is found by a regex    /*{{{*/
        if (ShowError == true)
                _error->Insert(ErrorType, _("Couldn't find task '%s'"), pattern.c_str());
 }
                                                                        /*}}}*/
 // canNotFindRegEx - handle the case no package is found by a regex    /*{{{*/
-void CacheSetHelper::canNotFindRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern) {
+void CacheSetHelper::canNotFindRegEx(PackageContainerInterface * const /*pci*/, pkgCacheFile &/*Cache*/, std::string pattern) {
        if (ShowError == true)
                _error->Insert(ErrorType, _("Couldn't find any package by regex '%s'"), pattern.c_str());
 }
                                                                        /*}}}*/
        if (ShowError == true)
                _error->Insert(ErrorType, _("Couldn't find any package by regex '%s'"), pattern.c_str());
 }
                                                                        /*}}}*/
+// 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());
+}
+                                                                       /*}}}*/
 // canNotFindPackage - handle the case no package is found from a string/*{{{*/
 // canNotFindPackage - handle the case no package is found from a string/*{{{*/
-void CacheSetHelper::canNotFindPackage(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &str) {
+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) {
+APT_IGNORE_DEPRECATED_PUSH
+       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;
+APT_IGNORE_DEPRECATED_POP
+       case CANDANDINST: canNotGetCandInstVer(Cache, Pkg); break;
+       case RELEASE:
+       case VERSIONNUMBER:
+               // invalid in this branch
+               break;
+       }
+}
 // canNotFindAllVer                                                    /*{{{*/
 // canNotFindAllVer                                                    /*{{{*/
-void CacheSetHelper::canNotFindAllVer(VersionContainerInterface * const vci, pkgCacheFile &Cache,
+void CacheSetHelper::canNotFindAllVer(VersionContainerInterface * const /*vci*/, pkgCacheFile &/*Cache*/,
                pkgCache::PkgIterator const &Pkg) {
        if (ShowError == true)
                _error->Insert(ErrorType, _("Can't select versions from package '%s' as it is purely virtual"), Pkg.FullName(true).c_str());
 }
                                                                        /*}}}*/
 // canNotFindInstCandVer                                               /*{{{*/
                pkgCache::PkgIterator const &Pkg) {
        if (ShowError == true)
                _error->Insert(ErrorType, _("Can't select versions from package '%s' as it is purely virtual"), Pkg.FullName(true).c_str());
 }
                                                                        /*}}}*/
 // canNotFindInstCandVer                                               /*{{{*/
-void CacheSetHelper::canNotFindInstCandVer(VersionContainerInterface * const vci, pkgCacheFile &Cache,
+void CacheSetHelper::canNotFindInstCandVer(VersionContainerInterface * const /*vci*/, pkgCacheFile &Cache,
                pkgCache::PkgIterator const &Pkg) {
                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                                               /*{{{*/
 }
                                                                        /*}}}*/
 // canNotFindInstCandVer                                               /*{{{*/
-void CacheSetHelper::canNotFindCandInstVer(VersionContainerInterface * const vci, pkgCacheFile &Cache,
+void CacheSetHelper::canNotFindCandInstVer(VersionContainerInterface * const /*vci*/, pkgCacheFile &Cache,
                pkgCache::PkgIterator const &Pkg) {
                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) {
+APT_IGNORE_DEPRECATED_PUSH
+       case NEWEST: return canNotFindNewestVer(Cache, Pkg);
+       case CANDIDATE: return canNotFindCandidateVer(Cache, Pkg);
+       case INSTALLED: return canNotFindInstalledVer(Cache, Pkg);
+APT_IGNORE_DEPRECATED_POP
+       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) {
 // canNotFindNewestVer                                                 /*{{{*/
 pkgCache::VerIterator CacheSetHelper::canNotFindNewestVer(pkgCacheFile &Cache,
                pkgCache::PkgIterator const &Pkg) {
@@ -636,21 +832,104 @@ pkgCache::VerIterator CacheSetHelper::canNotFindInstalledVer(pkgCacheFile &Cache
        return pkgCache::VerIterator(Cache, 0);
 }
                                                                        /*}}}*/
        return pkgCache::VerIterator(Cache, 0);
 }
                                                                        /*}}}*/
-// showTaskSelection                                                   /*{{{*/
-void CacheSetHelper::showTaskSelection(pkgCache::PkgIterator const &pkg,
+// 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                        /*{{{*/
+void CacheSetHelper::showPackageSelection(pkgCache::PkgIterator const &pkg, enum PkgSelector const select,
                                       std::string const &pattern) {
                                       std::string const &pattern) {
+       switch (select) {
+APT_IGNORE_DEPRECATED_PUSH
+       case REGEX: showRegExSelection(pkg, pattern); break;
+       case TASK: showTaskSelection(pkg, pattern); break;
+       case FNMATCH: showFnmatchSelection(pkg, pattern); break;
+APT_IGNORE_DEPRECATED_POP
+       case PACKAGENAME: /* no suprises here */ break;
+       case STRING: /* handled by the special cases */ break;
+       case UNKNOWN: break;
+       }
+}
+// showTaskSelection                                                   /*{{{*/
+APT_CONST void CacheSetHelper::showTaskSelection(pkgCache::PkgIterator const &/*pkg*/,
+                                      std::string const &/*pattern*/) {
 }
                                                                        /*}}}*/
 // showRegExSelection                                                  /*{{{*/
 }
                                                                        /*}}}*/
 // showRegExSelection                                                  /*{{{*/
-void CacheSetHelper::showRegExSelection(pkgCache::PkgIterator const &pkg,
-                                       std::string const &pattern) {
+APT_CONST void CacheSetHelper::showRegExSelection(pkgCache::PkgIterator const &/*pkg*/,
+                                       std::string const &/*pattern*/) {
 }
                                                                        /*}}}*/
 }
                                                                        /*}}}*/
-// showSelectedVersion                                                 /*{{{*/
-void CacheSetHelper::showSelectedVersion(pkgCache::PkgIterator const &Pkg,
-                                        pkgCache::VerIterator const Ver,
-                                        std::string const &ver,
-                                        bool const verIsRel) {
+// showFnmatchSelection                                                        /*{{{*/
+APT_CONST void CacheSetHelper::showFnmatchSelection(pkgCache::PkgIterator const &/*pkg*/,
+                                         std::string const &/*pattern*/) {
 }
                                                                        /*}}}*/
 }
                                                                        /*}}}*/
+                                                                       /*}}}*/
+// showVersionSelection                                                        /*{{{*/
+void CacheSetHelper::showVersionSelection(pkgCache::PkgIterator const &Pkg,
+      pkgCache::VerIterator const &Ver, enum VerSelector const select, std::string const &pattern) {
+       switch (select) {
+APT_IGNORE_DEPRECATED_PUSH
+       case RELEASE:
+               showSelectedVersion(Pkg, Ver, pattern, true);
+               break;
+       case VERSIONNUMBER:
+               showSelectedVersion(Pkg, Ver, pattern, false);
+               break;
+APT_IGNORE_DEPRECATED_POP
+       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*/,
+                                        bool const /*verIsRel*/) {
+}
+                                                                       /*}}}*/
+
+CacheSetHelper::CacheSetHelper(bool const ShowError, GlobalError::MsgType ErrorType) :
+   ShowError(ShowError), ErrorType(ErrorType), d(NULL) {}
+CacheSetHelper::~CacheSetHelper() {}
+
+PackageContainerInterface::PackageContainerInterface() : ConstructedBy(CacheSetHelper::UNKNOWN), d(NULL) {}
+PackageContainerInterface::PackageContainerInterface(CacheSetHelper::PkgSelector const by) : ConstructedBy(by), d(NULL) {}
+PackageContainerInterface& PackageContainerInterface::operator=(PackageContainerInterface const &other) {
+   if (this != &other)
+      this->ConstructedBy = other.ConstructedBy;
+   return *this;
+}
+PackageContainerInterface::~PackageContainerInterface() {}
+
+PackageUniverse::PackageUniverse(pkgCache * const Owner) : _cont(Owner), d(NULL) {}
+PackageUniverse::PackageUniverse(pkgCacheFile * const Owner) : _cont(Owner->GetPkgCache()), d(NULL) {}
+PackageUniverse::~PackageUniverse() {}
+
+VersionContainerInterface::VersionContainerInterface() : d(NULL) {}
+VersionContainerInterface& VersionContainerInterface::operator=(VersionContainerInterface const &) {
+   return *this;
+}
+
+VersionContainerInterface::~VersionContainerInterface() {}
 }
 }