Преглед изворни кода

move PCI::From* methods into CacheSetHelper class

The methods itself deal with the helper a lot, so it makes sense to move
them to the helper itself, which helps also if we want to override some
of these methods, the FromString mentioned in the bugreport being the
obvious example.

VCI is spared from this change for now as while it would fit with the
same reasoning it much heavier entangled with the previous
CacheSetHelper change, so moving it now would mean breaking the API.
The PCI change is worthwhile on its own though as it is used by VCI.

Closes: 686221
David Kalnischkies пре 12 година
родитељ
комит
1e064088bf
2 измењених фајлова са 139 додато и 87 уклоњено
  1. 68 56
      apt-pkg/cacheset.cc
  2. 71 31
      apt-pkg/cacheset.h

+ 68 - 56
apt-pkg/cacheset.cc

@@ -37,8 +37,23 @@
 #include <apti18n.h>
 #include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 namespace APT {
 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(':');
 	size_t const archfound = pattern.find_last_of(':');
 	std::string arch = "native";
 	std::string arch = "native";
 	if (archfound != std::string::npos) {
 	if (archfound != std::string::npos) {
@@ -91,13 +106,13 @@ bool PackageContainerInterface::FromTask(PackageContainerInterface * const pci,
 			continue;
 			continue;
 
 
 		pci->insert(Pkg);
 		pci->insert(Pkg);
-		helper.showPackageSelection(Pkg, CacheSetHelper::TASK, pattern);
+		showPackageSelection(Pkg, CacheSetHelper::TASK, pattern);
 		found = true;
 		found = true;
 	}
 	}
 	regfree(&Pattern);
 	regfree(&Pattern);
 
 
 	if (found == false) {
 	if (found == false) {
-		helper.canNotFindPackage(CacheSetHelper::TASK, pci, Cache, pattern);
+		canNotFindPackage(CacheSetHelper::TASK, pci, Cache, pattern);
 		pci->setConstructor(CacheSetHelper::UNKNOWN);
 		pci->setConstructor(CacheSetHelper::UNKNOWN);
 		return false;
 		return false;
 	}
 	}
@@ -108,8 +123,8 @@ bool PackageContainerInterface::FromTask(PackageContainerInterface * const pci,
 	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 = ".?+*|[^$";
 	static const char * const isregex = ".?+*|[^$";
 	if (pattern.find_first_of(isregex) == std::string::npos)
 	if (pattern.find_first_of(isregex) == std::string::npos)
 		return false;
 		return false;
@@ -150,12 +165,12 @@ bool PackageContainerInterface::FromRegEx(PackageContainerInterface * const pci,
 		}
 		}
 
 
 		pci->insert(Pkg);
 		pci->insert(Pkg);
-		helper.showPackageSelection(Pkg, CacheSetHelper::REGEX, pattern);
+		showPackageSelection(Pkg, CacheSetHelper::REGEX, pattern);
 		found = true;
 		found = true;
 	}
 	}
 
 
 	if (found == false) {
 	if (found == false) {
-		helper.canNotFindPackage(CacheSetHelper::REGEX, pci, Cache, pattern);
+		canNotFindPackage(CacheSetHelper::REGEX, pci, Cache, pattern);
 		pci->setConstructor(CacheSetHelper::UNKNOWN);
 		pci->setConstructor(CacheSetHelper::UNKNOWN);
 		return false;
 		return false;
 	}
 	}
@@ -166,12 +181,9 @@ bool PackageContainerInterface::FromRegEx(PackageContainerInterface * const pci,
 	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 = ".?*[]!";
 	static const char * const isfnmatch = ".?*[]!";
 	if (pattern.find_first_of(isfnmatch) == std::string::npos)
 	if (pattern.find_first_of(isfnmatch) == std::string::npos)
@@ -213,12 +225,12 @@ PackageContainerInterface::FromFnmatch(PackageContainerInterface * const pci,
 		}
 		}
 
 
 		pci->insert(Pkg);
 		pci->insert(Pkg);
-		helper.showPackageSelection(Pkg, CacheSetHelper::FNMATCH, pattern);
+		showPackageSelection(Pkg, CacheSetHelper::FNMATCH, pattern);
 		found = true;
 		found = true;
 	}
 	}
 
 
 	if (found == false) {
 	if (found == false) {
-		helper.canNotFindPackage(CacheSetHelper::FNMATCH, pci, Cache, pattern);
+		canNotFindPackage(CacheSetHelper::FNMATCH, pci, Cache, pattern);
 		pci->setConstructor(CacheSetHelper::UNKNOWN);
 		pci->setConstructor(CacheSetHelper::UNKNOWN);
 		return false;
 		return false;
 	}
 	}
@@ -229,9 +241,9 @@ PackageContainerInterface::FromFnmatch(PackageContainerInterface * const pci,
 	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;
 	std::string pkg = str;
 	size_t archfound = pkg.find_last_of(':');
 	size_t archfound = pkg.find_last_of(':');
 	std::string arch;
 	std::string arch;
@@ -252,13 +264,13 @@ pkgCache::PkgIterator PackageContainerInterface::FromName(pkgCacheFile &Cache,
 		Pkg = Cache.GetPkgCache()->FindPkg(pkg, arch);
 		Pkg = Cache.GetPkgCache()->FindPkg(pkg, arch);
 
 
 	if (Pkg.end() == true)
 	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))
 	if (unlikely(Cache.GetPkgCache() == 0))
 		return false;
 		return false;
 
 
@@ -298,7 +310,7 @@ bool PackageContainerInterface::FromGroup(PackageContainerInterface * const pci,
 		}
 		}
 	}
 	}
 
 
-	pkgCache::PkgIterator Pkg = helper.canNotFindPkgName(Cache, pkg);
+	pkgCache::PkgIterator Pkg = canNotFindPkgName(Cache, pkg);
 	if (Pkg.end() == true)
 	if (Pkg.end() == true)
 	   return false;
 	   return false;
 
 
@@ -306,18 +318,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;
 	bool found = true;
 	_error->PushToStack();
 	_error->PushToStack();
 
 
-	if (FromGroup(pci, Cache, str, helper) == false &&
-		 FromTask(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?
 		 // FIXME: hm, hm, regexp/fnmatch incompatible?
-		 FromFnmatch(pci, Cache, str, helper) == false &&
-		 FromRegEx(pci, Cache, str, helper) == false)
+		 PackageFrom(CacheSetHelper::FNMATCH, pci, Cache, str) == false &&
+		 PackageFrom(CacheSetHelper::REGEX, pci, Cache, str) == false)
 	{
 	{
-		helper.canNotFindPackage(CacheSetHelper::PACKAGENAME, pci, Cache, str);
+		canNotFindPackage(CacheSetHelper::PACKAGENAME, pci, Cache, str);
 		found = false;
 		found = false;
 	}
 	}
 
 
@@ -328,51 +340,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;
 	bool found = false;
 	for (const char **I = cmdline; *I != 0; ++I)
 	for (const char **I = cmdline; *I != 0; ++I)
-		found |= PackageContainerInterface::FromString(pci, Cache, *I, helper);
+		found |= PackageFrom(CacheSetHelper::PACKAGENAME, pci, Cache, *I);
 	return found;
 	return found;
 }
 }
 									/*}}}*/
 									/*}}}*/
 // FromModifierCommandLine - helper doing the work for PKG:GroupedFromCommandLine	/*{{{*/
 // 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;
 	std::string str = cmdline;
 	unsigned short fallback = modID;
 	unsigned short fallback = modID;
 	bool modifierPresent = false;
 	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) {
 	     mod != mods.end(); ++mod) {
 		size_t const alength = strlen(mod->Alias);
 		size_t const alength = strlen(mod->Alias);
 		switch(mod->Pos) {
 		switch(mod->Pos) {
-		case Modifier::POSTFIX:
+		case PkgModifier::POSTFIX:
 			if (str.compare(str.length() - alength, alength,
 			if (str.compare(str.length() - alength, alength,
 					mod->Alias, 0, alength) != 0)
 					mod->Alias, 0, alength) != 0)
 				continue;
 				continue;
 			str.erase(str.length() - alength);
 			str.erase(str.length() - alength);
 			modID = mod->ID;
 			modID = mod->ID;
 			break;
 			break;
-		case Modifier::PREFIX:
+		case PkgModifier::PREFIX:
 			continue;
 			continue;
-		case Modifier::NONE:
+		case PkgModifier::NONE:
 			continue;
 			continue;
 		}
 		}
 		modifierPresent = true;
 		modifierPresent = true;
 		break;
 		break;
 	}
 	}
 	if (modifierPresent == true) {
 	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;
 			modID = fallback;
 			return true;
 			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	/*{{{*/
@@ -438,14 +449,13 @@ bool VersionContainerInterface::FromString(VersionContainerInterface * const vci
 					   CacheSetHelper::VerSelector const fallback,
 					   CacheSetHelper::VerSelector const fallback,
 					   CacheSetHelper &helper,
 					   CacheSetHelper &helper,
 					   bool const onlyFromName) {
 					   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);
-        }
+	PackageSet pkgset;
+	if(FileExists(pkg)) {
+		helper.PackageFrom(CacheSetHelper::STRING, &pkgset, Cache, pkg);
+		if(pkgset.empty() == true)
+			return false;
+		return VersionContainerInterface::FromPackage(vci, Cache, pkgset.begin(), fallback, helper);
+	}
 
 
 	std::string ver;
 	std::string ver;
 	bool verIsRel = false;
 	bool verIsRel = false;
@@ -456,9 +466,9 @@ bool VersionContainerInterface::FromString(VersionContainerInterface * const vci
 		pkg.erase(vertag);
 		pkg.erase(vertag);
 	}
 	}
 	if (onlyFromName == false)
 	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;
@@ -611,6 +621,7 @@ void CacheSetHelper::canNotFindPackage(enum PkgSelector const select,
 	case TASK: canNotFindTask(pci, Cache, pattern); break;
 	case TASK: canNotFindTask(pci, Cache, pattern); break;
 	case FNMATCH: canNotFindFnmatch(pci, Cache, pattern); break;
 	case FNMATCH: canNotFindFnmatch(pci, Cache, pattern); break;
 	case PACKAGENAME: canNotFindPackage(pci, Cache, pattern); break;
 	case PACKAGENAME: canNotFindPackage(pci, Cache, pattern); break;
+	case STRING: canNotFindPackage(pci, Cache, pattern); break;
 	case UNKNOWN: break;
 	case UNKNOWN: break;
 #if __GNUC__ >= 4
 #if __GNUC__ >= 4
 	#pragma GCC diagnostic pop
 	#pragma GCC diagnostic pop
@@ -772,6 +783,7 @@ APT_CONST void CacheSetHelper::showPackageSelection(pkgCache::PkgIterator const
 	#pragma GCC diagnostic pop
 	#pragma GCC diagnostic pop
 #endif
 #endif
 	case PACKAGENAME: /* no suprises here */ break;
 	case PACKAGENAME: /* no suprises here */ break;
+	case STRING: /* handled by the special cases */ break;
 	case UNKNOWN: break;
 	case UNKNOWN: break;
 	}
 	}
 }
 }

+ 71 - 31
apt-pkg/cacheset.h

@@ -53,7 +53,25 @@ public:									/*{{{*/
 			ShowError(ShowError), ErrorType(ErrorType) {}
 			ShowError(ShowError), ErrorType(ErrorType) {}
 	virtual ~CacheSetHelper() {}
 	virtual ~CacheSetHelper() {}
 
 
-	enum PkgSelector { UNKNOWN, PACKAGENAME, REGEX, TASK, FNMATCH };
+	enum PkgSelector { UNKNOWN, REGEX, TASK, FNMATCH, PACKAGENAME, STRING };
+
+	virtual bool PackageFrom(enum PkgSelector const select, PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &pattern);
+
+	virtual bool PackageFromCommandLine(PackageContainerInterface * const pci, pkgCacheFile &Cache, const char **cmdline);
+
+	struct PkgModifier {
+		enum Position { NONE, PREFIX, POSTFIX };
+		unsigned short ID;
+		const char * const Alias;
+		Position Pos;
+		PkgModifier (unsigned short const &id, const char * const alias, Position const &pos) : ID(id), Alias(alias), Pos(pos) {}
+	};
+	virtual bool PackageFromModifierCommandLine(unsigned short &modID, PackageContainerInterface * const pci,
+					    pkgCacheFile &Cache, const char * cmdline,
+					    std::list<PkgModifier> const &mods);
+
+	// use PackageFrom(PACKAGENAME, …) instead
+	APT_DEPRECATED pkgCache::PkgIterator PackageFromName(pkgCacheFile &Cache, std::string const &pattern);
 
 
 	/** \brief be notified about the package being selected via pattern
 	/** \brief be notified about the package being selected via pattern
 	 *
 	 *
@@ -178,6 +196,12 @@ protected:
 		pkgCache::PkgIterator const &Pkg);
 		pkgCache::PkgIterator const &Pkg);
 	pkgCache::VerIterator canNotGetCandInstVer(pkgCacheFile &Cache,
 	pkgCache::VerIterator canNotGetCandInstVer(pkgCacheFile &Cache,
 		pkgCache::PkgIterator const &Pkg);
 		pkgCache::PkgIterator const &Pkg);
+
+	bool PackageFromTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern);
+	bool PackageFromRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern);
+	bool PackageFromFnmatch(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern);
+	bool PackageFromPackageName(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern);
+	bool PackageFromString(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &pattern);
 };									/*}}}*/
 };									/*}}}*/
 
 
 class PackageContainerInterface {					/*{{{*/
 class PackageContainerInterface {					/*{{{*/
@@ -251,25 +275,34 @@ public:
 	PackageContainerInterface() : ConstructedBy(CacheSetHelper::UNKNOWN) {}
 	PackageContainerInterface() : ConstructedBy(CacheSetHelper::UNKNOWN) {}
 	PackageContainerInterface(CacheSetHelper::PkgSelector const by) : ConstructedBy(by) {}
 	PackageContainerInterface(CacheSetHelper::PkgSelector const by) : ConstructedBy(by) {}
 
 
-	static bool FromTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper);
-	static bool FromRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper);
-	static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper);
-	static bool FromFnmatch(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper);
-	static bool FromGroup(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper);
-	static bool FromString(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper);
-	static bool FromCommandLine(PackageContainerInterface * const pci, pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper);
-
-	struct Modifier {
-		enum Position { NONE, PREFIX, POSTFIX };
-		unsigned short ID;
-		const char * const Alias;
-		Position Pos;
-		Modifier (unsigned short const &id, const char * const alias, Position const &pos) : ID(id), Alias(alias), Pos(pos) {}
-	};
+	APT_DEPRECATED static bool FromTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
+	   return helper.PackageFrom(CacheSetHelper::TASK, pci, Cache, pattern); }
+	APT_DEPRECATED static bool FromRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
+	   return helper.PackageFrom(CacheSetHelper::REGEX, pci, Cache, pattern); }
+	APT_DEPRECATED static bool FromFnmatch(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
+	   return helper.PackageFrom(CacheSetHelper::FNMATCH, pci, Cache, pattern); }
+	APT_DEPRECATED static bool FromGroup(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
+	   return helper.PackageFrom(CacheSetHelper::PACKAGENAME, pci, Cache, pattern); }
+	APT_DEPRECATED static bool FromString(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
+	   return helper.PackageFrom(CacheSetHelper::STRING, pci, Cache, pattern); }
+	APT_DEPRECATED static bool FromCommandLine(PackageContainerInterface * const pci, pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper) {
+	   return helper.PackageFromCommandLine(pci, Cache, cmdline); }
+
+	APT_DEPRECATED typedef CacheSetHelper::PkgModifier Modifier;
 
 
-	static bool FromModifierCommandLine(unsigned short &modID, PackageContainerInterface * const pci,
-					    pkgCacheFile &Cache, const char * cmdline,
-					    std::list<Modifier> const &mods, CacheSetHelper &helper);
+#if __GNUC__ >= 4
+	#pragma GCC diagnostic push
+	#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+	APT_DEPRECATED static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
+	   return helper.PackageFromName(Cache, pattern); }
+	APT_DEPRECATED static bool FromModifierCommandLine(unsigned short &modID, PackageContainerInterface * const pci,
+	      pkgCacheFile &Cache, const char * cmdline,
+	      std::list<Modifier> const &mods, CacheSetHelper &helper) {
+	   return helper.PackageFromModifierCommandLine(modID, pci, Cache, cmdline, mods); }
+#if __GNUC__ >= 4
+	#pragma GCC diagnostic pop
+#endif
 
 
 private:
 private:
 	CacheSetHelper::PkgSelector ConstructedBy;
 	CacheSetHelper::PkgSelector ConstructedBy;
@@ -369,7 +402,7 @@ public:									/*{{{*/
 	    \param helper responsible for error and message handling */
 	    \param helper responsible for error and message handling */
 	static PackageContainer FromTask(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
 	static PackageContainer FromTask(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
 		PackageContainer cont(CacheSetHelper::TASK);
 		PackageContainer cont(CacheSetHelper::TASK);
-		PackageContainerInterface::FromTask(&cont, Cache, pattern, helper);
+		helper.PackageFrom(CacheSetHelper::TASK, &cont, Cache, pattern);
 		return cont;
 		return cont;
 	}
 	}
 	static PackageContainer FromTask(pkgCacheFile &Cache, std::string const &pattern) {
 	static PackageContainer FromTask(pkgCacheFile &Cache, std::string const &pattern) {
@@ -387,7 +420,7 @@ public:									/*{{{*/
 	    \param helper responsible for error and message handling */
 	    \param helper responsible for error and message handling */
 	static PackageContainer FromRegEx(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
 	static PackageContainer FromRegEx(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
 		PackageContainer cont(CacheSetHelper::REGEX);
 		PackageContainer cont(CacheSetHelper::REGEX);
-		PackageContainerInterface::FromRegEx(&cont, Cache, pattern, helper);
+		helper.PackageFrom(CacheSetHelper::REGEX, &cont, Cache, pattern);
 		return cont;
 		return cont;
 	}
 	}
 
 
@@ -398,7 +431,7 @@ public:									/*{{{*/
 
 
 	static PackageContainer FromFnmatch(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
 	static PackageContainer FromFnmatch(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
 		PackageContainer cont(CacheSetHelper::FNMATCH);
 		PackageContainer cont(CacheSetHelper::FNMATCH);
-		PackageContainerInterface::FromFnmatch(&cont, Cache, pattern, helper);
+		helper.PackageFrom(CacheSetHelper::FNMATCH, &cont, Cache, pattern);
 		return cont;
 		return cont;
 	}
 	}
 	static PackageContainer FromFnMatch(pkgCacheFile &Cache, std::string const &pattern) {
 	static PackageContainer FromFnMatch(pkgCacheFile &Cache, std::string const &pattern) {
@@ -406,18 +439,25 @@ public:									/*{{{*/
 		return FromFnmatch(Cache, pattern, helper);
 		return FromFnmatch(Cache, pattern, helper);
 	}
 	}
 
 
+#if __GNUC__ >= 4
+	#pragma GCC diagnostic push
+	#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
 	/** \brief returns a package specified by a string
 	/** \brief returns a package specified by a string
 
 
 	    \param Cache the package is in
 	    \param Cache the package is in
 	    \param pattern String the package name should be extracted from
 	    \param pattern String the package name should be extracted from
 	    \param helper responsible for error and message handling */
 	    \param helper responsible for error and message handling */
-	static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
-		return PackageContainerInterface::FromName(Cache, pattern, helper);
+	APT_DEPRECATED static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
+		return helper.PackageFromName(Cache, pattern);
 	}
 	}
-	static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &pattern) {
+	APT_DEPRECATED static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &pattern) {
 		CacheSetHelper helper;
 		CacheSetHelper helper;
-		return PackageContainerInterface::FromName(Cache, pattern, helper);
+		return FromName(Cache, pattern, helper);
 	}
 	}
+#if __GNUC__ >= 4
+	#pragma GCC diagnostic pop
+#endif
 
 
 	/** \brief returns all packages specified by a string
 	/** \brief returns all packages specified by a string
 
 
@@ -426,7 +466,7 @@ public:									/*{{{*/
 	    \param helper responsible for error and message handling */
 	    \param helper responsible for error and message handling */
 	static PackageContainer FromString(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
 	static PackageContainer FromString(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
 		PackageContainer cont;
 		PackageContainer cont;
-		PackageContainerInterface::FromString(&cont, Cache, pattern, helper);
+		helper.PackageFrom(CacheSetHelper::PACKAGENAME, &cont, Cache, pattern);
 		return cont;
 		return cont;
 	}
 	}
 	static PackageContainer FromString(pkgCacheFile &Cache, std::string const &pattern) {
 	static PackageContainer FromString(pkgCacheFile &Cache, std::string const &pattern) {
@@ -443,7 +483,7 @@ public:									/*{{{*/
 	    \param helper responsible for error and message handling */
 	    \param helper responsible for error and message handling */
 	static PackageContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper) {
 	static PackageContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper) {
 		PackageContainer cont;
 		PackageContainer cont;
-		PackageContainerInterface::FromCommandLine(&cont, Cache, cmdline, helper);
+		helper.PackageFromCommandLine(&cont, Cache, cmdline);
 		return cont;
 		return cont;
 	}
 	}
 	static PackageContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline) {
 	static PackageContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline) {
@@ -465,14 +505,14 @@ public:									/*{{{*/
 	static std::map<unsigned short, PackageContainer> GroupedFromCommandLine(
 	static std::map<unsigned short, PackageContainer> GroupedFromCommandLine(
 										 pkgCacheFile &Cache,
 										 pkgCacheFile &Cache,
 										 const char **cmdline,
 										 const char **cmdline,
-										 std::list<Modifier> const &mods,
+										 std::list<CacheSetHelper::PkgModifier> const &mods,
 										 unsigned short const &fallback,
 										 unsigned short const &fallback,
 										 CacheSetHelper &helper) {
 										 CacheSetHelper &helper) {
 		std::map<unsigned short, PackageContainer> pkgsets;
 		std::map<unsigned short, PackageContainer> pkgsets;
 		for (const char **I = cmdline; *I != 0; ++I) {
 		for (const char **I = cmdline; *I != 0; ++I) {
 			unsigned short modID = fallback;
 			unsigned short modID = fallback;
 			PackageContainer pkgset;
 			PackageContainer pkgset;
-			PackageContainerInterface::FromModifierCommandLine(modID, &pkgset, Cache, *I, mods, helper);
+			helper.PackageFromModifierCommandLine(modID, &pkgset, Cache, *I, mods);
 			pkgsets[modID].insert(pkgset);
 			pkgsets[modID].insert(pkgset);
 		}
 		}
 		return pkgsets;
 		return pkgsets;
@@ -480,7 +520,7 @@ public:									/*{{{*/
 	static std::map<unsigned short, PackageContainer> GroupedFromCommandLine(
 	static std::map<unsigned short, PackageContainer> GroupedFromCommandLine(
 										 pkgCacheFile &Cache,
 										 pkgCacheFile &Cache,
 										 const char **cmdline,
 										 const char **cmdline,
-										 std::list<Modifier> const &mods,
+										 std::list<CacheSetHelper::PkgModifier> const &mods,
 										 unsigned short const &fallback) {
 										 unsigned short const &fallback) {
 		CacheSetHelper helper;
 		CacheSetHelper helper;
 		return GroupedFromCommandLine(Cache, cmdline,
 		return GroupedFromCommandLine(Cache, cmdline,