// -*- 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
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++)
if (Cache[I].InstVerIter(Cache).Downloadable() == false)
continue;
- Cache.MarkInstall(I,true);
+ Cache.MarkInstall(I,true);
}
pkgProblemResolver Fix(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 /*{{{*/
// ---------------------------------------------------------------------
// -*- 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
bool pkgApplyStatus(pkgDepCache &Cache);
bool pkgFixBroken(pkgDepCache &Cache);
bool pkgAllUpgrade(pkgDepCache &Cache);
+bool pkgMinimizeUpgrade(pkgDepCache &Cache);
#endif
// -*- 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
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;
}
// -*- 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
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();
+}
+ /*}}}*/
// -*- 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
{
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);
};
// -*- 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
// Lookup function
Parser &Lookup(pkgCache::VerFileIterator &Ver);
-
+
// Construct destruct
pkgRecords(pkgCache &Cache);
~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() {};
};
// -*- 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
// 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;
}
}
}
return _error->Error("Unable to correct dependencies");
}
+ if (pkgMinimizeUpgrade(*Cache) == false)
+ return _error->Error("Unable to minimize the upgrade set");
c1out << " Done" << endl;
}
-// $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.
}
Debug {
- pkgProblemResolver "true";
+ pkgProblemResolver "false";
}
<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
<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:
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>
<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
<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
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>