Ver código fonte

Bug fixes
Author: jgg
Date: 1999-09-30 06:30:34 GMT
Bug fixes

Arch Librarian 22 anos atrás
pai
commit
421c8d1099

+ 40 - 25
apt-pkg/algorithms.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: algorithms.cc,v 1.23 1999/07/30 02:54:25 jgg Exp $
+// $Id: algorithms.cc,v 1.24 1999/09/30 06:30:34 jgg Exp $
 /* ######################################################################
 /* ######################################################################
 
 
    Algorithms - A set of misc algorithms
    Algorithms - A set of misc algorithms
@@ -715,13 +715,18 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
 	 // Isolate the problem dependency
 	 // Isolate the problem dependency
 	 PackageKill KillList[100];
 	 PackageKill KillList[100];
 	 PackageKill *LEnd = KillList;
 	 PackageKill *LEnd = KillList;
-	 for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList(); D.end() == false;)
+	 bool InOr = false;
+	 pkgCache::DepIterator Start;
+	 pkgCache::DepIterator End;
+	 for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList();
+	      D.end() == false || InOr == true;)
 	 {
 	 {
 	    // Compute a single dependency element (glob or)
 	    // Compute a single dependency element (glob or)
-	    pkgCache::DepIterator Start;
-	    pkgCache::DepIterator End;
-	    D.GlobOr(Start,End);
-	    
+	    if (InOr == false)
+	       D.GlobOr(Start,End);
+	    else
+	       Start++;
+
 	    // We only worry about critical deps.
 	    // We only worry about critical deps.
 	    if (End.IsCritical() != true)
 	    if (End.IsCritical() != true)
 	       continue;
 	       continue;
@@ -730,25 +735,27 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
 	    if ((Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall)
 	    if ((Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall)
 	       continue;
 	       continue;
 	    
 	    
+	    InOr = Start != End;
+	    
 	    // Hm, the group is broken.. I have no idea how to handle this
 	    // Hm, the group is broken.. I have no idea how to handle this
-	    if (Start != End)
+/*	    if (Start != End)
 	    {
 	    {
 	       if (Debug == true)
 	       if (Debug == true)
 		  clog << "Note, a broken or group was found in " << I.Name() << "." << endl;
 		  clog << "Note, a broken or group was found in " << I.Name() << "." << endl;
 	       if ((Flags[I->ID] & Protected) != Protected)
 	       if ((Flags[I->ID] & Protected) != Protected)
 		  Cache.MarkDelete(I);
 		  Cache.MarkDelete(I);
 	       break;
 	       break;
-	    }
+	    }*/
 	    	    
 	    	    
 	    if (Debug == true)
 	    if (Debug == true)
-	       clog << "Package " << I.Name() << " has broken dep on " << End.TargetPkg().Name() << endl;
+	       clog << "Package " << I.Name() << " has broken dep on " << Start.TargetPkg().Name() << endl;
 
 
 	    /* Look across the version list. If there are no possible
 	    /* Look across the version list. If there are no possible
 	       targets then we keep the package and bail. This is necessary
 	       targets then we keep the package and bail. This is necessary
 	       if a package has a dep on another package that cant be found */
 	       if a package has a dep on another package that cant be found */
-	    pkgCache::Version **VList = End.AllTargets();
+	    pkgCache::Version **VList = Start.AllTargets();
 	    if (*VList == 0 && (Flags[I->ID] & Protected) != Protected &&
 	    if (*VList == 0 && (Flags[I->ID] & Protected) != Protected &&
-		End->Type != pkgCache::Dep::Conflicts && 
+		Start->Type != pkgCache::Dep::Conflicts && 
 		Cache[I].NowBroken() == false)
 		Cache[I].NowBroken() == false)
 	    {
 	    {
 	       Change = true;
 	       Change = true;
@@ -763,10 +770,10 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
 	       pkgCache::PkgIterator Pkg = Ver.ParentPkg();
 	       pkgCache::PkgIterator Pkg = Ver.ParentPkg();
 	    
 	    
 	       if (Debug == true)
 	       if (Debug == true)
-		  clog << "  Considering " << Pkg.Name() << ' ' << (int)Scores[Pkg->ID] << 
+		  clog << "  Considering " << Pkg.Name() << ' ' << (int)Scores[Pkg->ID] <<
 		  " as a solution to " << I.Name() << ' ' << (int)Scores[I->ID] << endl;
 		  " as a solution to " << I.Name() << ' ' << (int)Scores[I->ID] << endl;
 	       if (Scores[I->ID] <= Scores[Pkg->ID] ||
 	       if (Scores[I->ID] <= Scores[Pkg->ID] ||
-		   ((Cache[End] & pkgDepCache::DepGNow) == 0 &&
+		   ((Cache[Start] & pkgDepCache::DepNow) == 0 &&
 		    End->Type != pkgCache::Dep::Conflicts))
 		    End->Type != pkgCache::Dep::Conflicts))
 	       {
 	       {
 		  // Try a little harder to fix protected packages..
 		  // Try a little harder to fix protected packages..
@@ -783,17 +790,21 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
 		  if (Cache[I].InstBroken() == false)
 		  if (Cache[I].InstBroken() == false)
 		  {
 		  {
 		     if (Debug == true)
 		     if (Debug == true)
-			clog << "  Holding Back " << I.Name() << " rather than change " << End.TargetPkg().Name() << endl;
+			clog << "  Holding Back " << I.Name() << " rather than change " << Start.TargetPkg().Name() << endl;
 		  }		  
 		  }		  
 		  else
 		  else
-		  {
+		  {		     
 		     if (BrokenFix == false || DoUpgrade(I) == false)
 		     if (BrokenFix == false || DoUpgrade(I) == false)
 		     {
 		     {
-			if (Debug == true)
-			   clog << "  Removing " << I.Name() << " rather than change " << End.TargetPkg().Name() << endl;
-			Cache.MarkDelete(I);
-			if (Counter > 1)
-			   Scores[I->ID] = Scores[Pkg->ID];
+			// Consider other options
+			if (InOr == false)
+			{
+			   if (Debug == true)
+			      clog << "  Removing " << I.Name() << " rather than change " << Start.TargetPkg().Name() << endl;
+			   Cache.MarkDelete(I);
+			   if (Counter > 1)
+			      Scores[I->ID] = Scores[Pkg->ID];
+			}			
 		     }
 		     }
 		  }
 		  }
 		  		  
 		  		  
@@ -811,25 +822,25 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
 		  LEnd->Dep = End;
 		  LEnd->Dep = End;
 		  LEnd++;
 		  LEnd++;
 		  
 		  
-		  if (End->Type != pkgCache::Dep::Conflicts)
+		  if (Start->Type != pkgCache::Dep::Conflicts)
 		     break;
 		     break;
 	       }
 	       }
 	    }
 	    }
 
 
 	    // Hm, nothing can possibly satisify this dep. Nuke it.
 	    // Hm, nothing can possibly satisify this dep. Nuke it.
-	    if (VList[0] == 0 && End->Type != pkgCache::Dep::Conflicts &&
-		(Flags[I->ID] & Protected) != Protected)
+	    if (VList[0] == 0 && Start->Type != pkgCache::Dep::Conflicts &&
+		(Flags[I->ID] & Protected) != Protected && InOr == false)
 	    {
 	    {
 	       Cache.MarkKeep(I);
 	       Cache.MarkKeep(I);
 	       if (Cache[I].InstBroken() == false)
 	       if (Cache[I].InstBroken() == false)
 	       {
 	       {
 		  if (Debug == true)
 		  if (Debug == true)
-		     clog << "  Holding Back " << I.Name() << " because I can't find " << End.TargetPkg().Name() << endl;
+		     clog << "  Holding Back " << I.Name() << " because I can't find " << Start.TargetPkg().Name() << endl;
 	       }	       
 	       }	       
 	       else
 	       else
 	       {
 	       {
 		  if (Debug == true)
 		  if (Debug == true)
-		     clog << "  Removing " << I.Name() << " because I can't find " << End.TargetPkg().Name() << endl;
+		     clog << "  Removing " << I.Name() << " because I can't find " << Start.TargetPkg().Name() << endl;
 		  Cache.MarkDelete(I);
 		  Cache.MarkDelete(I);
 	       }
 	       }
 
 
@@ -837,6 +848,10 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
 	       Done = true;
 	       Done = true;
 	    }
 	    }
 	    
 	    
+	    // Try some more
+	    if (InOr == true)
+	       continue;
+	    
 	    delete [] VList;
 	    delete [] VList;
 	    if (Done == true)
 	    if (Done == true)
 	       break;
 	       break;

+ 40 - 1
apt-pkg/contrib/fileutl.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: fileutl.cc,v 1.30 1999/07/26 17:46:08 jgg Exp $
+// $Id: fileutl.cc,v 1.31 1999/09/30 06:30:34 jgg Exp $
 /* ######################################################################
 /* ######################################################################
    
    
    File Utilities
    File Utilities
@@ -150,6 +150,45 @@ string flNotFile(string File)
    return string(File,0,Res);
    return string(File,0,Res);
 }
 }
 									/*}}}*/
 									/*}}}*/
+// flNoLink - If file is a symlink then deref it			/*{{{*/
+// ---------------------------------------------------------------------
+/* If the name is not a link then the returned path is the input. */
+string flNoLink(string File)
+{
+   struct stat St;
+   if (lstat(File.c_str(),&St) != 0 || S_ISLNK(St.st_mode) == 0)
+      return File;
+   if (stat(File.c_str(),&St) != 0)
+      return File;
+   
+   /* Loop resolving the link. There is no need to limit the number of 
+      loops because the stat call above ensures that the symlink is not 
+      circular */
+   char Buffer[1024];
+   string NFile = File;
+   while (1)
+   {
+      // Read the link
+      int Res;
+      if ((Res = readlink(NFile.c_str(),Buffer,sizeof(Buffer))) <= 0 || 
+	  (unsigned)Res >= sizeof(Buffer))
+	  return File;
+      
+      // Append or replace the previous path
+      Buffer[Res] = 0;
+      if (Buffer[0] == '/')
+	 NFile = Buffer;
+      else
+	 NFile = flNotFile(NFile) + Buffer;
+      
+      // See if we are done
+      if (lstat(NFile.c_str(),&St) != 0)
+	 return File;
+      if (S_ISLNK(St.st_mode) == 0)
+	 return NFile;      
+   }   
+}
+									/*}}}*/
 // SetCloseExec - Set the close on exec flag				/*{{{*/
 // SetCloseExec - Set the close on exec flag				/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */

+ 2 - 1
apt-pkg/contrib/fileutl.h

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: fileutl.h,v 1.21 1999/07/26 17:46:08 jgg Exp $
+// $Id: fileutl.h,v 1.22 1999/09/30 06:30:34 jgg Exp $
 /* ######################################################################
 /* ######################################################################
    
    
    File Utilities
    File Utilities
@@ -83,5 +83,6 @@ bool ExecWait(int Pid,const char *Name,bool Reap = false);
 // File string manipulators
 // File string manipulators
 string flNotDir(string File);
 string flNotDir(string File);
 string flNotFile(string File);
 string flNotFile(string File);
+string flNoLink(string File);
 
 
 #endif
 #endif

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

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: deblistparser.cc,v 1.22 1999/07/30 02:54:25 jgg Exp $
+// $Id: deblistparser.cc,v 1.23 1999/09/30 06:30:34 jgg Exp $
 /* ######################################################################
 /* ######################################################################
    
    
    Package Cache Generator - Generator for the cache structure.
    Package Cache Generator - Generator for the cache structure.
@@ -88,7 +88,7 @@ bool debListParser::NewVersion(pkgCache::VerIterator Ver)
 	                     {"extra",pkgCache::State::Extra}};
 	                     {"extra",pkgCache::State::Extra}};
       if (GrabWord(string(Start,Stop-Start),PrioList,
       if (GrabWord(string(Start,Stop-Start),PrioList,
 		   _count(PrioList),Ver->Priority) == false)
 		   _count(PrioList),Ver->Priority) == false)
-	 return _error->Error("Malformed Priority line");
+	 Ver->Priority = pkgCache::State::Extra;
    }
    }
 
 
    if (ParseDepends(Ver,"Depends",pkgCache::Dep::Depends) == false)
    if (ParseDepends(Ver,"Depends",pkgCache::Dep::Depends) == false)
@@ -154,11 +154,18 @@ unsigned short debListParser::VersionHash()
 	 continue;
 	 continue;
       
       
       /* Strip out any spaces from the text, this undoes dpkgs reformatting
       /* Strip out any spaces from the text, this undoes dpkgs reformatting
-         of certain fields */
+         of certain fields. dpkg also has the rather interesting notion of
+         reformatting depends operators < -> <= */
       char *I = S;
       char *I = S;
       for (; Start != End; Start++)
       for (; Start != End; Start++)
+      {
 	 if (isspace(*Start) == 0)
 	 if (isspace(*Start) == 0)
 	    *I++ = tolower(*Start);
 	    *I++ = tolower(*Start);
+	 if (*Start == '<' && Start[1] != '<' && Start[1] != '=')
+	    *I++ = '=';
+	 if (*Start == '>' && Start[1] != '>' && Start[1] != '=')
+	    *I++ = '=';
+      }
       
       
       Result = AddCRC16(Result,S,I - S);
       Result = AddCRC16(Result,S,I - S);
    }
    }

+ 21 - 10
apt-pkg/packagemanager.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: packagemanager.cc,v 1.20 1999/08/12 05:59:54 jgg Exp $
+// $Id: packagemanager.cc,v 1.21 1999/09/30 06:30:34 jgg Exp $
 /* ######################################################################
 /* ######################################################################
 
 
    Package Manager - Abstacts the package manager
    Package Manager - Abstacts the package manager
@@ -414,12 +414,17 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg)
    /* See if this packages install version has any predependencies
    /* See if this packages install version has any predependencies
       that are not met by 'now' packages. */
       that are not met by 'now' packages. */
    for (DepIterator D = Cache[Pkg].InstVerIter(Cache).DependsList(); 
    for (DepIterator D = Cache[Pkg].InstVerIter(Cache).DependsList(); 
-	D.end() == false; D++)
+	D.end() == false; )
    {
    {
-      if (D->Type == pkgCache::Dep::PreDepends)
+      // Compute a single dependency element (glob or)
+      pkgCache::DepIterator Start;
+      pkgCache::DepIterator End;
+      D.GlobOr(Start,End);
+      
+      while (End->Type == pkgCache::Dep::PreDepends)
       {
       {
 	 // Look for possible ok targets.
 	 // Look for possible ok targets.
-	 Version **VList = D.AllTargets();
+	 Version **VList = Start.AllTargets();
 	 bool Bad = true;
 	 bool Bad = true;
 	 for (Version **I = VList; *I != 0 && Bad == true; I++)
 	 for (Version **I = VList; *I != 0 && Bad == true; I++)
 	 {
 	 {
@@ -450,18 +455,24 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg)
 	 }
 	 }
 	 
 	 
 	 delete [] VList;
 	 delete [] VList;
-	 
-	 if (Bad == true)
-	    return _error->Error("Internal Error, Couldn't configure a pre-depend");
 
 
-	 continue;
+	 /* If this or element did not match then continue on to the
+	    next or element until a matching element is found*/
+	 if (Bad == true)
+	 {	    
+	    if (Start == End)
+	       return _error->Error("Internal Error, Couldn't configure a pre-depend");
+	    Start++;
+	 }
+	 else
+	    break;
       }
       }
       
       
-      if (D->Type == pkgCache::Dep::Conflicts)
+      if (End->Type == pkgCache::Dep::Conflicts)
       {
       {
 	 /* Look for conflicts. Two packages that are both in the install
 	 /* Look for conflicts. Two packages that are both in the install
 	    state cannot conflict so we don't check.. */
 	    state cannot conflict so we don't check.. */
-	 Version **VList = D.AllTargets();
+	 Version **VList = End.AllTargets();
 	 for (Version **I = VList; *I != 0; I++)
 	 for (Version **I = VList; *I != 0; I++)
 	 {
 	 {
 	    VerIterator Ver(Cache,*I);
 	    VerIterator Ver(Cache,*I);

+ 5 - 1
apt-pkg/sourcelist.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: sourcelist.cc,v 1.15 1999/09/09 06:15:51 jgg Exp $
+// $Id: sourcelist.cc,v 1.16 1999/09/30 06:30:34 jgg Exp $
 /* ######################################################################
 /* ######################################################################
 
 
    List of Sources
    List of Sources
@@ -172,6 +172,8 @@ string pkgSourceList::Item::PackagesURI() const
       {
       {
 	 if (Dist != "/")
 	 if (Dist != "/")
 	    Res = URI + Dist;
 	    Res = URI + Dist;
+	 else 
+	    Res = URI;
       }      
       }      
       else
       else
 	 Res = URI + "dists/" + Dist + '/' + Section +
 	 Res = URI + "dists/" + Dist + '/' + Section +
@@ -240,6 +242,8 @@ string pkgSourceList::Item::ReleaseURI() const
       {
       {
 	 if (Dist != "/")
 	 if (Dist != "/")
 	    Res = URI + Dist;
 	    Res = URI + Dist;
+	 else
+	    Res = URI;
       }      
       }      
       else
       else
 	 Res = URI + "dists/" + Dist + '/' + Section +
 	 Res = URI + "dists/" + Dist + '/' + Section +

+ 14 - 15
cmdline/apt-get.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: apt-get.cc,v 1.76 1999/09/16 02:08:09 jgg Exp $
+// $Id: apt-get.cc,v 1.77 1999/09/30 06:30:34 jgg Exp $
 /* ######################################################################
 /* ######################################################################
    
    
    apt-get - Cover for dpkg
    apt-get - Cover for dpkg
@@ -154,7 +154,7 @@ bool ShowList(ostream &out,string Title,string List)
 /* This prints out the names of all the packages that are broken along
 /* This prints out the names of all the packages that are broken along
    with the name of each each broken dependency and a quite version 
    with the name of each each broken dependency and a quite version 
    description. */
    description. */
-void ShowBroken(ostream &out,CacheFile &Cache)
+void ShowBroken(ostream &out,CacheFile &Cache,bool Now)
 {
 {
    out << "Sorry, but the following packages have unmet dependencies:" << endl;
    out << "Sorry, but the following packages have unmet dependencies:" << endl;
    for (unsigned J = 0; J < Cache->Head().PackageCount; J++)
    for (unsigned J = 0; J < Cache->Head().PackageCount; J++)
@@ -198,15 +198,14 @@ void ShowBroken(ostream &out,CacheFile &Cache)
 	    ")";
 	    ")";
 	 
 	 
 	 /* Show a summary of the target package if possible. In the case
 	 /* Show a summary of the target package if possible. In the case
-	  of virtual packages we show nothing */
-	 
+	    of virtual packages we show nothing */	 
 	 pkgCache::PkgIterator Targ = End.TargetPkg();
 	 pkgCache::PkgIterator Targ = End.TargetPkg();
 	 if (Targ->ProvidesList == 0)
 	 if (Targ->ProvidesList == 0)
 	 {
 	 {
 	    out << " but ";
 	    out << " but ";
 	    pkgCache::VerIterator Ver = Cache[Targ].InstVerIter(Cache);
 	    pkgCache::VerIterator Ver = Cache[Targ].InstVerIter(Cache);
 	    if (Ver.end() == false)
 	    if (Ver.end() == false)
-	       out << Ver.VerStr() << " is installed";
+	       out << Ver.VerStr() << (Now?" is installed":" is to be installed");
 	    else
 	    else
 	    {
 	    {
 	       if (Cache[Targ].CandidateVerIter(Cache).end() == true)
 	       if (Cache[Targ].CandidateVerIter(Cache).end() == true)
@@ -217,7 +216,7 @@ void ShowBroken(ostream &out,CacheFile &Cache)
 		     out << "it is a virtual package";
 		     out << "it is a virtual package";
 	       }		  
 	       }		  
 	       else
 	       else
-		  out << "it is not installed";
+		  out << (Now?"it is not installed":"it is not going to be installed");
 	    }	       
 	    }	       
 	 }
 	 }
 	 
 	 
@@ -467,7 +466,7 @@ bool CacheFile::CheckDeps(bool AllowBroken)
       if (pkgFixBroken(*Cache) == false || Cache->BrokenCount() != 0)
       if (pkgFixBroken(*Cache) == false || Cache->BrokenCount() != 0)
       {
       {
 	 c1out << " failed." << endl;
 	 c1out << " failed." << endl;
-	 ShowBroken(c1out,*this);
+	 ShowBroken(c1out,*this,true);
 
 
 	 return _error->Error("Unable to correct dependencies");
 	 return _error->Error("Unable to correct dependencies");
       }
       }
@@ -479,7 +478,7 @@ bool CacheFile::CheckDeps(bool AllowBroken)
    else
    else
    {
    {
       c1out << "You might want to run `apt-get -f install' to correct these." << endl;
       c1out << "You might want to run `apt-get -f install' to correct these." << endl;
-      ShowBroken(c1out,*this);
+      ShowBroken(c1out,*this,true);
 
 
       return _error->Error("Unmet dependencies. Try using -f.");
       return _error->Error("Unmet dependencies. Try using -f.");
    }
    }
@@ -522,7 +521,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,bool Saftey =
    // Sanity check
    // Sanity check
    if (Cache->BrokenCount() != 0)
    if (Cache->BrokenCount() != 0)
    {
    {
-      ShowBroken(c1out,Cache);
+      ShowBroken(c1out,Cache,false);
       return _error->Error("Internal Error, InstallPackages was called with broken packages!");
       return _error->Error("Internal Error, InstallPackages was called with broken packages!");
    }
    }
 
 
@@ -810,7 +809,7 @@ bool DoUpgrade(CommandLine &CmdL)
    // Do the upgrade
    // Do the upgrade
    if (pkgAllUpgrade(Cache) == false)
    if (pkgAllUpgrade(Cache) == false)
    {
    {
-      ShowBroken(c1out,Cache);
+      ShowBroken(c1out,Cache,false);
       return _error->Error("Internal Error, AllUpgrade broke stuff");
       return _error->Error("Internal Error, AllUpgrade broke stuff");
    }
    }
    
    
@@ -953,7 +952,7 @@ bool DoInstall(CommandLine &CmdL)
    if (BrokenFix == true && Cache->BrokenCount() != 0)
    if (BrokenFix == true && Cache->BrokenCount() != 0)
    {
    {
       c1out << "You might want to run `apt-get -f install' to correct these:" << endl;
       c1out << "You might want to run `apt-get -f install' to correct these:" << endl;
-      ShowBroken(c1out,Cache);
+      ShowBroken(c1out,Cache,false);
 
 
       return _error->Error("Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).");
       return _error->Error("Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).");
    }
    }
@@ -980,7 +979,7 @@ bool DoInstall(CommandLine &CmdL)
 
 
       c1out << "The following information may help to resolve the situation:" << endl;
       c1out << "The following information may help to resolve the situation:" << endl;
       c1out << endl;
       c1out << endl;
-      ShowBroken(c1out,Cache);
+      ShowBroken(c1out,Cache,false);
       return _error->Error("Sorry, broken packages");
       return _error->Error("Sorry, broken packages");
    }   
    }   
    
    
@@ -1027,7 +1026,7 @@ bool DoDistUpgrade(CommandLine &CmdL)
    if (pkgDistUpgrade(*Cache) == false)
    if (pkgDistUpgrade(*Cache) == false)
    {
    {
       c0out << "Failed" << endl;
       c0out << "Failed" << endl;
-      ShowBroken(c1out,Cache);
+      ShowBroken(c1out,Cache,false);
       return false;
       return false;
    }
    }
    
    
@@ -1095,7 +1094,7 @@ bool DoDSelectUpgrade(CommandLine &CmdL)
    
    
       if (Fix.Resolve() == false)
       if (Fix.Resolve() == false)
       {
       {
-	 ShowBroken(c1out,Cache);
+	 ShowBroken(c1out,Cache,false);
 	 return _error->Error("Internal Error, problem resolver broke stuff");
 	 return _error->Error("Internal Error, problem resolver broke stuff");
       }
       }
    }
    }
@@ -1103,7 +1102,7 @@ bool DoDSelectUpgrade(CommandLine &CmdL)
    // Now upgrade everything
    // Now upgrade everything
    if (pkgAllUpgrade(Cache) == false)
    if (pkgAllUpgrade(Cache) == false)
    {
    {
-      ShowBroken(c1out,Cache);
+      ShowBroken(c1out,Cache,false);
       return _error->Error("Internal Error, problem resolver broke stuff");
       return _error->Error("Internal Error, problem resolver broke stuff");
    }
    }
    
    

+ 1 - 1
configure.in

@@ -17,7 +17,7 @@ AC_CONFIG_AUX_DIR(buildlib)
 AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in)
 AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in)
 
 
 dnl -- SET THIS TO THE RELEASE VERSION --
 dnl -- SET THIS TO THE RELEASE VERSION --
-AC_DEFINE_UNQUOTED(VERSION,"0.3.12")
+AC_DEFINE_UNQUOTED(VERSION,"0.3.12.1")
 AC_DEFINE_UNQUOTED(PACKAGE,"apt")
 AC_DEFINE_UNQUOTED(PACKAGE,"apt")
 
 
 dnl Tom's host stuff
 dnl Tom's host stuff

+ 12 - 2
debian/changelog

@@ -1,10 +1,20 @@
+apt (0.3.13.1) unstable; urgency=low
+
+  * Fix Perl or group pre-depends thing Closes: #46091, #46096, #46233
+  * Fix handling of dpkg's conversions from < -> <= Closes: #46094
+  * Make unparsable priorities non-fatal Closes: #46266, #46267  
+  * Fix handling of '/' for the dist name. Closes: #43830, #45640, #45692
+  
+ -- Jason Gunthorpe <jgg@debian.org>  Fri,  3 Sep 1999 09:04:28 -0700
+ 
 apt (0.3.12.1) unstable; urgency=low
 apt (0.3.12.1) unstable; urgency=low
   
   
   * Fix timestamp miss in FTP. Closes: #44363
   * Fix timestamp miss in FTP. Closes: #44363
   * Fix sorting of Kept packages. Closes: #44377
   * Fix sorting of Kept packages. Closes: #44377
   * Fix Segfault for dselect-upgrade. Closes: #44436
   * Fix Segfault for dselect-upgrade. Closes: #44436
-  * Fix handling of '/' for the dist name. Closes #43830
-  * Added APT::Get::Diff-Only and Tar-Only options. Closes #44384
+  * Added APT::Get::Diff-Only and Tar-Only options. Closes: #44384
+  
+  * Fix dpkg-preexec. Closes: #44706
   
   
  -- Jason Gunthorpe <jgg@debian.org>  Fri,  3 Sep 1999 09:04:28 -0700
  -- Jason Gunthorpe <jgg@debian.org>  Fri,  3 Sep 1999 09:04:28 -0700
  
  

+ 8 - 2
test/makefile

@@ -13,11 +13,17 @@ include $(PROGRAM_H)
 
 
 # Scratch program to test incomplete code fragments in
 # Scratch program to test incomplete code fragments in
 PROGRAM=scratch-test
 PROGRAM=scratch-test
-SLIBS = -lapt-pkg 
-LIB_MAKES = apt-pkg/makefile
+SLIBS = -lapt-inst -lapt-pkg
+LIB_MAKES = apt-pkg/makefile apt-inst/makefile
 SOURCE = scratch.cc
 SOURCE = scratch.cc
 include $(PROGRAM_H)
 include $(PROGRAM_H)
 
 
+PROGRAM=testextract
+SLIBS = -lapt-inst -lapt-pkg
+LIB_MAKES = apt-pkg/makefile apt-inst/makefile
+SOURCE = testextract.cc
+include $(PROGRAM_H)
+
 # Version compare tester
 # Version compare tester
 PROGRAM=versiontest
 PROGRAM=versiontest
 SLIBS = -lapt-pkg 
 SLIBS = -lapt-pkg 

+ 85 - 66
test/scratch.cc

@@ -1,83 +1,102 @@
-#include <string>
-/*void basic_string<char,string_char_traits<char>,alloc>::Rep::release()
-{
-   cout << "Release " << (void *)this << ' ' << ref << endl;
-   if (--ref == 0) delete this;
-}
-
-basic_string<char,string_char_traits<char>,alloc>::~basic_string()
-{
-   cout << "Destroy " << (void *)this << ',' << rep()->ref << endl;
-   rep ()->release ();
-}*/
-
-
-
-#include <apt-pkg/tagfile.h>
-#include <apt-pkg/strutl.h>
-
-#include <apt-pkg/cachefile.h>
-#include <apt-pkg/pkgrecords.h>
+#include <apt-pkg/dpkgdb.h>
+#include <apt-pkg/debfile.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/progress.h>
+#include <apt-pkg/extract.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/init.h>
-
-#include <signal.h>
-#include <stdio.h>
-#include <malloc.h>
-
-struct Rep
-{
-   size_t len, res, ref;
-   bool selfish;
-};
+#include <apt-pkg/fileutl.h>
 
 
 int main(int argc,char *argv[])
 int main(int argc,char *argv[])
 {
 {
-   pkgCacheFile Cache;
-   OpProgress Prog;
    pkgInitialize(*_config);
    pkgInitialize(*_config);
-   if (Cache.Open(Prog,false) == false)
+
+   cout << flNoLink(argv[1]) << endl;
+   
+   #if 0
+/*   DynamicMMap *FileMap = new DynamicMMap(MMap::Public);
+   pkgFLCache *FList = new pkgFLCache(*FileMap);
+   
+   char *Name = "/tmp/test";
+   pkgFLCache::PkgIterator Pkg(*FList,0);
+   pkgFLCache::NodeIterator Node = FList->GetNode(Name,Name+strlen(Name),Pkg.Offset(),true,false);
+   cout << (pkgFLCache::Node *)Node << endl;
+   Node = FList->GetNode(Name,Name+strlen(Name),Pkg.Offset(),true,false);
+   cout << (pkgFLCache::Node *)Node << endl;
+*/
+//   #if 0
+   _config->Set("Dir::State::status","/tmp/testing/status");
+
+   debDpkgDB Db;
+   
+   {
+      OpTextProgress Prog;
+      
+      if (Db.ReadyPkgCache(Prog) == false)
+	 cerr << "Error!" << endl;
+      Prog.Done();
+      
+      if (Db.ReadyFileList(Prog) == false)
+	 cerr << "Error!" << endl;
+   }
+   
+   if (_error->PendingError() == true)
    {
    {
       _error->DumpErrors();
       _error->DumpErrors();
       return 0;
       return 0;
    }
    }
    
    
-   pkgRecords rec(*Cache);
-   while (1)
+/*   Db.GetFLCache().BeginDiverLoad();
+   pkgFLCache::PkgIterator Pkg(Db.GetFLCache(),0);
+   if (Db.GetFLCache().AddDiversion(Pkg,"/usr/include/linux/kerneld.h","/usr/bin/nslookup") == false)
+      cerr << "Error!" << endl;
+
+   const char *Tmp = "/usr/include/linux/kerneld.h";
+   pkgFLCache::NodeIterator Nde = Db.GetFLCache().GetNode(Tmp,Tmp+strlen(Tmp),0,false,false);
+   map_ptrloc Loc = Nde->File;
+      
+   for (; Nde.end() == false && Nde->File == Loc; Nde++)
+      cout << Nde->Flags << ',' << Nde->Pointer << ',' << Nde.File() << endl;
+   Db.GetFLCache().FinishDiverLoad();*/
+
+/*   unsigned int I = 0;
+   pkgFLCache &Fl = Db.GetFLCache();
+   while (I < Fl.HeaderP->HashSize)
+   {
+      cout << I << endl;
+      pkgFLCache::NodeIterator Node(Fl,Fl.NodeP + Fl.HeaderP->FileHash + I++);
+      if (Node->Pointer == 0)
+	 continue;
+      for (; Node.end() == false; Node++)
+      {
+	 cout << Node.DirN() << '/' << Node.File();
+	 if (Node->Flags == pkgFLCache::Node::Diversion)
+	    cout << " (div)";
+	 if (Node->Flags == pkgFLCache::Node::ConfFile)
+	    cout << " (conf)";
+	 cout << endl;
+      }
+   }*/
+
+   for (int I = 1; I < argc; I++)
    {
    {
-      pkgCache::VerIterator V = (*Cache)[Cache->PkgBegin()].CandidateVerIter(*Cache);
-      pkgRecords::Parser &Parse = rec.Lookup(V.FileList());
-      string Foo = Parse.ShortDesc();
+      FileFd F(argv[I],FileFd::ReadOnly);
+      debDebFile Deb(F);
       
       
-      cout << (reinterpret_cast<Rep *>(Foo.begin()) - 1)[0].ref << endl;
+      if (Deb.ExtractControl(Db) == false)
+	 cerr << "Error!" << endl;
+      cout << argv[I] << endl;
       
       
-//      cout << Foo << endl;
+      pkgCache::VerIterator Ver = Deb.MergeControl(Db);
+      if (Ver.end() == true)
+	 cerr << "Failed" << endl;
+      else
+	 cout << Ver.ParentPkg().Name() << ' ' << Ver.VerStr() << endl;
       
       
-//      cout << rec.Lookup(V.FileList()).ShortDesc() << endl;
-      malloc_stats();
+      pkgExtract Extract(Db.GetFLCache(),Ver);
+      Deb.ExtractArchive(Extract);
    }
    }
-   
-#if 0   
-   URI U(argv[1]);
-   cout << U.Access << endl;
-   cout << U.User << endl;
-   cout << U.Password << endl;
-   cout << U.Host << endl;
-   cout << U.Path << endl;
-   cout << U.Port << endl;
-      
-/*   
-   FileFd F(argv[1],FileFd::ReadOnly);
-   pkgTagFile Reader(F);
-   
-   pkgTagSection Sect;
-   while (Reader.Step(Sect) == true)
-   {
-      Sect.FindS("Package");
-      Sect.FindS("Section");
-      Sect.FindS("Version");
-      Sect.FindI("Size");
-   };*/
-#endif   
-   return 0;
+//   #endif
+#endif      
+   _error->DumpErrors();
 }
 }