diff options
author | Daniel Nicoletti <dantti12@gmail.com> | 2012-04-17 05:40:11 -0300 |
---|---|---|
committer | Daniel Nicoletti <dantti12@gmail.com> | 2012-04-17 05:40:11 -0300 |
commit | d06d7f591dc49a70ededff9e28cac9066796409c (patch) | |
tree | 182e60a6e79367f9eb0f21bb4a1d0f30888fa8e9 | |
parent | 8acfcf399aa9fb1acea1732f6872ea4dc2af4cfd (diff) |
aptcc: Fix supported filter
-rw-r--r-- | backends/aptcc/apt-intf.cpp | 37 | ||||
-rw-r--r-- | backends/aptcc/apt-intf.h | 2 |
2 files changed, 22 insertions, 17 deletions
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp index cbcbfcbff..43ef949c6 100644 --- a/backends/aptcc/apt-intf.cpp +++ b/backends/aptcc/apt-intf.cpp @@ -243,24 +243,29 @@ bool AptIntf::matchPackage(const pkgCache::VerIterator &ver, PkBitfield filters) } } - // TODO add Ubuntu handling if (pk_bitfield_contain(filters, PK_FILTER_ENUM_FREE)) { - if (!component.compare("contrib") || - !component.compare("non-free")) { + if (component.compare("main") != 0 && + component.compare("universe") != 0) { + // Must be in main and universe to be free return false; } } else if (pk_bitfield_contain(filters, PK_FILTER_ENUM_NOT_FREE)) { - if (component.compare("contrib") && - component.compare("non-free")) { + if (component.compare("main") == 0 || + component.compare("universe") == 0) { + // Must not be in main or universe to be free return false; } } // Check for supported packages if (pk_bitfield_contain(filters, PK_FILTER_ENUM_SUPPORTED)) { - return packageIsSupported(pkg, component); + if (!packageIsSupported(ver, component)) { + return false; + } } else if (pk_bitfield_contain(filters, PK_FILTER_ENUM_NOT_SUPPORTED)) { - return !packageIsSupported(pkg, component); + if (packageIsSupported(ver, component)) { + return false; + } } // TODO test this one.. @@ -1334,17 +1339,17 @@ void AptIntf::emitPackageFiles(const gchar *pi) /** * Check if package is officially supported by the current distribution */ -bool AptIntf::packageIsSupported(const pkgCache::PkgIterator &pkgIter, string component) +bool AptIntf::packageIsSupported(const pkgCache::VerIterator &verIter, string component) { - const pkgCache::VerIterator &verIter = pkgIter.VersionList(); string origin; - if(!verIter.end()) { + if (!verIter.end()) { pkgCache::VerFileIterator vf = verIter.FileList(); origin = vf.File().Origin() == NULL ? "" : vf.File().Origin(); } - if (component.empty()) + if (component.empty()) { component = "main"; + } // Get a fetcher AcqPackageKitStatus Stat(this, m_backend, m_cancel); @@ -1354,11 +1359,11 @@ bool AptIntf::packageIsSupported(const pkgCache::PkgIterator &pkgIter, string co bool trusted = checkTrusted(fetcher, false); - if ((origin.compare ("Debian") == 0) || (origin.compare ("Ubuntu") == 0)) { - if ((component.compare ("main") == 0 || - component.compare ("restricted") == 0 || - component.compare ("unstable") == 0 || - component.compare ("testing") == 0) && trusted) { + if ((origin.compare("Debian") == 0) || (origin.compare("Ubuntu") == 0)) { + if ((component.compare("main") == 0 || + component.compare("restricted") == 0 || + component.compare("unstable") == 0 || + component.compare("testing") == 0) && trusted) { return true; } } diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h index a2edd5886..7594272cc 100644 --- a/backends/aptcc/apt-intf.h +++ b/backends/aptcc/apt-intf.h @@ -232,7 +232,7 @@ private: bool &m_cancel; bool checkTrusted(pkgAcquire &fetcher, bool simulating); - bool packageIsSupported(const pkgCache::PkgIterator &pkgIter, string component); + bool packageIsSupported(const pkgCache::VerIterator &verIter, string component); bool tryToInstall(const pkgCache::PkgIterator &constPkg, pkgDepCache &Cache, pkgProblemResolver &Fix, |