Przeglądaj źródła

More ignoring of versionless packages
Author: jgg
Date: 2001-05-27 05:36:04 GMT
More ignoring of versionless packages

Arch Librarian 22 lat temu
rodzic
commit
e7b470eefa

+ 2 - 2
apt-pkg/contrib/strutl.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: strutl.cc,v 1.39 2001/05/27 05:19:30 jgg Exp $
+// $Id: strutl.cc,v 1.40 2001/05/27 05:36:04 jgg Exp $
 /* ######################################################################
 
    String Util - Some useful string functions.
@@ -877,7 +877,7 @@ void ioprintf(ostream &out,const char *format,...)
    // sprintf the description
    char S[400];
    vsnprintf(S,sizeof(S),format,args);
-   // std::ostream::operator <<(out, (const char *)S);
+   out << S;
 }
 									/*}}}*/
 

+ 5 - 3
apt-pkg/deb/deblistparser.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: deblistparser.cc,v 1.24 2001/02/20 07:03:17 jgg Exp $
+// $Id: deblistparser.cc,v 1.25 2001/05/27 05:36:04 jgg Exp $
 /* ######################################################################
    
    Package Cache Generator - Generator for the cache structure.
@@ -16,6 +16,8 @@
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/crc-16.h>
 
+#include <ctype.h>
+
 #include <system.h>
 									/*}}}*/
 
@@ -409,7 +411,7 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop,
 	    if (End == Stop) 
 	       return 0;
 	    
-	    if (stringcmp(I,End,arch.begin(),arch.end()) == 0)
+	    if (stringcmp(arch.c_str(),arch.c_str()+arch.length(),I,End) == 0)
 	       Found = true;
 	    
 	    if (*End++ == ']') {
@@ -536,7 +538,7 @@ bool debListParser::Step()
       if (Section.Find("Architecture",Start,Stop) == false)
 	 return true;
 
-      if (stringcmp(Start,Stop,Arch.begin(),Arch.end()) == 0)
+      if (stringcmp(Arch.c_str(),Arch.c_str()+Arch.length(),Start,Stop) == 0)
 	 return true;
 
       if (stringcmp(Start,Stop,"all") == 0)

+ 4 - 1
apt-pkg/depcache.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: depcache.cc,v 1.24 2001/04/25 06:17:00 jgg Exp $
+// $Id: depcache.cc,v 1.25 2001/05/27 05:36:04 jgg Exp $
 /* ######################################################################
 
    Dependency Cache - Caches Dependency information.
@@ -182,6 +182,9 @@ void pkgDepCache::AddSizes(const PkgIterator &Pkg,signed long Mult)
 {
    StateCache &P = PkgState[Pkg->ID];
    
+   if (Pkg->VersionList == 0)
+      return;
+   
    if (Pkg.State() == pkgCache::PkgIterator::NeedsConfigure && 
        P.Keep() == true)
       return;

+ 5 - 1
apt-pkg/packagemanager.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: packagemanager.cc,v 1.27 2001/05/07 05:49:43 jgg Exp $
+// $Id: packagemanager.cc,v 1.28 2001/05/27 05:36:04 jgg Exp $
 /* ######################################################################
 
    Package Manager - Abstacts the package manager
@@ -138,6 +138,10 @@ bool pkgPackageManager::CreateOrderList()
    // Generate the list of affected packages and sort it
    for (PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
    {
+      // Ignore no-version packages
+      if (I->VersionList == 0)
+	 continue;
+      
       // Mark the package and its dependends for immediate configuration
       if (((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential ||
 	   (I->Flags & pkgCache::Flag::Important) == pkgCache::Flag::Important) &&

+ 11 - 8
apt-pkg/pkgcachegen.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: pkgcachegen.cc,v 1.47 2001/03/04 00:12:41 jgg Exp $
+// $Id: pkgcachegen.cc,v 1.48 2001/05/27 05:36:04 jgg Exp $
 /* ######################################################################
    
    Package Cache Generator - Generator for the cache structure.
@@ -27,13 +27,16 @@
 #include <apt-pkg/pkgsystem.h>
 
 #include <apti18n.h>
-    
+
+#include <vector>
+
 #include <sys/stat.h>
 #include <unistd.h>
 #include <errno.h>
 #include <stdio.h>
 #include <system.h>
 									/*}}}*/
+typedef vector<pkgIndexFile *>::iterator FileIterator;
 
 // CacheGenerator::pkgCacheGenerator - Constructor			/*{{{*/
 // ---------------------------------------------------------------------
@@ -131,7 +134,7 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
       int Res = 1;
       for (; Ver.end() == false; Last = &Ver->NextVer, Ver++)
       {
-	 Res = Cache.VS->DoCmpVersion(Version.begin(),Version.end(),Ver.VerStr(),
+	 Res = Cache.VS->DoCmpVersion(Version.c_str(),Version.c_str()+Version.length(),Ver.VerStr(),
 				 Ver.VerStr() + strlen(Ver.VerStr()));
 	 if (Res >= 0)
 	    break;
@@ -163,7 +166,7 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
       {
 	 for (; Ver.end() == false; Last = &Ver->NextVer, Ver++)
 	 {
-	    Res = Cache.VS->DoCmpVersion(Version.begin(),Version.end(),Ver.VerStr(),
+	    Res = Cache.VS->DoCmpVersion(Version.c_str(),Version.c_str()+Version.length(),Ver.VerStr(),
 				    Ver.VerStr() + strlen(Ver.VerStr()));
 	    if (Res != 0)
 	       break;
@@ -470,8 +473,8 @@ unsigned long pkgCacheGenerator::WriteUniqString(const char *S,
 /* This just verifies that each file in the list of index files exists,
    has matching attributes with the cache and the cache does not have
    any extra files. */
-static bool CheckValidity(string CacheFile,pkgIndexFile **Start,
-			  pkgIndexFile **End,MMap **OutMap = 0)
+static bool CheckValidity(string CacheFile, FileIterator Start, 
+                          FileIterator End,MMap **OutMap = 0)
 {
    // No file, certainly invalid
    if (CacheFile.empty() == true || FileExists(CacheFile) == false)
@@ -530,7 +533,7 @@ static bool CheckValidity(string CacheFile,pkgIndexFile **Start,
 // ---------------------------------------------------------------------
 /* Size is kind of an abstract notion that is only used for the progress
    meter */
-static unsigned long ComputeSize(pkgIndexFile **Start,pkgIndexFile **End)
+static unsigned long ComputeSize(FileIterator Start,FileIterator End)
 {
    unsigned long TotalSize = 0;
    for (; Start != End; Start++)
@@ -548,7 +551,7 @@ static unsigned long ComputeSize(pkgIndexFile **Start,pkgIndexFile **End)
 static bool BuildCache(pkgCacheGenerator &Gen,
 		       OpProgress &Progress,
 		       unsigned long &CurrentSize,unsigned long TotalSize,
-		       pkgIndexFile **Start,pkgIndexFile **End)
+		       FileIterator Start, FileIterator End)
 {
    for (; Start != End; Start++)
    {

+ 22 - 7
apt-pkg/policy.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: policy.cc,v 1.6 2001/04/29 05:13:51 jgg Exp $
+// $Id: policy.cc,v 1.7 2001/05/27 05:36:04 jgg Exp $
 /* ######################################################################
 
    Package Version Policy implementation
@@ -34,8 +34,12 @@
 #include <apt-pkg/sptr.h>
     
 #include <apti18n.h>
+
+#include <iostream>
 									/*}}}*/
 
+using namespace std;
+
 // Policy::Init - Startup and bind to a cache				/*{{{*/
 // ---------------------------------------------------------------------
 /* Set the defaults for operation. The default mode with no loaded policy
@@ -117,7 +121,7 @@ pkgCache::VerIterator pkgPolicy::GetCandidateVer(pkgCache::PkgIterator Pkg)
    // Look for a package pin and evaluate it.
    signed Max = GetPriority(Pkg);
    pkgCache::VerIterator Pref = GetMatch(Pkg);
-      
+
    /* Falling through to the default version.. Setting Max to zero
       effectively excludes everything <= 0 which are the non-automatic
       priorities.. The status file is given a prio of 100 which will exclude
@@ -164,7 +168,9 @@ pkgCache::VerIterator pkgPolicy::GetCandidateVer(pkgCache::PkgIterator Pkg)
 	    break;
       }            
    }
-   
+
+   if (Pref.end() == true)
+      return Pkg.VersionList();
    return Pref;
 }
 									/*}}}*/
@@ -181,7 +187,10 @@ void pkgPolicy::CreatePin(pkgVersionMatch::MatchType Type,string Name,
    Pin *P = 0;
    
    if (Name.empty() == true)
-      P = Defaults.insert(Defaults.end());
+      // tausq:g++v3 begin
+	;
+      // P = Defaults.insert(Defaults.end());
+      // tausq:g++v3 end
    else
    {
       // Get a spot to put the pin
@@ -191,10 +200,16 @@ void pkgPolicy::CreatePin(pkgVersionMatch::MatchType Type,string Name,
 	 for (vector<PkgPin>::iterator I = Unmatched.begin(); 
 	      I != Unmatched.end() && P == 0; I++)
 	    if (I->Pkg == Name)
-	       P = I;
+               // tausq:g++-v3 begin
+	       P = &(*I);
+	       // P = I;
+               // tausq:g++-v3 end
 	 
 	 if (P == 0)
-	    P = Unmatched.insert(Unmatched.end());      
+            // tausq:g++v3 begin
+            ;
+	    // P = Unmatched.insert(Unmatched.end());      
+            // tausq:g++v3 end
       }
       else
       {
@@ -217,7 +232,7 @@ pkgCache::VerIterator pkgPolicy::GetMatch(pkgCache::PkgIterator Pkg)
    if (PPkg.Type != pkgVersionMatch::None)
    {
       pkgVersionMatch Match(PPkg.Data,PPkg.Type);
-	 return Match.Find(Pkg);
+      return Match.Find(Pkg);
    }
    return pkgCache::VerIterator(*Pkg.Cache());
 }