]> git.saurik.com Git - apt.git/commitdiff
Sync
authorArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:51:03 +0000 (16:51 +0000)
committerArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:51:03 +0000 (16:51 +0000)
Author: jgg
Date: 1998-10-08 04:54:58 GMT
Sync

apt-pkg/algorithms.cc
apt-pkg/algorithms.h
apt-pkg/contrib/cmndline.cc
apt-pkg/deb/debrecords.cc
apt-pkg/deb/debrecords.h
apt-pkg/pkgrecords.h
cmdline/apt-get.cc
doc/examples/apt.conf
doc/method.sgml

index 2e4ca5c2c635c1717d17ff0018b7eec334de66e8..126318b59a8f265c8d107cefd1ab801113312876 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: algorithms.cc,v 1.4 1998/10/02 04:39:42 jgg Exp $
+// $Id: algorithms.cc,v 1.5 1998/10/08 04:54:58 jgg Exp $
 /* ######################################################################
 
    Algorithms - A set of misc algorithms
@@ -197,7 +197,7 @@ bool pkgFixBroken(pkgDepCache &Cache)
    for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
       if (Cache[I].NowBroken() == true)
         Cache.MarkInstall(I,true);
-
+   
    /* Fix packages that are in a NeedArchive state but don't have a
       downloadable install version */
    for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
@@ -209,7 +209,7 @@ bool pkgFixBroken(pkgDepCache &Cache)
       if (Cache[I].InstVerIter(Cache).Downloadable() == false)
         continue;
 
-      Cache.MarkInstall(I,true);
+      Cache.MarkInstall(I,true);      
    }
    
    pkgProblemResolver Fix(Cache);
@@ -287,6 +287,43 @@ bool pkgAllUpgrade(pkgDepCache &Cache)
    return Fix.ResolveByKeep();
 }
                                                                        /*}}}*/
+// MinimizeUpgrade - Minimizes the set of packages to be upgraded      /*{{{*/
+// ---------------------------------------------------------------------
+/* This simply goes over the entire set of packages and tries to keep 
+   each package marked for upgrade. If a conflict is generated then 
+   the package is restored. */
+bool pkgMinimizeUpgrade(pkgDepCache &Cache)
+{   
+   if (Cache.BrokenCount() != 0)
+      return false;
+   
+   // We loop indefinately to get the minimal set size.
+   bool Change = false;
+   do
+   {
+      Change = false;
+      for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+      {
+        // Not interesting
+        if (Cache[I].Upgrade() == false || Cache[I].NewInstall() == true)
+           continue;
+        
+        // Keep it and see if that is OK
+        Cache.MarkKeep(I);
+        if (Cache.BrokenCount() != 0)
+           Cache.MarkInstall(I,false);
+        else
+           Change = true;
+      }      
+   }
+   while (Change == true);
+
+   if (Cache.BrokenCount() != 0)
+      return _error->Error("Internal Error in pkgMinimizeUpgrade");
+   
+   return true;
+}
+                                                                       /*}}}*/
 
 // ProblemResolver::pkgProblemResolver - Constructor                   /*{{{*/
 // ---------------------------------------------------------------------
index 0379357c21f631693af793e94cb2aaae215657f3..bd0a1f7bd8a58af470a38a911aa76d2010c0466c 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: algorithms.h,v 1.4 1998/10/02 04:39:43 jgg Exp $
+// $Id: algorithms.h,v 1.5 1998/10/08 04:54:59 jgg Exp $
 /* ######################################################################
 
    Algorithms - A set of misc algorithms
@@ -103,5 +103,6 @@ bool pkgDistUpgrade(pkgDepCache &Cache);
 bool pkgApplyStatus(pkgDepCache &Cache);
 bool pkgFixBroken(pkgDepCache &Cache);
 bool pkgAllUpgrade(pkgDepCache &Cache);
+bool pkgMinimizeUpgrade(pkgDepCache &Cache);
 
 #endif
index 8e25d395ffca517db5a39f3d8101e8127b45df6e..7f5ab59a5742394a0788f545d8be35f1767a5a89 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: cmndline.cc,v 1.2 1998/09/26 05:34:24 jgg Exp $
+// $Id: cmndline.cc,v 1.3 1998/10/08 04:55:01 jgg Exp $
 /* ######################################################################
 
    Command Line Class - Sophisticated command line parser
@@ -184,9 +184,17 @@ bool CommandLine::HandleOpt(int &I,int argc,const char *argv[],
         const char *J;
         for (J = Argument; *J != 0 && *J != '='; J++);
         if (*J == 0)
-           return _error->Error("Option %s: Configuration item sepecification must have an =.",argv[I]);
+           return _error->Error("Option %s: Configuration item sepecification must have an =<val>.",argv[I]);
 
-        Conf->Set(string(Argument,J-Argument),string(J+1));
+        // = is trailing
+        if (J[1] == 0)
+        {
+           if (I+1 >= argc)
+              return _error->Error("Option %s: Configuration item sepecification must have an =<val>.",argv[I]);
+           Conf->Set(string(Argument,J-Argument),string(argv[I++ +1]));
+        }
+        else
+           Conf->Set(string(Argument,J-Argument),string(J+1));
         
         return true;
       }
index ae0acce1870baf0357b27fc7c86ddefadb3a57ee..c28e11afbaf6ca1943b977a8d5a6520ef29158b8 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: debrecords.cc,v 1.1 1998/08/09 00:51:36 jgg Exp $
+// $Id: debrecords.cc,v 1.2 1998/10/08 04:55:02 jgg Exp $
 /* ######################################################################
    
    Debian Package Records - Parser for debian package records
@@ -30,3 +30,59 @@ bool debRecordParser::Jump(pkgCache::VerFileIterator &Ver)
    return Tags.Jump(Section,Ver->Offset);
 }
                                                                        /*}}}*/
+// RecordParser::FindTag - Locate a tag and return a string            /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+string debRecordParser::FindTag(const char *Tag)
+{
+   const char *Start;
+   const char *Stop;
+   if (Section.Find(Tag,Start,Stop) == false)
+      return string();
+   return string(Start,Stop - Start);
+}
+                                                                       /*}}}*/
+// RecordParser::FileName - Return the archive filename on the site    /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+string debRecordParser::FileName()
+{
+   return FindTag("Filename");
+}
+                                                                       /*}}}*/
+// RecordParser::MD5Hash - Return the archive hash                     /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+string debRecordParser::MD5Hash()
+{
+   return FindTag("MD5sum");
+}
+                                                                       /*}}}*/
+// RecordParser::Maintainer - Return the maintainer email              /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+string debRecordParser::Maintainer()
+{
+   return FindTag("Maintainer");
+}
+                                                                       /*}}}*/
+// RecordParser::ShortDesc - Return a 1 line description               /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+string debRecordParser::ShortDesc()
+{
+   string Res = FindTag("Description");
+   string::size_type Pos = Res.find('\n');
+   if (Pos == string::npos)
+      return Res;
+   return string(Res,0,Pos);
+}
+                                                                       /*}}}*/
+// RecordParser::LongDesc - Return a longer description                        /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+string debRecordParser::LongDesc()
+{
+   return string();
+}
+                                                                       /*}}}*/
index 0bd8da921f3bbabcce265878253074580fb6cfc7..6255d79edeeef6b26af503eec00fba20fc4c650a 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: debrecords.h,v 1.1 1998/08/09 00:51:36 jgg Exp $
+// $Id: debrecords.h,v 1.2 1998/10/08 04:55:04 jgg Exp $
 /* ######################################################################
    
    Debian Package Records - Parser for debian package records
@@ -26,10 +26,23 @@ class debRecordParser : public pkgRecords::Parser
 {
    pkgTagFile Tags;
    pkgTagSection Section;
+
+   string FindTag(const char *Tag);
+
+   protected:
+   
+   virtual bool Jump(pkgCache::VerFileIterator &Ver);
    
    public:
+
+   // These refer to the archive file for the Version
+   virtual string FileName();
+   virtual string MD5Hash();
    
-   virtual bool Jump(pkgCache::VerFileIterator &Ver);
+   // These are some general stats about the package
+   virtual string Maintainer();
+   virtual string ShortDesc();
+   virtual string LongDesc();
    
    debRecordParser(FileFd &File);
 };
index e129c65eb833c30f5030b031c707bb918c84cfbc..28cb728c61d6c9e2d6adf135f6715479793e5406 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: pkgrecords.h,v 1.1 1998/08/09 00:51:35 jgg Exp $
+// $Id: pkgrecords.h,v 1.2 1998/10/08 04:55:00 jgg Exp $
 /* ######################################################################
    
    Package Records - Allows access to complete package description records
@@ -49,7 +49,7 @@ class pkgRecords
 
    // Lookup function
    Parser &Lookup(pkgCache::VerFileIterator &Ver);
-      
+   
    // Construct destruct
    pkgRecords(pkgCache &Cache);
    ~pkgRecords();
@@ -57,10 +57,22 @@ class pkgRecords
 
 class pkgRecords::Parser
 {
-   public:
+   protected:
    
    virtual bool Jump(pkgCache::VerFileIterator &Ver) = 0;
    
+   public:
+   friend pkgRecords;
+   
+   // These refer to the archive file for the Version
+   virtual string FileName() {return string();};
+   virtual string MD5Hash() {return string();};
+   
+   // These are some general stats about the package
+   virtual string Maintainer() {return string();};
+   virtual string ShortDesc() {return string();};
+   virtual string LongDesc() {return string();};
+      
    virtual ~Parser() {};
 };
 
index f3dd4205a17a152e189e3d35baf5665c73dfec55..14a65449c05c82efcf612572528a0b7efd2782e1 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: apt-get.cc,v 1.1 1998/10/02 04:39:56 jgg Exp $
+// $Id: apt-get.cc,v 1.2 1998/10/08 04:55:05 jgg Exp $
 /* ######################################################################
    
    apt-get - Cover for dpkg
@@ -110,9 +110,22 @@ void ShowBroken(ostream &out,pkgDepCache &Cache)
            // Show a quick summary of the version requirements
            if (D.TargetVer() != 0)
               out << " (" << D.CompType() << " " << D.TargetVer() << 
-                  ")" << endl;
-           else
-              out << endl;
+                  ")";
+           
+           /* Show a summary of the target package if possible. In the case
+              of virtual packages we show nothing */
+           pkgCache::PkgIterator Targ = D.TargetPkg();
+           if (Targ->ProvidesList == 0)
+           {
+              out << " but ";
+              pkgCache::VerIterator Ver = Cache[Targ].InstVerIter(Cache);
+              if (Ver.end() == false)
+                 out << Ver.VerStr() << "is installed";
+              else
+                 out << "it is not installed";
+           }
+           
+           out << endl;
         }          
       }   
    }   
@@ -364,6 +377,8 @@ bool CacheFile::Open()
 
         return _error->Error("Unable to correct dependencies");
       }
+      if (pkgMinimizeUpgrade(*Cache) == false)
+        return _error->Error("Unable to minimize the upgrade set");
       
       c1out << " Done" << endl;
    }
index 0a6477c6e0c5fed3719ccbe48de4566726f1a9b7..9b96a30c5f2ec57c1b36c811113440e618bc6393 100644 (file)
@@ -1,4 +1,4 @@
-// $Id: apt.conf,v 1.1 1998/10/02 04:39:59 jgg Exp $
+// $Id: apt.conf,v 1.2 1998/10/08 04:55:07 jgg Exp $
 /* This file is an index of all APT configuration directives. It should
    NOT actually be used as a real config file, though it is a completely
    valid file.
@@ -43,5 +43,5 @@ DSelect {
 }
 
 Debug {
-  pkgProblemResolver "true";
+  pkgProblemResolver "false";
 }
index f5b21786d748ad6509b6c8c3e41a19a2a51eb834..023bac40ebdc09b08f6af304e257c8ef9f631de5 100644 (file)
@@ -4,7 +4,7 @@
 <title>APT Method Interface </title>
 
 <author>Jason Gunthorpe <email>jgg@debian.org</email></author>
-<version>$Id: method.sgml,v 1.2 1998/10/06 05:24:20 jgg Exp $</version>
+<version>$Id: method.sgml,v 1.3 1998/10/08 04:55:06 jgg Exp $</version>
 
 <abstract>
 This document describes the interface that APT uses to the archive
@@ -32,7 +32,7 @@ For more details, on Debian GNU/Linux systems, see the file
 <sect>General
 
 <p>
-The APT method interface allows APT to aquire archive files (.deb), index
+The APT method interface allows APT to acquire archive files (.deb), index
 files (Packages, Revision, Mirrors) and source files (.tar.gz, .diff). It
 is a general, extensible system designed to satisfy all of these
 requirements:
@@ -108,9 +108,9 @@ communication lines. The first line should have the form xxx TAG
 where xxx are digits forming the status code and TAG is an informational
 string
 
-<tag>aquire<item>
+<tag>acquire<item>
 The act of bring a URI into the local pathname space. This may simply
-be verifiying the existance of the URI or actually downloading it from
+be verifiying the existence of the URI or actually downloading it from
 a remote site.
 
 </taglist>
@@ -164,14 +164,14 @@ status code is an informational string provided for visual debugging.
 <item>100 Capabilities - Method capabilities
 <item>101 Log - General Logging
 <item>102 Status - Inter-URI status reporting (login progress)
-<item>200 URI Start - URI is starting aquire
-<item>201 URI Done - URI is finished aquire
-<item>400 URI Failure - URI has failed to aquire
+<item>200 URI Start - URI is starting acquire
+<item>201 URI Done - URI is finished acquire
+<item>400 URI Failure - URI has failed to acquire
 <item>401 General Failure - Method did not like something sent to it
 <item>402 Authorization Required - Method requires authorization
         to access the URI. Authorization is User/Pass
 <item>403 Media Failure - Method requires a media change       
-<item>600 URI Aquire - Request a URI be aquired
+<item>600 URI Acquire - Request a URI be acquired
 <item>601 Configuration - Sends the configuration space
 <item>602 Authorization Credentials - Response to the 402 message
 <item>603 Media Changed - Response to the 403 message
@@ -187,10 +187,10 @@ capable of handling an unlimited number of 600 messages.
 <p>
 The flow of messages starts with the method sending out a 
 <em>100 Capabilities</> and APT sending out a <em>601 Configuration</>.
-After that APT begins sending <em>600 URI Aquire</> and the method
+After that APT begins sending <em>600 URI Acquire</> and the method
 sends out <em>200 URI Start</>, <em>201 URI Done</> or 
 <em>400 URI Failure</>. No syncronization is performed, it is expected
-that APT will send <em>600 URI Aquire</> messages at -any- time and
+that APT will send <em>600 URI Acquire</> messages at -any- time and
 that the method should queue the messages. This allows methods like http
 to pipeline requests to the remote server. It should be noted however
 that APT will buffer messages so it is not neccessary for the method
@@ -284,10 +284,10 @@ A method that deals with multiple media requires that a new media be inserted.
 The Media field contains the name of the media to be inserted.
 Fields: Media
 
-<tag>600 URI Aquire<item>
-APT is requesting that a new URI be added to the aquire list. Last-Modified
+<tag>600 URI Acquire<item>
+APT is requesting that a new URI be added to the acquire list. Last-Modified
 has the time stamp of the currently cache file if applicable. Filename
-is the name of the file that the aquired URI should be written to.
+is the name of the file that the acquired URI should be written to.
 Fields: URI, Filename Last-Modified
 
 <tag>601 Configuration<item>