]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/policy.cc
strip the Dir::state from the config name as it will never be there
[apt.git] / apt-pkg / policy.cc
index f05b6ca49b172f77eaaea684dc9f04a913f5d502..4e4077feb3a5dafcda09003ccb00ca0f3e790f66 100644 (file)
@@ -45,6 +45,8 @@ using namespace std;
    file matches the V0 policy engine. */
 pkgPolicy::pkgPolicy(pkgCache *Owner) : Pins(0), PFPriority(0), Cache(Owner)
 {
+   if (Owner == 0 || &(Owner->Head()) == 0)
+      return;
    PFPriority = new signed short[Owner->Head().PackageFileCount];
    Pins = new Pin[Owner->Head().PackageCount];
 
@@ -150,13 +152,6 @@ pkgCache::VerIterator pkgPolicy::GetCandidateVer(pkgCache::PkgIterator const &Pk
    {
       /* Lets see if this version is the installed version */
       bool instVer = (Pkg.CurrentVer() == Ver);
-      if (Ver.Pseudo() == true && instVer == false)
-      {
-        pkgCache::PkgIterator const allPkg = Ver.ParentPkg().Group().FindPkg("all");
-        if (allPkg->CurrentVer != 0 && allPkg.CurrentVer()->Hash == Ver->Hash &&
-            strcmp(allPkg.CurVersion(), Ver.VerStr()) == 0)
-           instVer = true;
-      }
 
       for (pkgCache::VerFileIterator VF = Ver.FileList(); VF.end() == false; VF++)
       {
@@ -274,6 +269,10 @@ signed short pkgPolicy::GetPriority(pkgCache::PkgIterator const &Pkg)
    }
    
    return 0;
+}
+signed short pkgPolicy::GetPriority(pkgCache::PkgFileIterator const &File)
+{
+   return PFPriority[File->ID];
 }
                                                                        /*}}}*/
 // PreferenceSection class - Overriding the default TrimRecord method  /*{{{*/