]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/depcache.cc
extend the magic which creates the test archive by using FileLists to
[apt.git] / apt-pkg / depcache.cc
index d082b8404075f98eb4b36e8a1ee825289db62c39..00bf68af11aa784197e7f87bfed23608bfa8b19e 100644 (file)
@@ -227,7 +227,7 @@ bool pkgDepCache::writeStateFile(OpProgress *prog, bool InstalledOnly)      /*{{{*/
    // if it does not exist, create a empty one
    if(!FileExists(state)) 
    {
-      StateFile.Open(state, FileFd::WriteEmpty);
+      StateFile.Open(state, FileFd::WriteAtomic);
       StateFile.Close();
    }
 
@@ -338,7 +338,7 @@ bool pkgDepCache::CheckDep(DepIterator Dep,int Type,PkgIterator &Res)
    /* Check simple depends. A depends -should- never self match but 
       we allow it anyhow because dpkg does. Technically it is a packaging
       bug. Conflicts may never self match */
-   if (Dep.TargetPkg() != Dep.ParentPkg() || 
+   if (Dep.TargetPkg()->Group != Dep.ParentPkg()->Group ||
        (Dep->Type != Dep::Conflicts && Dep->Type != Dep::DpkgBreaks && Dep->Type != Dep::Obsoletes))
    {
       PkgIterator Pkg = Dep.TargetPkg();
@@ -367,9 +367,9 @@ bool pkgDepCache::CheckDep(DepIterator Dep,int Type,PkgIterator &Res)
    PkgIterator Pkg = Dep.ParentPkg();
    for (; P.end() != true; P++)
    {
-      /* Provides may never be applied against the same package if it is
-         a conflicts. See the comment above. */
-      if (P.OwnerPkg() == Pkg &&
+      /* Provides may never be applied against the same package (or group)
+         if it is a conflicts. See the comment above. */
+      if (P.OwnerPkg()->Group == Pkg->Group &&
          (Dep->Type == Dep::Conflicts || Dep->Type == Dep::DpkgBreaks))
         continue;
       
@@ -1255,6 +1255,10 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
    Update(Pkg);
    AddSizes(Pkg);
 
+   // always trigger the install of the all package for a pseudo package
+   if (P.CandidateVerIter(*Cache).Pseudo() == true)
+      MarkInstall(Pkg.Group().FindPkg("all"), AutoInst, Depth, FromUser, ForceImportantDeps);
+
    if (AutoInst == false)
       return;
 
@@ -1421,10 +1425,13 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
            VerIterator Ver(*this,*I);
            PkgIterator Pkg = Ver.ParentPkg();
 
-           if (Start->Type != Dep::DpkgBreaks)
-              MarkDelete(Pkg,false,Depth + 1, false);
-           else if (PkgState[Pkg->ID].CandidateVer != *I)
+           
+              
+           if (PkgState[Pkg->ID].CandidateVer != *I &&
+               Start->Type == Dep::DpkgBreaks)
               MarkInstall(Pkg,true,Depth + 1, false, ForceImportantDeps);
+           else
+              MarkDelete(Pkg,false,Depth + 1, false);
         }
         continue;
       }      
@@ -1581,7 +1588,7 @@ const char *pkgDepCache::StateCache::StripEpoch(const char *Ver)
 // ---------------------------------------------------------------------
 /* The default just returns the highest available version that is not
    a source and automatic. */
-pkgCache::VerIterator pkgDepCache::Policy::GetCandidateVer(PkgIterator Pkg)
+pkgCache::VerIterator pkgDepCache::Policy::GetCandidateVer(PkgIterator const &Pkg)
 {
    /* Not source/not automatic versions cannot be a candidate version 
       unless they are already installed */
@@ -1616,7 +1623,7 @@ pkgCache::VerIterator pkgDepCache::Policy::GetCandidateVer(PkgIterator Pkg)
 // Policy::IsImportantDep - True if the dependency is important                /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-bool pkgDepCache::Policy::IsImportantDep(DepIterator Dep)
+bool pkgDepCache::Policy::IsImportantDep(DepIterator const &Dep)
 {
    if(Dep.IsCritical())
       return true;
@@ -1635,54 +1642,6 @@ bool pkgDepCache::Policy::IsImportantDep(DepIterator Dep)
    else if(Dep->Type == pkgCache::Dep::Suggests)
      return _config->FindB("APT::Install-Suggests", false);
 
-   return false;
-}
-                                                                       /*}}}*/
-pkgDepCache::DefaultRootSetFunc::DefaultRootSetFunc()                  /*{{{*/
-  : constructedSuccessfully(false)
-{
-  Configuration::Item const *Opts;
-  Opts = _config->Tree("APT::NeverAutoRemove");
-  if (Opts != 0 && Opts->Child != 0)
-    {
-      Opts = Opts->Child;
-      for (; Opts != 0; Opts = Opts->Next)
-       {
-         if (Opts->Value.empty() == true)
-           continue;
-
-         regex_t *p = new regex_t;
-         if(regcomp(p,Opts->Value.c_str(),
-                    REG_EXTENDED | REG_ICASE | REG_NOSUB) != 0)
-           {
-             regfree(p);
-             delete p;
-             _error->Error("Regex compilation error for APT::NeverAutoRemove");
-             return;
-           }
-
-         rootSetRegexp.push_back(p);
-       }
-    }
-
-  constructedSuccessfully = true;
-}
-                                                                       /*}}}*/
-pkgDepCache::DefaultRootSetFunc::~DefaultRootSetFunc()                 /*{{{*/
-{
-  for(unsigned int i = 0; i < rootSetRegexp.size(); i++)
-    {
-      regfree(rootSetRegexp[i]);
-      delete rootSetRegexp[i];
-    }
-}
-                                                                       /*}}}*/
-bool pkgDepCache::DefaultRootSetFunc::InRootSet(const pkgCache::PkgIterator &pkg) /*{{{*/
-{
-   for(unsigned int i = 0; i < rootSetRegexp.size(); i++)
-      if (regexec(rootSetRegexp[i], pkg.Name(), 0, 0, 0) == 0)
-        return true;
-
    return false;
 }
                                                                        /*}}}*/