summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/cachefile.h8
-rw-r--r--apt-pkg/cacheset.cc11
-rw-r--r--apt-pkg/orderlist.cc3
-rw-r--r--apt-pkg/packagemanager.cc3
4 files changed, 18 insertions, 7 deletions
diff --git a/apt-pkg/cachefile.h b/apt-pkg/cachefile.h
index 63bc3de47..09d3ec267 100644
--- a/apt-pkg/cachefile.h
+++ b/apt-pkg/cachefile.h
@@ -20,10 +20,9 @@
#include <apt-pkg/depcache.h>
#include <apt-pkg/acquire.h>
+#include <apt-pkg/policy.h>
#include <apt-pkg/sourcelist.h>
-class pkgPolicy;
-class pkgSourceList;
class pkgCacheFile
{
protected:
@@ -65,6 +64,11 @@ class pkgCacheFile
inline pkgPolicy* GetPolicy() { BuildPolicy(); return Policy; };
inline pkgSourceList* GetSourceList() { BuildSourceList(); return SrcList; };
+ inline bool IsPkgCacheBuilt() const { return (Cache != NULL); };
+ inline bool IsDepCacheBuilt() const { return (DCache != NULL); };
+ inline bool IsPolicyBuilt() const { return (Policy != NULL); };
+ inline bool IsSrcListBuilt() const { return (SrcList != NULL); };
+
pkgCacheFile();
virtual ~pkgCacheFile();
};
diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc
index 43ade4b4e..e91b56997 100644
--- a/apt-pkg/cacheset.cc
+++ b/apt-pkg/cacheset.cc
@@ -261,9 +261,14 @@ bool VersionSet::AddSelectedVersion(pkgCacheFile &Cache, VersionSet &verset,
// getCandidateVer - Returns the candidate version of the given package /*{{{*/
pkgCache::VerIterator VersionSet::getCandidateVer(pkgCacheFile &Cache,
pkgCache::PkgIterator const &Pkg, bool const &AllowError) {
- if (unlikely(Cache.BuildDepCache() == false))
- return pkgCache::VerIterator(*Cache);
- pkgCache::VerIterator Cand = Cache[Pkg].CandidateVerIter(Cache);
+ pkgCache::VerIterator Cand;
+ if (Cache.IsDepCacheBuilt() == true)
+ Cand = Cache[Pkg].CandidateVerIter(Cache);
+ else {
+ if (unlikely(Cache.BuildPolicy() == false))
+ return pkgCache::VerIterator(*Cache);
+ Cand = Cache.GetPolicy()->GetCandidateVer(Pkg);
+ }
if (AllowError == false && Cand.end() == true)
_error->Error(_("Can't select candidate version from package %s as it has no candidate"), Pkg.FullName(true).c_str());
return Cand;
diff --git a/apt-pkg/orderlist.cc b/apt-pkg/orderlist.cc
index 7c950292a..55f9cb9cc 100644
--- a/apt-pkg/orderlist.cc
+++ b/apt-pkg/orderlist.cc
@@ -117,7 +117,8 @@ bool pkgOrderList::IsMissing(PkgIterator Pkg)
return false;
// Skip Packages that need configure only.
- if (Pkg.State() == pkgCache::PkgIterator::NeedsConfigure &&
+ if ((Pkg.State() == pkgCache::PkgIterator::NeedsConfigure ||
+ Pkg.State() == pkgCache::PkgIterator::NeedsNothing) &&
Cache[Pkg].Keep() == true)
return false;
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index eef79cccd..49776aac7 100644
--- a/apt-pkg/packagemanager.cc
+++ b/apt-pkg/packagemanager.cc
@@ -602,7 +602,8 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg)
// configured we don't need to unpack it again…
PkgIterator const P = Pkg.Group().FindPkg("all");
if (List->IsFlag(P,pkgOrderList::UnPacked) != true &&
- List->IsFlag(P,pkgOrderList::Configured) != true) {
+ List->IsFlag(P,pkgOrderList::Configured) != true &&
+ P.State() != pkgCache::PkgIterator::NeedsNothing) {
if (SmartUnPack(P) == false)
return false;
}