Преглед изворни кода

* Add an "apt-cache madison" command with an output for...
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)

Arch Librarian пре 22 година
родитељ
комит
bd3d53eff6
3 измењених фајлова са 118 додато и 40 уклоњено
  1. 68 1
      cmdline/apt-cache.cc
  2. 11 0
      doc/apt-cache.8.sgml
  3. 39 39
      po/apt-all.pot

+ 68 - 1
cmdline/apt-cache.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // 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
    apt-cache - Manages the cache files
@@ -37,6 +37,8 @@
 #include <errno.h>
 #include <errno.h>
 #include <regex.h>
 #include <regex.h>
 #include <stdio.h>
 #include <stdio.h>
+
+#include <iomanip>
 									/*}}}*/
 									/*}}}*/
 
 
 using namespace std;
 using namespace std;
@@ -1559,6 +1561,70 @@ bool Policy(CommandLine &CmdL)
    
    
    return true;
    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				/*{{{*/
 // GenCaches - Call the main cache generator				/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
@@ -1670,6 +1736,7 @@ int main(int argc,const char *argv[])
                                     {"show",&ShowPackage},
                                     {"show",&ShowPackage},
                                     {"pkgnames",&ShowPkgNames},
                                     {"pkgnames",&ShowPkgNames},
                                     {"policy",&Policy},
                                     {"policy",&Policy},
+                                    {"madison",&Madison},
                                     {0,0}};
                                     {0,0}};
 
 
    CacheInitialize();
    CacheInitialize();

+ 11 - 0
doc/apt-cache.8.sgml

@@ -43,6 +43,7 @@
          <arg>pkgnames <arg choice="plain"><replaceable>prefix</replaceable></arg></arg>
          <arg>pkgnames <arg choice="plain"><replaceable>prefix</replaceable></arg></arg>
          <arg>dotty <arg choice="plain" rep="repeat"><replaceable>pkg</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>policy <arg choice="plain" rep="repeat"><replaceable>pkgs</replaceable></arg></arg>
+         <arg>madison <arg choice="plain" rep="repeat"><replaceable>pkgs</replaceable></arg></arg>
       </group>   
       </group>   
    </cmdsynopsis>
    </cmdsynopsis>
  </refsynopsisdiv>
  </refsynopsisdiv>
@@ -266,6 +267,16 @@ Reverse Provides:
      priorities of each source. Otherwise it prints out detailed information
      priorities of each source. Otherwise it prints out detailed information
      about the priority selection of the named package.
      about the priority selection of the named package.
      </VarListEntry>
      </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>
    </VariableList>
  </RefSect1>
  </RefSect1>
  
  

+ 39 - 39
po/apt-all.pot

@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \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"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -15,145 +15,145 @@ msgstr ""
 "Content-Type: text/plain; charset=CHARSET\n"
 "Content-Type: text/plain; charset=CHARSET\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Content-Transfer-Encoding: 8bit\n"
 
 
-#: cmdline/apt-cache.cc:133
+#: cmdline/apt-cache.cc:135
 #, c-format
 #, c-format
 msgid "Package %s version %s has an unmet dep:\n"
 msgid "Package %s version %s has an unmet dep:\n"
 msgstr ""
 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
 #, c-format
 msgid "Unable to locate package %s"
 msgid "Unable to locate package %s"
 msgstr ""
 msgstr ""
 
 
-#: cmdline/apt-cache.cc:230
+#: cmdline/apt-cache.cc:232
 msgid "Total Package Names : "
 msgid "Total Package Names : "
 msgstr ""
 msgstr ""
 
 
-#: cmdline/apt-cache.cc:270
+#: cmdline/apt-cache.cc:272
 msgid "  Normal Packages: "
 msgid "  Normal Packages: "
 msgstr ""
 msgstr ""
 
 
-#: cmdline/apt-cache.cc:271
+#: cmdline/apt-cache.cc:273
 msgid "  Pure Virtual Packages: "
 msgid "  Pure Virtual Packages: "
 msgstr ""
 msgstr ""
 
 
-#: cmdline/apt-cache.cc:272
+#: cmdline/apt-cache.cc:274
 msgid "  Single Virtual Packages: "
 msgid "  Single Virtual Packages: "
 msgstr ""
 msgstr ""
 
 
-#: cmdline/apt-cache.cc:273
+#: cmdline/apt-cache.cc:275
 msgid "  Mixed Virtual Packages: "
 msgid "  Mixed Virtual Packages: "
 msgstr ""
 msgstr ""
 
 
-#: cmdline/apt-cache.cc:274
+#: cmdline/apt-cache.cc:276
 msgid "  Missing: "
 msgid "  Missing: "
 msgstr ""
 msgstr ""
 
 
-#: cmdline/apt-cache.cc:276
+#: cmdline/apt-cache.cc:278
 msgid "Total Distinct Versions: "
 msgid "Total Distinct Versions: "
 msgstr ""
 msgstr ""
 
 
-#: cmdline/apt-cache.cc:278
+#: cmdline/apt-cache.cc:280
 msgid "Total Dependencies: "
 msgid "Total Dependencies: "
 msgstr ""
 msgstr ""
 
 
-#: cmdline/apt-cache.cc:281
+#: cmdline/apt-cache.cc:283
 msgid "Total Ver/File relations: "
 msgid "Total Ver/File relations: "
 msgstr ""
 msgstr ""
 
 
-#: cmdline/apt-cache.cc:283
+#: cmdline/apt-cache.cc:285
 msgid "Total Provides Mappings: "
 msgid "Total Provides Mappings: "
 msgstr ""
 msgstr ""
 
 
-#: cmdline/apt-cache.cc:295
+#: cmdline/apt-cache.cc:297
 msgid "Total Globbed Strings: "
 msgid "Total Globbed Strings: "
 msgstr ""
 msgstr ""
 
 
-#: cmdline/apt-cache.cc:309
+#: cmdline/apt-cache.cc:311
 msgid "Total Dependency Version space: "
 msgid "Total Dependency Version space: "
 msgstr ""
 msgstr ""
 
 
-#: cmdline/apt-cache.cc:314
+#: cmdline/apt-cache.cc:316
 msgid "Total Slack space: "
 msgid "Total Slack space: "
 msgstr ""
 msgstr ""
 
 
-#: cmdline/apt-cache.cc:322
+#: cmdline/apt-cache.cc:324
 msgid "Total Space Accounted for: "
 msgid "Total Space Accounted for: "
 msgstr ""
 msgstr ""
 
 
-#: cmdline/apt-cache.cc:444 cmdline/apt-cache.cc:1187
+#: cmdline/apt-cache.cc:446 cmdline/apt-cache.cc:1189
 #, c-format
 #, c-format
 msgid "Package file %s is out of sync."
 msgid "Package file %s is out of sync."
 msgstr ""
 msgstr ""
 
 
-#: cmdline/apt-cache.cc:1229
+#: cmdline/apt-cache.cc:1231
 msgid "You must give exactly one pattern"
 msgid "You must give exactly one pattern"
 msgstr ""
 msgstr ""
 
 
-#: cmdline/apt-cache.cc:1383
+#: cmdline/apt-cache.cc:1385
 msgid "No packages found"
 msgid "No packages found"
 msgstr ""
 msgstr ""
 
 
-#: cmdline/apt-cache.cc:1460
+#: cmdline/apt-cache.cc:1462
 msgid "Package Files:"
 msgid "Package Files:"
 msgstr ""
 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"
 msgid "Cache is out of sync, can't x-ref a package file"
 msgstr ""
 msgstr ""
 
 
-#: cmdline/apt-cache.cc:1468
+#: cmdline/apt-cache.cc:1470
 #, c-format
 #, c-format
 msgid "%4i %s\n"
 msgid "%4i %s\n"
 msgstr ""
 msgstr ""
 
 
 #. Show any packages have explicit pins
 #. Show any packages have explicit pins
-#: cmdline/apt-cache.cc:1480
+#: cmdline/apt-cache.cc:1482
 msgid "Pinned Packages:"
 msgid "Pinned Packages:"
 msgstr ""
 msgstr ""
 
 
-#: cmdline/apt-cache.cc:1492 cmdline/apt-cache.cc:1533
+#: cmdline/apt-cache.cc:1494 cmdline/apt-cache.cc:1535
 msgid "(not found)"
 msgid "(not found)"
 msgstr ""
 msgstr ""
 
 
 #. Installed version
 #. Installed version
-#: cmdline/apt-cache.cc:1513
+#: cmdline/apt-cache.cc:1515
 msgid "  Installed: "
 msgid "  Installed: "
 msgstr ""
 msgstr ""
 
 
-#: cmdline/apt-cache.cc:1515 cmdline/apt-cache.cc:1523
+#: cmdline/apt-cache.cc:1517 cmdline/apt-cache.cc:1525
 msgid "(none)"
 msgid "(none)"
 msgstr ""
 msgstr ""
 
 
 #. Candidate Version
 #. Candidate Version
-#: cmdline/apt-cache.cc:1520
+#: cmdline/apt-cache.cc:1522
 msgid "  Candidate: "
 msgid "  Candidate: "
 msgstr ""
 msgstr ""
 
 
-#: cmdline/apt-cache.cc:1530
+#: cmdline/apt-cache.cc:1532
 msgid "  Package Pin: "
 msgid "  Package Pin: "
 msgstr ""
 msgstr ""
 
 
 #. Show the priority tables
 #. Show the priority tables
-#: cmdline/apt-cache.cc:1539
+#: cmdline/apt-cache.cc:1541
 msgid "  Version Table:"
 msgid "  Version Table:"
 msgstr ""
 msgstr ""
 
 
-#: cmdline/apt-cache.cc:1554
+#: cmdline/apt-cache.cc:1556
 #, c-format
 #, c-format
 msgid "       %4i %s\n"
 msgid "       %4i %s\n"
 msgstr ""
 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-extracttemplates.cc:225 ftparchive/apt-ftparchive.cc:545
 #: cmdline/apt-get.cc:2256 cmdline/apt-sortpkgs.cc:144
 #: cmdline/apt-get.cc:2256 cmdline/apt-sortpkgs.cc:144
 #, c-format
 #, c-format
 msgid "%s %s for %s %s compiled on %s %s\n"
 msgid "%s %s for %s %s compiled on %s %s\n"
 msgstr ""
 msgstr ""
 
 
-#: cmdline/apt-cache.cc:1588
+#: cmdline/apt-cache.cc:1653
 msgid ""
 msgid ""
 "Usage: apt-cache [options] command\n"
 "Usage: apt-cache [options] command\n"
 "       apt-cache [options] add file1 [file2 ...]\n"
 "       apt-cache [options] add file1 [file2 ...]\n"
@@ -399,22 +399,22 @@ msgstr ""
 msgid " DeLink limit of %sB hit.\n"
 msgid " DeLink limit of %sB hit.\n"
 msgstr ""
 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
 #: apt-inst/extract.cc:210 apt-inst/deb/dpkgdb.cc:121
 #, c-format
 #, c-format
 msgid "Failed to stat %s"
 msgid "Failed to stat %s"
 msgstr ""
 msgstr ""
 
 
-#: ftparchive/writer.cc:372
+#: ftparchive/writer.cc:379
 msgid "Archive had no package field"
 msgid "Archive had no package field"
 msgstr ""
 msgstr ""
 
 
-#: ftparchive/writer.cc:380 ftparchive/writer.cc:589
+#: ftparchive/writer.cc:387 ftparchive/writer.cc:596
 #, c-format
 #, c-format
 msgid "  %s has no override entry\n"
 msgid "  %s has no override entry\n"
 msgstr ""
 msgstr ""
 
 
-#: ftparchive/writer.cc:423 ftparchive/writer.cc:671
+#: ftparchive/writer.cc:430 ftparchive/writer.cc:678
 #, c-format
 #, c-format
 msgid "  %s maintainer is %s not %s\n"
 msgid "  %s maintainer is %s not %s\n"
 msgstr ""
 msgstr ""