+ return true;
+}
+ /*}}}*/
+// Madison - Look a bit like katie's madison /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool Madison(CommandLine &CmdL)
+{
+ pkgCacheFile CacheFile;
+ pkgSourceList *SrcList = CacheFile.GetSourceList();
+
+ if (SrcList == 0)
+ return false;
+
+ // 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();
+
+ APT::CacheSetHelper helper(true, GlobalError::NOTICE);
+ for (const char **I = CmdL.FileList + 1; *I != 0; I++)
+ {
+ _error->PushToStack();
+ APT::PackageList pkgset = APT::PackageList::FromString(CacheFile, *I, helper);
+ for (APT::PackageList::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
+ {
+ 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.FullName(true) << " | " << setw(10) << V.VerStr() << " | "
+ << (*IF)->Describe(true) << endl;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ SrcRecs.Restart();
+ pkgSrcRecords::Parser *SrcParser;
+ bool foundSomething = false;
+ while ((SrcParser = SrcRecs.Find(*I, false)) != 0)
+ {
+ foundSomething = true;
+ // Maybe support Release info here too eventually
+ cout << setw(10) << SrcParser->Package() << " | "
+ << setw(10) << SrcParser->Version() << " | "
+ << SrcParser->Index().Describe(true) << endl;
+ }
+ if (foundSomething == true)
+ _error->RevertToStack();
+ else
+ _error->MergeWithStack();
+ }
+