+ /*}}}*/
+// 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;
+
+ // Create the src text record parsers and ignore errors about missing
+ // deb-src lines that are generated from pkgSrcRecords::pkgSrcRecords
+ pkgSrcRecords SrcRecs(*SrcList);
+ if (_error->PendingError() == true)
+ _error->Discard();
+
+ for (const char **I = CmdL.FileList + 1; *I != 0; I++)
+ {
+ pkgCache::PkgIterator Pkg = Cache.FindPkg(*I);
+
+ if (Pkg.end() == false)
+ {
+ for (pkgCache::VerIterator V = Pkg.VersionList(); V.end() == false; V++)
+ {
+ for (pkgCache::VerFileIterator VF = V.FileList(); VF.end() == false; VF++)
+ {
+// This might be nice, but wouldn't uniquely identify the source -mdz
+// if (VF.File().Archive() != 0)
+// {
+// cout << setw(10) << Pkg.Name() << " | " << setw(10) << V.VerStr() << " | "
+// << VF.File().Archive() << endl;
+// }
+
+ // Locate the associated index files so we can derive a description
+ for (pkgSourceList::const_iterator S = SrcList->begin(); S != SrcList->end(); S++)
+ {
+ vector<pkgIndexFile *> *Indexes = (*S)->GetIndexFiles();
+ for (vector<pkgIndexFile *>::const_iterator IF = Indexes->begin();
+ IF != Indexes->end(); IF++)
+ {
+ if ((*IF)->FindInCache(*(VF.File().Cache())) == VF.File())
+ {
+ cout << setw(10) << Pkg.Name() << " | " << setw(10) << V.VerStr() << " | "
+ << (*IF)->Describe(true) << endl;
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+ SrcRecs.Restart();
+ pkgSrcRecords::Parser *SrcParser;
+ while ((SrcParser = SrcRecs.Find(*I,false)) != 0)
+ {
+ // Maybe support Release info here too eventually
+ cout << setw(10) << SrcParser->Package() << " | "
+ << setw(10) << SrcParser->Version() << " | "
+ << SrcParser->Index().Describe(true) << endl;
+ }
+ }
+
+ return true;
+}
+