diff options
-rw-r--r-- | apt-pkg/algorithms.cc | 43 | ||||
-rw-r--r-- | apt-pkg/algorithms.h | 3 | ||||
-rw-r--r-- | apt-pkg/contrib/cmndline.cc | 14 | ||||
-rw-r--r-- | apt-pkg/deb/debrecords.cc | 58 | ||||
-rw-r--r-- | apt-pkg/deb/debrecords.h | 17 | ||||
-rw-r--r-- | apt-pkg/pkgrecords.h | 18 | ||||
-rw-r--r-- | cmdline/apt-get.cc | 23 | ||||
-rw-r--r-- | doc/examples/apt.conf | 4 | ||||
-rw-r--r-- | doc/method.sgml | 26 |
9 files changed, 174 insertions, 32 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 2e4ca5c2..126318b5 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -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 /*{{{*/ // --------------------------------------------------------------------- diff --git a/apt-pkg/algorithms.h b/apt-pkg/algorithms.h index 0379357c..bd0a1f7b 100644 --- a/apt-pkg/algorithms.h +++ b/apt-pkg/algorithms.h @@ -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 diff --git a/apt-pkg/contrib/cmndline.cc b/apt-pkg/contrib/cmndline.cc index 8e25d395..7f5ab59a 100644 --- a/apt-pkg/contrib/cmndline.cc +++ b/apt-pkg/contrib/cmndline.cc @@ -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; } diff --git a/apt-pkg/deb/debrecords.cc b/apt-pkg/deb/debrecords.cc index ae0acce1..c28e11af 100644 --- a/apt-pkg/deb/debrecords.cc +++ b/apt-pkg/deb/debrecords.cc @@ -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(); +} + /*}}}*/ diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h index 0bd8da92..6255d79e 100644 --- a/apt-pkg/deb/debrecords.h +++ b/apt-pkg/deb/debrecords.h @@ -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); }; diff --git a/apt-pkg/pkgrecords.h b/apt-pkg/pkgrecords.h index e129c65e..28cb728c 100644 --- a/apt-pkg/pkgrecords.h +++ b/apt-pkg/pkgrecords.h @@ -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() {}; }; diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index f3dd4205..14a65449 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -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; } diff --git a/doc/examples/apt.conf b/doc/examples/apt.conf index 0a6477c6..9b96a30c 100644 --- a/doc/examples/apt.conf +++ b/doc/examples/apt.conf @@ -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"; } diff --git a/doc/method.sgml b/doc/method.sgml index f5b21786..023bac40 100644 --- a/doc/method.sgml +++ b/doc/method.sgml @@ -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> |