-
- // Print out all of the package files
- if (CmdL.FileList[1] == 0)
- {
- cout << _("Package files:") << endl;
- for (pkgCache::PkgFileIterator F = Cache.FileBegin(); F.end() == false; F++)
- {
- // Locate the associated index files so we can derive a description
- pkgIndexFile *Indx;
- if (SrcList->FindIndex(F,Indx) == false &&
- _system->FindIndex(F,Indx) == false)
- return _error->Error(_("Cache is out of sync, can't x-ref a package file"));
-
- printf("%4i %s\n",
- Plcy.GetPriority(F),Indx->Describe(true).c_str());
-
- // Print the reference information for the package
- string Str = F.RelStr();
- if (Str.empty() == false)
- printf(" release %s\n",F.RelStr().c_str());
- if (F.Site() != 0 && F.Site()[0] != 0)
- printf(" origin %s\n",F.Site());
- }
-
- // Show any packages have explicit pins
- cout << _("Pinned packages:") << endl;
- pkgCache::PkgIterator I = Cache.PkgBegin();
- for (;I.end() != true; I++)
- {
- if (Plcy.GetPriority(I) == 0)
- continue;
-
- // Print the package name and the version we are forcing to
- cout << " " << I.FullName(true) << " -> ";
-
- pkgCache::VerIterator V = Plcy.GetMatch(I);
- if (V.end() == true)
- cout << _("(not found)") << endl;
- else
- cout << V.VerStr() << endl;
- }
-
- return true;
- }
-
- string const myArch = _config->Find("APT::Architecture");
- char const * const msgInstalled = _(" Installed: ");
- char const * const msgCandidate = _(" Candidate: ");
- short const InstalledLessCandidate =
- mbstowcs(NULL, msgInstalled, 0) - mbstowcs(NULL, msgCandidate, 0);
- short const deepInstalled =
- (InstalledLessCandidate < 0 ? (InstalledLessCandidate*-1) : 0) - 1;
- short const deepCandidate =
- (InstalledLessCandidate > 0 ? (InstalledLessCandidate) : 0) - 1;
-
- // Print out detailed information for each package
- for (const char **I = CmdL.FileList + 1; *I != 0; 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;
- }
-
- for (; Pkg.end() != true; Pkg = Grp.NextPkg(Pkg)) {
- if (strcmp(Pkg.Arch(),"all") == 0)
- continue;
-
- cout << Pkg.FullName(true) << ":" << endl;
-
- // Installed version
- cout << msgInstalled << OutputInDepth(deepInstalled, " ");
- if (Pkg->CurrentVer == 0)
- cout << _("(none)") << endl;
- else
- cout << Pkg.CurrentVer().VerStr() << endl;
-
- // Candidate Version
- cout << msgCandidate << OutputInDepth(deepCandidate, " ");
- pkgCache::VerIterator V = Plcy.GetCandidateVer(Pkg);
- if (V.end() == true)
- cout << _("(none)") << endl;
- else
- cout << V.VerStr() << endl;
-
- // Pinned version
- if (Plcy.GetPriority(Pkg) != 0)
- {
- cout << _(" Package pin: ");
- V = Plcy.GetMatch(Pkg);
- if (V.end() == true)
- cout << _("(not found)") << endl;
- else
- cout << V.VerStr() << endl;
- }
-
- // Show the priority tables
- cout << _(" Version table:") << endl;
- for (V = Pkg.VersionList(); V.end() == false; V++)
- {
- if (Pkg.CurrentVer() == V)
- cout << " *** " << V.VerStr();
- else
- cout << " " << V.VerStr();
- cout << " " << Plcy.GetPriority(Pkg) << endl;
- for (pkgCache::VerFileIterator VF = V.FileList(); VF.end() == false; VF++)
- {
- // Locate the associated index files so we can derive a description
- pkgIndexFile *Indx;
- if (SrcList->FindIndex(VF.File(),Indx) == false &&
- _system->FindIndex(VF.File(),Indx) == false)
- 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;
-}
- /*}}}*/
-// Madison - Look a bit like katie's madison /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-bool Madison(CommandLine &CmdL)
-{
- if (SrcList == 0)
- return _error->Error("Generate must be enabled for this function");
-
- SrcList->ReadMainList();
-
- pkgCache &Cache = *GCache;