diff options
author | Arch Librarian <arch@canonical.com> | 2004-09-20 16:54:57 +0000 |
---|---|---|
committer | Arch Librarian <arch@canonical.com> | 2004-09-20 16:54:57 +0000 |
commit | 648e3cb48955f82ce2e34c67eb9eefb76138a3b3 (patch) | |
tree | 619db74073fe9f0152d6e742e76ad5e32df71c8e /cmdline | |
parent | c373c37a2edf384b658c8d054bdcc55464900863 (diff) |
Regex, --all-versions and more OR stuff
Author: jgg
Date: 1999-10-22 04:05:47 GMT
Regex, --all-versions and more OR stuff
Diffstat (limited to 'cmdline')
-rw-r--r-- | cmdline/apt-cache.cc | 25 | ||||
-rw-r--r-- | cmdline/apt-get.cc | 85 |
2 files changed, 71 insertions, 39 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index 8dc56a72b..80c15a749 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: apt-cache.cc,v 1.40 1999/10/18 04:15:25 jgg Exp $ +// $Id: apt-cache.cc,v 1.41 1999/10/22 04:05:47 jgg Exp $ /* ###################################################################### apt-cache - Manages the cache files @@ -589,11 +589,23 @@ bool ShowPackage(CommandLine &CmdL) } // Find the proper version to use. We should probably use the DepCache. - pkgCache::VerIterator V = Cache.GetCandidateVer(Pkg); - if (V.end() == true || V.FileList().end() == true) - continue; - if (DisplayRecord(V) == false) - return false; + if (_config->FindB("APT::Cache::AllVersions","true") == true) + { + pkgCache::VerIterator V; + for (V = Pkg.VersionList(); V.end() == false; V++) + { + if (DisplayRecord(V) == false) + return false; + } + } + else + { + pkgCache::VerIterator V = Cache.GetCandidateVer(Pkg); + if (V.end() == true || V.FileList().end() == true) + continue; + if (DisplayRecord(V) == false) + return false; + } } return true; } @@ -698,6 +710,7 @@ int main(int argc,const char *argv[]) {'i',"important","APT::Cache::Important",0}, {'f',"full","APT::Cache::ShowFull",0}, {'g',"no-generate","APT::Cache::NoGenerate",0}, + {'a',"all-versions","APT::Cache::AllVersions",0}, {0,"names-only","APT::Cache::NamesOnly",0}, {'c',"config-file",0,CommandLine::ConfigFile}, {'o',"option",0,CommandLine::ArbItem}, diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index e134acf7a..51ebe5f41 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.81 1999/10/21 06:35:00 jgg Exp $ +// $Id: apt-get.cc,v 1.82 1999/10/22 04:05:47 jgg Exp $ /* ###################################################################### apt-get - Cover for dpkg @@ -167,7 +167,7 @@ void ShowBroken(ostream &out,CacheFile &Cache,bool Now) // Print out each package and the failed dependencies out <<" " << I.Name() << ":"; - int Indent = strlen(I.Name()) + 3; + unsigned Indent = strlen(I.Name()) + 3; bool First = true; if (Cache[I].InstVerIter(Cache).end() == true) { @@ -185,43 +185,62 @@ void ShowBroken(ostream &out,CacheFile &Cache,bool Now) if (Cache->IsImportantDep(End) == false || (Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall) continue; - - if (First == false) - for (int J = 0; J != Indent; J++) - out << ' '; - First = false; - out << ' ' << End.DepType() << ": " << End.TargetPkg().Name(); - - // Show a quick summary of the version requirements - if (End.TargetVer() != 0) - out << " (" << End.CompType() << " " << End.TargetVer() << - ")"; - - /* Show a summary of the target package if possible. In the case - of virtual packages we show nothing */ - pkgCache::PkgIterator Targ = End.TargetPkg(); - if (Targ->ProvidesList == 0) + bool FirstOr = true; + while (1) { - out << " but "; - pkgCache::VerIterator Ver = Cache[Targ].InstVerIter(Cache); - if (Ver.end() == false) - out << Ver.VerStr() << (Now?" is installed":" is to be installed"); + if (First == false) + for (unsigned J = 0; J != Indent; J++) + out << ' '; + First = false; + + if (FirstOr == false) + { + for (unsigned J = 0; J != strlen(End.DepType()) + 3; J++) + out << ' '; + } else + out << ' ' << End.DepType() << ": "; + FirstOr = false; + + out << Start.TargetPkg().Name(); + + // Show a quick summary of the version requirements + if (Start.TargetVer() != 0) + out << " (" << Start.CompType() << " " << Start.TargetVer() << + ")"; + + /* Show a summary of the target package if possible. In the case + of virtual packages we show nothing */ + pkgCache::PkgIterator Targ = Start.TargetPkg(); + if (Targ->ProvidesList == 0) { - if (Cache[Targ].CandidateVerIter(Cache).end() == true) + out << " but "; + pkgCache::VerIterator Ver = Cache[Targ].InstVerIter(Cache); + if (Ver.end() == false) + out << Ver.VerStr() << (Now?" is installed":" is to be installed"); + else { - if (Targ->ProvidesList == 0) - out << "it is not installable"; + if (Cache[Targ].CandidateVerIter(Cache).end() == true) + { + if (Targ->ProvidesList == 0) + out << "it is not installable"; + else + out << "it is a virtual package"; + } else - out << "it is a virtual package"; - } - else - out << (Now?"it is not installed":"it is not going to be installed"); - } - } - - out << endl; + out << (Now?"it is not installed":"it is not going to be installed"); + } + } + + if (Start != End) + cout << " or"; + out << endl; + + if (Start == End) + break; + Start++; + } } } } |