Просмотр исходного кода

More or group patches
Author: jgg
Date: 1999-10-02 04:14:53 GMT
More or group patches

Arch Librarian лет назад: 22
Родитель
Сommit
4b1b89c5fe
6 измененных файлов с 78 добавлено и 66 удалено
  1. 43 50
      apt-pkg/algorithms.cc
  2. 3 3
      apt-pkg/contrib/mmap.cc
  3. 21 10
      cmdline/apt-cache.cc
  4. 5 2
      debian/changelog
  5. 4 0
      doc/apt-cache.8.yo
  6. 2 1
      methods/cdrom.cc

+ 43 - 50
apt-pkg/algorithms.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: algorithms.cc,v 1.24 1999/09/30 06:30:34 jgg Exp $
+// $Id: algorithms.cc,v 1.25 1999/10/02 04:14:53 jgg Exp $
 /* ######################################################################
 
    Algorithms - A set of misc algorithms
@@ -524,10 +524,11 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg)
       pkgCache::DepIterator Start = D;
       pkgCache::DepIterator End = D;
       unsigned char State = 0;
-      for (bool LastOR = true; D.end() == false && LastOR == true; D++)
+      for (bool LastOR = true; D.end() == false && LastOR == true;)
       {
 	 State |= Cache[D];
 	 LastOR = (D->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or;
+	 D++;
 	 if (LastOR == true)
 	    End = D;
       }
@@ -535,52 +536,54 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg)
       // We only worry about critical deps.
       if (End.IsCritical() != true)
 	 continue;
-      
-      // Dep is ok
-      if ((Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall)
-	 continue;
-      
-      // Hm, the group is broken.. I have no idea how to handle this
-      if (Start != End)
-      {
-	 clog << "Note, a broken or group was found in " << Pkg.Name() << "." << endl;
-	 Fail = true;
-	 break;
-      }
-
-      // Do not change protected packages
-      PkgIterator P = Start.SmartTargetPkg();
-      if ((Flags[P->ID] & Protected) == Protected)
+            
+      // Iterate over all the members in the or group
+      while (1)
       {
-	 if (Debug == true)
-	    clog << "    Reinet Failed because of protected " << P.Name() << endl;
-	 Fail = true;
-	 break;
-      }      
+	 // Dep is ok now
+	 if ((Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall)
+	    break;
+	 
+	 // Do not change protected packages
+	 PkgIterator P = Start.SmartTargetPkg();
+	 if ((Flags[P->ID] & Protected) == Protected)
+	 {
+	    if (Debug == true)
+	       clog << "    Reinet Failed because of protected " << P.Name() << endl;
+	    Fail = true;
+	    break;
+	 }      
       
-      // Upgrade the package if the candidate version will fix the problem.
-      if ((Cache[Start] & pkgDepCache::DepCVer) == pkgDepCache::DepCVer)
-      {
-	 if (DoUpgrade(P) == false)
+	 // Upgrade the package if the candidate version will fix the problem.
+	 if ((Cache[Start] & pkgDepCache::DepCVer) == pkgDepCache::DepCVer)
+	 {
+	    if (DoUpgrade(P) == false)
+	    {
+	       if (Debug == true)
+		  clog << "    Reinst Failed because of " << P.Name() << endl;
+	       Fail = true;
+	       break;
+	    }	 
+	 }
+	 else
 	 {
+	    /* We let the algorithm deal with conflicts on its next iteration,
+	       it is much smarter than us */
+	    if (Start->Type == pkgCache::Dep::Conflicts)
+	       continue;
+	    
 	    if (Debug == true)
-	       clog << "    Reinst Failed because of " << P.Name() << endl;
+	       clog << "    Reinst Failed early because of " << Start.TargetPkg().Name() << endl;
 	    Fail = true;
 	    break;
-	 }	 
-      }
-      else
-      {
-	 /* We let the algorithm deal with conflicts on its next iteration,
-	    it is much smarter than us */
-	 if (End->Type == pkgCache::Dep::Conflicts)
-	    continue;
+	 }     
 	 
-	 if (Debug == true)
-	    clog << "    Reinst Failed early because of " << Start.TargetPkg().Name() << endl;
-	 Fail = true;
+	 if (Start == End)
+	    break;
+	 Start++;
+      }
+      if (Fail == true)
 	 break;
-      }      
    }
    
    // Undo our operations - it might be smart to undo everything this did..
@@ -737,16 +740,6 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
 	    
 	    InOr = Start != End;
 	    
-	    // Hm, the group is broken.. I have no idea how to handle this
-/*	    if (Start != End)
-	    {
-	       if (Debug == true)
-		  clog << "Note, a broken or group was found in " << I.Name() << "." << endl;
-	       if ((Flags[I->ID] & Protected) != Protected)
-		  Cache.MarkDelete(I);
-	       break;
-	    }*/
-	    	    
 	    if (Debug == true)
 	       clog << "Package " << I.Name() << " has broken dep on " << Start.TargetPkg().Name() << endl;
 

+ 3 - 3
apt-pkg/contrib/mmap.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: mmap.cc,v 1.19 1999/08/30 04:20:26 jgg Exp $
+// $Id: mmap.cc,v 1.20 1999/10/02 04:14:54 jgg Exp $
 /* ######################################################################
    
    MMap Class - Provides 'real' mmap or a faked mmap using read().
@@ -117,7 +117,7 @@ bool MMap::Sync()
 #ifdef _POSIX_SYNCHRONIZED_IO   
    if ((Flags & ReadOnly) != ReadOnly)
       if (msync((char *)Base,iSize,MS_SYNC) != 0)
-	 return _error->Error("msync","Unable to write mmap");
+	 return _error->Errno("msync","Unable to write mmap");
 #endif   
    return true;
 }
@@ -134,7 +134,7 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop)
    unsigned long PSize = sysconf(_SC_PAGESIZE);
    if ((Flags & ReadOnly) != ReadOnly)
       if (msync((char *)Base+(int)(Start/PSize)*PSize,Stop - Start,MS_SYNC) != 0)
-	 return _error->Error("msync","Unable to write mmap");
+	 return _error->Errno("msync","Unable to write mmap");
 #endif   
    return true;
 }

+ 21 - 10
cmdline/apt-cache.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: apt-cache.cc,v 1.37 1999/07/15 03:15:49 jgg Exp $
+// $Id: apt-cache.cc,v 1.38 1999/10/02 04:14:54 jgg Exp $
 /* ######################################################################
    
    apt-cache - Manages the cache files
@@ -379,7 +379,7 @@ bool DumpAvail(CommandLine &Cmd)
    return true;
 }
 									/*}}}*/
-// Depends - Print out a dependency tree					/*{{{*/
+// Depends - Print out a dependency tree				/*{{{*/
 // ---------------------------------------------------------------------
 /* */
 bool Depends(CommandLine &CmdL)
@@ -672,6 +672,7 @@ int main(int argc,const char *argv[])
       {'q',"quiet","quiet",CommandLine::IntLevel},
       {'i',"important","APT::Cache::Important",0},
       {'f',"full","APT::Cache::ShowFull",0},
+      {'g',"no-generate","APT::Cache::NoGenerate",0},
       {0,"names-only","APT::Cache::NamesOnly",0},
       {'c',"config-file",0,CommandLine::ConfigFile},
       {'o',"option",0,CommandLine::ArbItem},
@@ -712,14 +713,24 @@ int main(int argc,const char *argv[])
       _config->Set("quiet","1");
 
    if (CmdL.DispatchArg(CmdsA,false) == false && _error->PendingError() == false)
-   {      
-      // Open the cache file
-      pkgSourceList List;
-      List.ReadMainList();
-
-      // Generate it and map it
-      OpProgress Prog;
-      MMap *Map = pkgMakeStatusCacheMem(List,Prog);
+   { 
+      MMap *Map;
+      if (_config->FindB("APT::Cache::NoGenerate",false) == true)
+      {
+	 Map = new MMap(*new FileFd(_config->FindFile("Dir::Cache::pkgcache"),
+				    FileFd::ReadOnly),MMap::Public|MMap::ReadOnly);
+      }
+      else
+      {
+	 // Open the cache file
+	 pkgSourceList List;
+	 List.ReadMainList();
+	 
+	 // Generate it and map it
+	 OpProgress Prog;
+	 Map = pkgMakeStatusCacheMem(List,Prog);
+      }
+      
       if (_error->PendingError() == false)
       {
 	 pkgCache Cache(*Map);   

+ 5 - 2
debian/changelog

@@ -1,9 +1,12 @@
 apt (0.3.13.1) unstable; urgency=low
 
-  * Fix Perl or group pre-depends thing Closes: #46091, #46096, #46233
+  * Fix Perl or group pre-depends thing Closes: #46091, #46096, #46233, #45901
   * Fix handling of dpkg's conversions from < -> <= Closes: #46094
-  * Make unparsable priorities non-fatal Closes: #46266, #46267  
+  * Make unparsable priorities non-fatal Closes: #46266, #46267, #46293, #46298  
   * Fix handling of '/' for the dist name. Closes: #43830, #45640, #45692
+  * Fixed 'Method gave a blank filename' error from IMS queries onto CDs.
+    Closes: #45034, #45695
+  * Made OR group handling in the problem resolver more elaborate. Closes: #45646
   
  -- Jason Gunthorpe <jgg@debian.org>  Fri,  3 Sep 1999 09:04:28 -0700
  

+ 4 - 0
doc/apt-cache.8.yo

@@ -199,6 +199,10 @@ See bf(APT::Cache::Important).
 dit(bf(-f --full))
 Print full package records when searching. See bf(APT::Cache::ShowFull).
 
+dit(bf(-g --no-generate))
+Do not perform automatic package cache regeneration, use the cache as it is.
+See bf(APT::Cache::NoGenerate).
+
 dit(bf(--names-only))
 Only search on the package names, not the long description. See
 bf(APT::Cache::Names-Only).

+ 2 - 1
methods/cdrom.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: cdrom.cc,v 1.14 1999/08/08 03:34:08 jgg Exp $
+// $Id: cdrom.cc,v 1.15 1999/10/02 04:14:54 jgg Exp $
 /* ######################################################################
 
    CDROM URI method for APT
@@ -77,6 +77,7 @@ bool CDROMMethod::Fetch(FetchItem *Itm)
    {
       Res.LastModified = Itm->LastModified;
       Res.IMSHit = true;
+      Res.Filename = File;
       URIDone(Res);
       return true;
    }