// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: apt-get.cc,v 1.107 2001/05/27 04:45:49 jgg Exp $
+// $Id: apt-get.cc,v 1.111 2001/11/04 17:09:18 tausq Exp $
/* ######################################################################
apt-get - Cover for dpkg
return true;
};
+ bool OpenForInstall()
+ {
+ if (_config->FindB("APT::Get::Print-URIs") == true)
+ return Open(false);
+ else
+ return Open(true);
+ }
CacheFile() : List(0) {};
};
/*}}}*/
{
pkgCache::PkgIterator I(Cache,Cache.List[J]);
- if (Cache[I].InstBroken() == false)
- continue;
-
+ if (Now == true)
+ {
+ if (Cache[I].NowBroken() == false)
+ continue;
+ }
+ else
+ {
+ if (Cache[I].InstBroken() == false)
+ continue;
+ }
+
// Print out each package and the failed dependencies
out <<" " << I.Name() << ":";
unsigned Indent = strlen(I.Name()) + 3;
bool First = true;
- if (Cache[I].InstVerIter(Cache).end() == true)
+ pkgCache::VerIterator Ver;
+
+ if (Now == true)
+ Ver = I.CurrentVer();
+ else
+ Ver = Cache[I].InstVerIter(Cache);
+
+ if (Ver.end() == true)
{
- cout << endl;
+ out << endl;
continue;
}
- for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList(); D.end() == false;)
+ for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false;)
{
// Compute a single dependency element (glob or)
pkgCache::DepIterator Start;
pkgCache::DepIterator End;
D.GlobOr(Start,End);
- if (Cache->IsImportantDep(End) == false ||
- (Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall)
+ if (Cache->IsImportantDep(End) == false)
continue;
-
+
+ if (Now == true)
+ {
+ if ((Cache[End] & pkgDepCache::DepGNow) == pkgDepCache::DepGNow)
+ continue;
+ }
+ else
+ {
+ if ((Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall)
+ continue;
+ }
+
bool FirstOr = true;
while (1)
{
pkgCache::VerIterator Ver = Cache[Targ].InstVerIter(Cache);
if (Now == true)
Ver = Targ.CurrentVer();
-
+
if (Ver.end() == false)
{
if (Now == true)
// Lock the archive directory
FileFd Lock;
- if (_config->FindB("Debug::NoLocking",false) == false)
+ if (_config->FindB("Debug::NoLocking",false) == false &&
+ _config->FindB("APT::Get::Print-URIs") == false)
{
Lock.Fd(GetLock(_config->FindDir("Dir::Cache::Archives") + "lock"));
if (_error->PendingError() == true)
bool DoUpgrade(CommandLine &CmdL)
{
CacheFile Cache;
- if (Cache.Open() == false || Cache.CheckDeps() == false)
+ if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
return false;
// Do the upgrade
bool DoInstall(CommandLine &CmdL)
{
CacheFile Cache;
- if (Cache.Open() == false || Cache.CheckDeps(CmdL.FileSize() != 1) == false)
+ if (Cache.OpenForInstall() == false ||
+ Cache.CheckDeps(CmdL.FileSize() != 1) == false)
return false;
// Enter the special broken fixing mode if the user specified arguments
bool DoDistUpgrade(CommandLine &CmdL)
{
CacheFile Cache;
- if (Cache.Open() == false || Cache.CheckDeps() == false)
+ if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
return false;
c0out << _("Calculating Upgrade... ") << flush;
bool DoDSelectUpgrade(CommandLine &CmdL)
{
CacheFile Cache;
- if (Cache.Open() == false || Cache.CheckDeps() == false)
+ if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
return false;
// Install everything with the install flag set
// Process the build-dependencies
vector<pkgSrcRecords::Parser::BuildDepRec> BuildDeps;
- if (Last->BuildDepends(BuildDeps) == false)
+ if (Last->BuildDepends(BuildDeps, _config->FindB("APT::Get::Arch-Only",false)) == false)
return _error->Error(_("Unable to get build-dependency information for %s"),Src.c_str());
if (BuildDeps.size() == 0)
{
pkgCache::PkgIterator Pkg = Cache->FindPkg((*D).Package);
if (Pkg.end() == true)
+ {
+ /* for a build-conflict; ignore unknown packages */
+ if ((*D).Type == pkgSrcRecords::Parser::BuildConflict ||
+ (*D).Type == pkgSrcRecords::Parser::BuildConflictIndep)
+ continue;
+
return _error->Error(_("%s dependency on %s cannot be satisfied because the package %s cannot be found"),
Last->BuildDepType((*D).Type),Src.c_str(),(*D).Package.c_str());
+ }
pkgCache::VerIterator IV = (*Cache)[Pkg].InstVerIter(*Cache);
if ((*D).Type == pkgSrcRecords::Parser::BuildConflict ||
{0,"trivial-only","APT::Get::Trivial-Only",0},
{0,"remove","APT::Get::Remove",0},
{0,"only-source","APT::Get::Only-Source",0},
+ {0,"arch-only","APT::Get::Arch-Only",0},
{'c',"config-file",0,CommandLine::ConfigFile},
{'o',"option",0,CommandLine::ArbItem},
{0,0,0,0}};