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;
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;
}
// 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;
}
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)
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;
return false;
}
/*}}}*/
+// ShowPkg - display a package name /*{{{*/
+// ---------------------------------------------------------------------
+/* Displays the package name and maybe also the architecture
+ if it is not the main architecture */
+string ShowPkg(pkgCache::PkgIterator const Pkg) {
+ string p = Pkg.Name();
+ if (_config->Find("APT::Architecture") != Pkg.Arch())
+ p.append(":").append(Pkg.Arch());
+ return p;
+}
+ /*}}}*/
// ShowBroken - Debugging aide /*{{{*/
// ---------------------------------------------------------------------
/* This prints out the names of all the packages that are broken along
}
// Print out each package and the failed dependencies
- out <<" " << I.Name() << ":";
- unsigned Indent = strlen(I.Name()) + 3;
+ out << " " << ShowPkg(I) << " :";
+ unsigned const Indent = ShowPkg(I).size() + 3;
bool First = true;
pkgCache::VerIterator Ver;
out << ' ' << End.DepType() << ": ";
FirstOr = false;
- out << Start.TargetPkg().Name();
+ out << ShowPkg(Start.TargetPkg());
// Show a quick summary of the version requirements
if (Start.TargetVer() != 0)
{
pkgCache::PkgIterator I(Cache,Cache.List[J]);
if (Cache[I].NewInstall() == true) {
- List += string(I.Name()) + " ";
+ List += ShowPkg(I) + " ";
VersionsList += string(Cache[I].CandVersion) + "\n";
}
}
if (Cache[I].Delete() == true)
{
if ((Cache[I].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge)
- List += string(I.Name()) + "* ";
+ List += ShowPkg(I) + "* ";
else
- List += string(I.Name()) + " ";
+ List += ShowPkg(I) + " ";
VersionsList += string(Cache[I].CandVersion)+ "\n";
}
I->CurrentVer == 0 || Cache[I].Delete() == true)
continue;
- List += string(I.Name()) + " ";
+ List += ShowPkg(I) + " ";
VersionsList += string(Cache[I].CurVersion) + " => " + Cache[I].CandVersion + "\n";
}
ShowList(out,_("The following packages have been kept back:"),List,VersionsList);
if (Cache[I].Upgrade() == false || Cache[I].NewInstall() == true)
continue;
- List += string(I.Name()) + " ";
+ List += ShowPkg(I) + " ";
VersionsList += string(Cache[I].CurVersion) + " => " + Cache[I].CandVersion + "\n";
}
ShowList(out,_("The following packages will be upgraded:"),List,VersionsList);
if (Cache[I].Downgrade() == false || Cache[I].NewInstall() == true)
continue;
- List += string(I.Name()) + " ";
+ List += ShowPkg(I) + " ";
VersionsList += string(Cache[I].CurVersion) + " => " + Cache[I].CandVersion + "\n";
}
return ShowList(out,_("The following packages will be DOWNGRADED:"),List,VersionsList);
pkgCache::PkgIterator I(Cache,Cache.List[J]);
if (Cache[I].InstallVer != (pkgCache::Version *)I.CurrentVer() &&
I->SelectedState == pkgCache::State::Hold) {
- List += string(I.Name()) + " ";
+ List += ShowPkg(I) + " ";
VersionsList += string(Cache[I].CurVersion) + " => " + Cache[I].CandVersion + "\n";
}
}
if (Added[I->ID] == false)
{
Added[I->ID] = true;
- List += string(I.Name()) + " ";
+ List += ShowPkg(I) + " ";
//VersionsList += string(Cache[I].CurVersion) + "\n"; ???
}
}