]> git.saurik.com Git - apt.git/commitdiff
* Add an "apt-cache madison" command with an output for...
authorArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 17:04:45 +0000 (17:04 +0000)
committerArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 17:04:45 +0000 (17:04 +0000)
Author: mdz
Date: 2004-01-04 07:41:52 GMT
* Add an "apt-cache madison" command with an output format similar to
the katie tool of the same name (but less functionality)

cmdline/apt-cache.cc
doc/apt-cache.8.sgml
po/apt-all.pot

index 00a2c6883a1c346e6c5139c452cacded8257aca1..a8db900a166b061f2c776dd974cf37b9330a84fe 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: apt-cache.cc,v 1.69 2003/12/20 22:56:14 mdz Exp $
+// $Id: apt-cache.cc,v 1.70 2004/01/04 07:41:52 mdz Exp $
 /* ######################################################################
    
    apt-cache - Manages the cache files
@@ -37,6 +37,8 @@
 #include <errno.h>
 #include <regex.h>
 #include <stdio.h>
+
+#include <iomanip>
                                                                        /*}}}*/
 
 using namespace std;
@@ -1559,6 +1561,70 @@ bool Policy(CommandLine &CmdL)
    
    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;
+
+   // Create the text record parsers
+   pkgSrcRecords SrcRecs(*SrcList);
+   if (_error->PendingError() == true)
+      return false;
+
+   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++)
+            {
+               if (VF.File().Archive() != 0)
+               {
+                  cout << setw(10) << Pkg.Name() << " | " << setw(10) << V.VerStr() << " | "
+                       << VF.File().Archive() << endl;
+               }
+               else
+               {
+                  // Locate the associated index files so we can derive a description
+                  for (pkgSourceList::const_iterator S = SrcList->begin(); S != SrcList->end(); S++)
+                  {
+                     if ((*S)->FindInCache(*(VF.File().Cache())) == VF.File())
+                     {
+                        cout << setw(10) << Pkg.Name() << " | " << setw(10) << V.VerStr() << " | "
+                             << (*S)->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;
+}
+
                                                                        /*}}}*/
 // GenCaches - Call the main cache generator                           /*{{{*/
 // ---------------------------------------------------------------------
@@ -1670,6 +1736,7 @@ int main(int argc,const char *argv[])
                                     {"show",&ShowPackage},
                                     {"pkgnames",&ShowPkgNames},
                                     {"policy",&Policy},
+                                    {"madison",&Madison},
                                     {0,0}};
 
    CacheInitialize();
index 24aa275ea49ae2bfc591788e90675210f672759b..2ef3a2d259f8a070953a0e451b36cbe3b64631cf 100644 (file)
@@ -43,6 +43,7 @@
          <arg>pkgnames <arg choice="plain"><replaceable>prefix</replaceable></arg></arg>
          <arg>dotty <arg choice="plain" rep="repeat"><replaceable>pkg</replaceable></arg></arg>
          <arg>policy <arg choice="plain" rep="repeat"><replaceable>pkgs</replaceable></arg></arg>
+         <arg>madison <arg choice="plain" rep="repeat"><replaceable>pkgs</replaceable></arg></arg>
       </group>   
    </cmdsynopsis>
  </refsynopsisdiv>
@@ -266,6 +267,16 @@ Reverse Provides:
      priorities of each source. Otherwise it prints out detailed information
      about the priority selection of the named package.
      </VarListEntry>
+
+     <VarListEntry><Term>madison <replaceable/[ pkg(s) ]/</Term>
+     <ListItem><Para>
+
+     <literal/apt-cache/'s <literal/madison/ command attempts to mimic
+     the output format and a subset of the functionality of the katie
+     program, <literal/madison/.  It displays available versions of a
+     package in a tabular format.
+
+     </VarListEntry>
    </VariableList>
  </RefSect1>
  
index 047ce097d0c372dd33734f9bdd82c635bc75b38c..7c15c9429944f48b71b1afbc7842ece610feff09 100644 (file)
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2004-01-02 13:54-0800\n"
+"POT-Creation-Date: 2004-01-03 23:28-0800\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -15,145 +15,145 @@ msgstr ""
 "Content-Type: text/plain; charset=CHARSET\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: cmdline/apt-cache.cc:133
+#: cmdline/apt-cache.cc:135
 #, c-format
 msgid "Package %s version %s has an unmet dep:\n"
 msgstr ""
 
-#: cmdline/apt-cache.cc:173 cmdline/apt-cache.cc:525 cmdline/apt-cache.cc:613
-#: cmdline/apt-cache.cc:769 cmdline/apt-cache.cc:987 cmdline/apt-cache.cc:1355
-#: cmdline/apt-cache.cc:1506
+#: cmdline/apt-cache.cc:175 cmdline/apt-cache.cc:527 cmdline/apt-cache.cc:615
+#: cmdline/apt-cache.cc:771 cmdline/apt-cache.cc:989 cmdline/apt-cache.cc:1357
+#: cmdline/apt-cache.cc:1508
 #, c-format
 msgid "Unable to locate package %s"
 msgstr ""
 
-#: cmdline/apt-cache.cc:230
+#: cmdline/apt-cache.cc:232
 msgid "Total Package Names : "
 msgstr ""
 
-#: cmdline/apt-cache.cc:270
+#: cmdline/apt-cache.cc:272
 msgid "  Normal Packages: "
 msgstr ""
 
-#: cmdline/apt-cache.cc:271
+#: cmdline/apt-cache.cc:273
 msgid "  Pure Virtual Packages: "
 msgstr ""
 
-#: cmdline/apt-cache.cc:272
+#: cmdline/apt-cache.cc:274
 msgid "  Single Virtual Packages: "
 msgstr ""
 
-#: cmdline/apt-cache.cc:273
+#: cmdline/apt-cache.cc:275
 msgid "  Mixed Virtual Packages: "
 msgstr ""
 
-#: cmdline/apt-cache.cc:274
+#: cmdline/apt-cache.cc:276
 msgid "  Missing: "
 msgstr ""
 
-#: cmdline/apt-cache.cc:276
+#: cmdline/apt-cache.cc:278
 msgid "Total Distinct Versions: "
 msgstr ""
 
-#: cmdline/apt-cache.cc:278
+#: cmdline/apt-cache.cc:280
 msgid "Total Dependencies: "
 msgstr ""
 
-#: cmdline/apt-cache.cc:281
+#: cmdline/apt-cache.cc:283
 msgid "Total Ver/File relations: "
 msgstr ""
 
-#: cmdline/apt-cache.cc:283
+#: cmdline/apt-cache.cc:285
 msgid "Total Provides Mappings: "
 msgstr ""
 
-#: cmdline/apt-cache.cc:295
+#: cmdline/apt-cache.cc:297
 msgid "Total Globbed Strings: "
 msgstr ""
 
-#: cmdline/apt-cache.cc:309
+#: cmdline/apt-cache.cc:311
 msgid "Total Dependency Version space: "
 msgstr ""
 
-#: cmdline/apt-cache.cc:314
+#: cmdline/apt-cache.cc:316
 msgid "Total Slack space: "
 msgstr ""
 
-#: cmdline/apt-cache.cc:322
+#: cmdline/apt-cache.cc:324
 msgid "Total Space Accounted for: "
 msgstr ""
 
-#: cmdline/apt-cache.cc:444 cmdline/apt-cache.cc:1187
+#: cmdline/apt-cache.cc:446 cmdline/apt-cache.cc:1189
 #, c-format
 msgid "Package file %s is out of sync."
 msgstr ""
 
-#: cmdline/apt-cache.cc:1229
+#: cmdline/apt-cache.cc:1231
 msgid "You must give exactly one pattern"
 msgstr ""
 
-#: cmdline/apt-cache.cc:1383
+#: cmdline/apt-cache.cc:1385
 msgid "No packages found"
 msgstr ""
 
-#: cmdline/apt-cache.cc:1460
+#: cmdline/apt-cache.cc:1462
 msgid "Package Files:"
 msgstr ""
 
-#: cmdline/apt-cache.cc:1467 cmdline/apt-cache.cc:1553
+#: cmdline/apt-cache.cc:1469 cmdline/apt-cache.cc:1555
 msgid "Cache is out of sync, can't x-ref a package file"
 msgstr ""
 
-#: cmdline/apt-cache.cc:1468
+#: cmdline/apt-cache.cc:1470
 #, c-format
 msgid "%4i %s\n"
 msgstr ""
 
 #. Show any packages have explicit pins
-#: cmdline/apt-cache.cc:1480
+#: cmdline/apt-cache.cc:1482
 msgid "Pinned Packages:"
 msgstr ""
 
-#: cmdline/apt-cache.cc:1492 cmdline/apt-cache.cc:1533
+#: cmdline/apt-cache.cc:1494 cmdline/apt-cache.cc:1535
 msgid "(not found)"
 msgstr ""
 
 #. Installed version
-#: cmdline/apt-cache.cc:1513
+#: cmdline/apt-cache.cc:1515
 msgid "  Installed: "
 msgstr ""
 
-#: cmdline/apt-cache.cc:1515 cmdline/apt-cache.cc:1523
+#: cmdline/apt-cache.cc:1517 cmdline/apt-cache.cc:1525
 msgid "(none)"
 msgstr ""
 
 #. Candidate Version
-#: cmdline/apt-cache.cc:1520
+#: cmdline/apt-cache.cc:1522
 msgid "  Candidate: "
 msgstr ""
 
-#: cmdline/apt-cache.cc:1530
+#: cmdline/apt-cache.cc:1532
 msgid "  Package Pin: "
 msgstr ""
 
 #. Show the priority tables
-#: cmdline/apt-cache.cc:1539
+#: cmdline/apt-cache.cc:1541
 msgid "  Version Table:"
 msgstr ""
 
-#: cmdline/apt-cache.cc:1554
+#: cmdline/apt-cache.cc:1556
 #, c-format
 msgid "       %4i %s\n"
 msgstr ""
 
-#: cmdline/apt-cache.cc:1581 cmdline/apt-cdrom.cc:731 cmdline/apt-config.cc:70
+#: cmdline/apt-cache.cc:1646 cmdline/apt-cdrom.cc:731 cmdline/apt-config.cc:70
 #: cmdline/apt-extracttemplates.cc:225 ftparchive/apt-ftparchive.cc:545
 #: cmdline/apt-get.cc:2256 cmdline/apt-sortpkgs.cc:144
 #, c-format
 msgid "%s %s for %s %s compiled on %s %s\n"
 msgstr ""
 
-#: cmdline/apt-cache.cc:1588
+#: cmdline/apt-cache.cc:1653
 msgid ""
 "Usage: apt-cache [options] command\n"
 "       apt-cache [options] add file1 [file2 ...]\n"
@@ -399,22 +399,22 @@ msgstr ""
 msgid " DeLink limit of %sB hit.\n"
 msgstr ""
 
-#: ftparchive/writer.cc:352 apt-inst/extract.cc:181 apt-inst/extract.cc:193
+#: ftparchive/writer.cc:358 apt-inst/extract.cc:181 apt-inst/extract.cc:193
 #: apt-inst/extract.cc:210 apt-inst/deb/dpkgdb.cc:121
 #, c-format
 msgid "Failed to stat %s"
 msgstr ""
 
-#: ftparchive/writer.cc:372
+#: ftparchive/writer.cc:379
 msgid "Archive had no package field"
 msgstr ""
 
-#: ftparchive/writer.cc:380 ftparchive/writer.cc:589
+#: ftparchive/writer.cc:387 ftparchive/writer.cc:596
 #, c-format
 msgid "  %s has no override entry\n"
 msgstr ""
 
-#: ftparchive/writer.cc:423 ftparchive/writer.cc:671
+#: ftparchive/writer.cc:430 ftparchive/writer.cc:678
 #, c-format
 msgid "  %s maintainer is %s not %s\n"
 msgstr ""