summaryrefslogtreecommitdiff
path: root/cmdline/apt-cache.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-02-26 20:47:19 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-02-26 20:47:19 +0100
commit75ce206243e409b170d06723430eb85a4a747882 (patch)
tree1e7f9aefe939d3c4a1cb8402ad0b88ea03c7b1dc /cmdline/apt-cache.cc
parentb7044b4b7483259f6dbca4fce56320dbde6da02a (diff)
move ShowPkg() from apt-get to the PkgIterator and rename it to FullName()
responseable for displaying a package name and the architecture in a uniform way. Pretty option can be used to not append the architecture if it is the native architecture or all - and use it all over the place in the commandline tools.
Diffstat (limited to 'cmdline/apt-cache.cc')
-rw-r--r--cmdline/apt-cache.cc59
1 files changed, 28 insertions, 31 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index 8323a740e..355e9aefb 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -139,7 +139,7 @@ bool UnMet(CommandLine &CmdL)
// Oops, it failed..
if (Header == false)
ioprintf(cout,_("Package %s version %s has an unmet dep:\n"),
- P.Name(),V.VerStr());
+ P.FullName(true).c_str(),V.VerStr());
Header = true;
// Print out the dep type
@@ -149,7 +149,7 @@ bool UnMet(CommandLine &CmdL)
Start = RealStart;
do
{
- cout << Start.TargetPkg().Name();
+ cout << Start.TargetPkg().FullName(true);
if (Start.TargetVer() != 0)
cout << " (" << Start.CompType() << " " << Start.TargetVer() <<
")";
@@ -182,7 +182,7 @@ bool DumpPackage(CommandLine &CmdL)
continue;
}
- cout << "Package: " << Pkg.Name() << endl;
+ cout << "Package: " << Pkg.FullName(true) << endl;
cout << "Versions: " << endl;
for (pkgCache::VerIterator Cur = Pkg.VersionList(); Cur.end() != true; Cur++)
{
@@ -204,7 +204,7 @@ bool DumpPackage(CommandLine &CmdL)
cout << "Reverse Depends: " << endl;
for (pkgCache::DepIterator D = Pkg.RevDependsList(); D.end() != true; D++)
{
- cout << " " << D.ParentPkg().Name() << ',' << D.TargetPkg().Name();
+ cout << " " << D.ParentPkg().FullName(true) << ',' << D.TargetPkg().FullName(true);
if (D->Version != 0)
cout << ' ' << DeNull(D.TargetVer()) << endl;
else
@@ -216,7 +216,7 @@ bool DumpPackage(CommandLine &CmdL)
{
cout << Cur.VerStr() << " - ";
for (pkgCache::DepIterator Dep = Cur.DependsList(); Dep.end() != true; Dep++)
- cout << Dep.TargetPkg().Name() << " (" << (int)Dep->CompareOp << " " << DeNull(Dep.TargetVer()) << ") ";
+ cout << Dep.TargetPkg().FullName(true) << " (" << (int)Dep->CompareOp << " " << DeNull(Dep.TargetVer()) << ") ";
cout << endl;
}
@@ -225,12 +225,12 @@ bool DumpPackage(CommandLine &CmdL)
{
cout << Cur.VerStr() << " - ";
for (pkgCache::PrvIterator Prv = Cur.ProvidesList(); Prv.end() != true; Prv++)
- cout << Prv.ParentPkg().Name() << " ";
+ cout << Prv.ParentPkg().FullName(true) << " ";
cout << endl;
}
cout << "Reverse Provides: " << endl;
for (pkgCache::PrvIterator Prv = Pkg.ProvidesList(); Prv.end() != true; Prv++)
- cout << Prv.OwnerPkg().Name() << " " << Prv.OwnerVer().VerStr() << endl;
+ cout << Prv.OwnerPkg().FullName(true) << " " << Prv.OwnerVer().VerStr() << endl;
}
return true;
@@ -353,13 +353,13 @@ bool Dump(CommandLine &Cmd)
for (pkgCache::PkgIterator P = Cache.PkgBegin(); P.end() == false; P++)
{
- cout << "Package: " << P.Name() << endl;
+ cout << "Package: " << P.FullName(true) << endl;
for (pkgCache::VerIterator V = P.VersionList(); V.end() == false; V++)
{
cout << " Version: " << V.VerStr() << endl;
cout << " File: " << V.FileList().File().FileName() << endl;
for (pkgCache::DepIterator D = V.DependsList(); D.end() == false; D++)
- cout << " Depends: " << D.TargetPkg().Name() << ' ' <<
+ cout << " Depends: " << D.TargetPkg().FullName(true) << ' ' <<
DeNull(D.TargetVer()) << endl;
for (pkgCache::DescIterator D = V.DescriptionList(); D.end() == false; D++)
{
@@ -570,11 +570,11 @@ bool Depends(CommandLine &CmdL)
pkgCache::VerIterator Ver = Pkg.VersionList();
if (Ver.end() == true)
{
- cout << '<' << Pkg.Name() << '>' << endl;
+ cout << '<' << Pkg.FullName(true) << '>' << endl;
continue;
}
- cout << Pkg.Name() << endl;
+ cout << Pkg.FullName(true) << endl;
for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; D++)
{
@@ -596,9 +596,9 @@ bool Depends(CommandLine &CmdL)
// Show the package
if (Trg->VersionList == 0)
- cout << D.DepType() << ": <" << Trg.Name() << ">" << endl;
+ cout << D.DepType() << ": <" << Trg.FullName(true) << ">" << endl;
else
- cout << D.DepType() << ": " << Trg.Name() << endl;
+ cout << D.DepType() << ": " << Trg.FullName(true) << endl;
if (Recurse == true)
Colours[D.TargetPkg()->ID]++;
@@ -614,7 +614,7 @@ bool Depends(CommandLine &CmdL)
if (V != Cache.VerP + V.ParentPkg()->VersionList ||
V->ParentPkg == D->Package)
continue;
- cout << " " << V.ParentPkg().Name() << endl;
+ cout << " " << V.ParentPkg().FullName(true) << endl;
if (Recurse == true)
Colours[D.ParentPkg()->ID]++;
@@ -663,11 +663,11 @@ bool RDepends(CommandLine &CmdL)
pkgCache::VerIterator Ver = Pkg.VersionList();
if (Ver.end() == true)
{
- cout << '<' << Pkg.Name() << '>' << endl;
+ cout << '<' << Pkg.FullName(true) << '>' << endl;
continue;
}
- cout << Pkg.Name() << endl;
+ cout << Pkg.FullName(true) << endl;
cout << "Reverse Depends:" << endl;
for (pkgCache::DepIterator D = Pkg.RevDependsList(); D.end() == false; D++)
@@ -684,9 +684,9 @@ bool RDepends(CommandLine &CmdL)
cout << " ";
if (Trg->VersionList == 0)
- cout << D.DepType() << ": <" << Trg.Name() << ">" << endl;
+ cout << D.DepType() << ": <" << Trg.FullName(true) << ">" << endl;
else
- cout << Trg.Name() << endl;
+ cout << Trg.FullName(true) << endl;
if (Recurse == true)
Colours[D.ParentPkg()->ID]++;
@@ -702,7 +702,7 @@ bool RDepends(CommandLine &CmdL)
if (V != Cache.VerP + V.ParentPkg()->VersionList ||
V->ParentPkg == D->Package)
continue;
- cout << " " << V.ParentPkg().Name() << endl;
+ cout << " " << V.ParentPkg().FullName(true) << endl;
if (Recurse == true)
Colours[D.ParentPkg()->ID]++;
@@ -863,7 +863,7 @@ bool XVcg(CommandLine &CmdL)
// Only graph critical deps
if (D.IsCritical() == true)
{
- printf ("edge: { sourcename: \"%s\" targetname: \"%s\" class: 2 ",Pkg.Name(), D.TargetPkg().Name() );
+ printf ("edge: { sourcename: \"%s\" targetname: \"%s\" class: 2 ",Pkg.FullName(true).c_str(), D.TargetPkg().FullName(true).c_str() );
// Colour the node for recursion
if (Show[D.TargetPkg()->ID] <= DoneNR)
@@ -922,10 +922,10 @@ bool XVcg(CommandLine &CmdL)
continue;
if (Show[Pkg->ID] == DoneNR)
- printf("node: { title: \"%s\" label: \"%s\" color: orange shape: %s }\n", Pkg.Name(), Pkg.Name(),
+ printf("node: { title: \"%s\" label: \"%s\" color: orange shape: %s }\n", Pkg.FullName(true).c_str(), Pkg.FullName(true).c_str(),
Shapes[ShapeMap[Pkg->ID]]);
else
- printf("node: { title: \"%s\" label: \"%s\" shape: %s }\n", Pkg.Name(), Pkg.Name(),
+ printf("node: { title: \"%s\" label: \"%s\" shape: %s }\n", Pkg.FullName(true).c_str(), Pkg.FullName(true).c_str(),
Shapes[ShapeMap[Pkg->ID]]);
}
@@ -1084,7 +1084,7 @@ bool Dotty(CommandLine &CmdL)
// Only graph critical deps
if (D.IsCritical() == true)
{
- printf("\"%s\" -> \"%s\"",Pkg.Name(),D.TargetPkg().Name());
+ printf("\"%s\" -> \"%s\"",Pkg.FullName(true).c_str(),D.TargetPkg().FullName(true).c_str());
// Colour the node for recursion
if (Show[D.TargetPkg()->ID] <= DoneNR)
@@ -1138,10 +1138,10 @@ bool Dotty(CommandLine &CmdL)
// Orange box for early recursion stoppage
if (Show[Pkg->ID] == DoneNR)
- printf("\"%s\" [color=orange,shape=%s];\n",Pkg.Name(),
+ printf("\"%s\" [color=orange,shape=%s];\n",Pkg.FullName(true).c_str(),
Shapes[ShapeMap[Pkg->ID]]);
else
- printf("\"%s\" [shape=%s];\n",Pkg.Name(),
+ printf("\"%s\" [shape=%s];\n",Pkg.FullName(true).c_str(),
Shapes[ShapeMap[Pkg->ID]]);
}
@@ -1561,7 +1561,7 @@ bool Policy(CommandLine &CmdL)
continue;
// Print the package name and the version we are forcing to
- cout << " " << I.Name() << " -> ";
+ cout << " " << I.FullName(true) << " -> ";
pkgCache::VerIterator V = Plcy.GetMatch(I);
if (V.end() == true)
@@ -1590,10 +1590,7 @@ bool Policy(CommandLine &CmdL)
if (strcmp(Pkg.Arch(),"all") == 0)
continue;
- if (myArch == Pkg.Arch())
- cout << Pkg.Name() << ":" << endl;
- else
- cout << Pkg.Name() << ": [" << Pkg.Arch() << "]" << endl;
+ cout << Pkg.FullName(true) << ":" << endl;
// Installed version
cout << _(" Installed: ");
@@ -1691,7 +1688,7 @@ bool Madison(CommandLine &CmdL)
{
if ((*IF)->FindInCache(*(VF.File().Cache())) == VF.File())
{
- cout << setw(10) << Pkg.Name() << " | " << setw(10) << V.VerStr() << " | "
+ cout << setw(10) << Pkg.FullName(true) << " | " << setw(10) << V.VerStr() << " | "
<< (*IF)->Describe(true) << endl;
}
}