summaryrefslogtreecommitdiff
path: root/cmdline/apt-cache.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-02-11 15:41:04 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-02-11 15:41:04 +0100
commit6293e04ff36cd1cb4756fc30a4777ad6aaf8ffac (patch)
treec5f6dd94eb2396743844d9562dbccf8df58a7b32 /cmdline/apt-cache.cc
parent4d174dc84ea184b5afa81abb3b94e2ef3380ece8 (diff)
display the architecture of the package if it is not the default
architecture in apt-get, display policy for all available architectures and use GrpIterator in apt-cache pkgnames
Diffstat (limited to 'cmdline/apt-cache.cc')
-rw-r--r--cmdline/apt-cache.cc46
1 files changed, 31 insertions, 15 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index 7d7f58a62..cd806286c 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -1417,11 +1417,15 @@ bool ShowPackage(CommandLine &CmdL)
for (const char **I = CmdL.FileList + 1; *I != 0; I++)
{
+ // FIXME: Handle the case in which pkgname name:arch is not found
pkgCache::PkgIterator Pkg = Cache.FindPkg(*I);
if (Pkg.end() == true)
{
- _error->Warning(_("Unable to locate package %s"),*I);
- continue;
+ Pkg = Cache.FindPkg(*I, "any");
+ if (Pkg.end() == true) {
+ _error->Warning(_("Unable to locate package %s"),*I);
+ continue;
+ }
}
++found;
@@ -1457,16 +1461,17 @@ bool ShowPackage(CommandLine &CmdL)
bool ShowPkgNames(CommandLine &CmdL)
{
pkgCache &Cache = *GCache;
- pkgCache::PkgIterator I = Cache.PkgBegin();
- bool All = _config->FindB("APT::Cache::AllNames","false");
-
+ pkgCache::GrpIterator I = Cache.GrpBegin();
+ bool const All = _config->FindB("APT::Cache::AllNames","false");
+
if (CmdL.FileList[1] != 0)
{
for (;I.end() != true; I++)
{
- if (All == false && I->VersionList == 0)
+ if (All == false && I->FirstPackage == 0)
+ continue;
+ if (I.FindPkg("any")->VersionList == 0)
continue;
-
if (strncmp(I.Name(),CmdL.FileList[1],strlen(CmdL.FileList[1])) == 0)
cout << I.Name() << endl;
}
@@ -1477,7 +1482,9 @@ bool ShowPkgNames(CommandLine &CmdL)
// Show all pkgs
for (;I.end() != true; I++)
{
- if (All == false && I->VersionList == 0)
+ if (All == false && I->FirstPackage == 0)
+ continue;
+ if (I.FindPkg("any")->VersionList == 0)
continue;
cout << I.Name() << endl;
}
@@ -1565,19 +1572,27 @@ bool Policy(CommandLine &CmdL)
return true;
}
-
+
+ string const myArch = _config->Find("APT::Architecture");
+
// Print out detailed information for each package
for (const char **I = CmdL.FileList + 1; *I != 0; I++)
{
- pkgCache::PkgIterator Pkg = Cache.FindPkg(*I);
+ pkgCache::GrpIterator Grp = Cache.FindGrp(*I);
+ pkgCache::PkgIterator Pkg = Grp.FindPkg("any");
if (Pkg.end() == true)
{
_error->Warning(_("Unable to locate package %s"),*I);
continue;
}
-
- cout << Pkg.Name() << ":" << endl;
-
+
+ for (; Pkg.end() != true; Pkg = Grp.NextPkg(Pkg)) {
+
+ if (myArch == Pkg.Arch())
+ cout << Pkg.Name() << ":" << endl;
+ else
+ cout << Pkg.Name() << ": [" << Pkg.Arch() << "]" << endl;
+
// Installed version
cout << _(" Installed: ");
if (Pkg->CurrentVer == 0)
@@ -1622,8 +1637,9 @@ bool Policy(CommandLine &CmdL)
return _error->Error(_("Cache is out of sync, can't x-ref a package file"));
printf(_(" %4i %s\n"),Plcy.GetPriority(VF.File()),
Indx->Describe(true).c_str());
- }
- }
+ }
+ }
+ }
}
return true;