ソースを参照

* ftparchive/writer.cc:
- add config option to search for more patterns in release command

David Kalnischkies 15 年 前
コミット
3cb3fe76e9
共有4 個のファイルを変更した27 個の追加16 個の削除を含む
  1. 3 1
      debian/changelog
  2. 7 4
      doc/apt-ftparchive.1.xml
  3. 15 11
      ftparchive/writer.cc
  4. 2 0
      ftparchive/writer.h

+ 3 - 1
debian/changelog

@@ -59,8 +59,10 @@ apt (0.8.11+wheezy) unstable; urgency=low
       can be used without being root (Closes: #393005, #592107)
   * apt-pkg/deb/deblistparser.cc:
     - rewrite LoadReleaseInfo to cope with clearsigned Releasefiles
+  * ftparchive/writer.cc:
+    - add config option to search for more patterns in release command
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Thu, 20 Jan 2011 14:52:32 +0100
+ -- David Kalnischkies <kalnischkies@gmail.com>  Thu, 20 Jan 2011 16:00:54 +0100
 
 apt (0.8.10) unstable; urgency=low
 

+ 7 - 4
doc/apt-ftparchive.1.xml

@@ -113,10 +113,13 @@
      <varlistentry><term>release</term>
      <listitem><para>
      The <literal>release</literal> command generates a Release file from a
-     directory tree. It recursively searches the given directory for
-     Packages, Packages.gz, Packages.bz2, Sources, Sources.gz,
-     Sources.bz2, Release and md5sum.txt files.  It then writes to
-     stdout a Release file containing an MD5 digest and SHA1 digest
+     directory tree. It recursively searches the given directory for uncompressed
+     <filename>Packages</filename> and <filename>Sources</filename> files and the ones
+     compressed with <command>gzip</command>, <command>bzip2</command> or <command>lzma</command>
+     as well as <filename>Release</filename> and <filename>md5sum.txt</filename> files by default
+     (<literal>APT::FTPArchive::Release::Default-Patterns</literal>). Additional filename patterns
+     can be added by listing them in <literal>APT::FTPArchive::Release::Patterns</literal>.
+     It then writes to stdout a Release file containing a MD5, SHA1 and SHA256 digest
      for each file.</para>
      <para>
      Values for the additional metadata fields in the Release file are

+ 15 - 11
ftparchive/writer.cc

@@ -306,7 +306,7 @@ PackagesWriter::PackagesWriter(string const &DB,string const &Overrides,string c
    Output = stdout;
    SetExts(".deb .udeb");
    DeLinkLimit = 0;
-   
+
    // Process the command line options
    DoMD5 = _config->FindB("APT::FTPArchive::MD5",true);
    DoSHA1 = _config->FindB("APT::FTPArchive::SHA1",true);
@@ -907,16 +907,20 @@ bool ContentsWriter::ReadFromPkgs(string const &PkgFile,string const &PkgCompres
 /* */
 ReleaseWriter::ReleaseWriter(string const &DB)
 {
-   AddPattern("Packages");
-   AddPattern("Packages.gz");
-   AddPattern("Packages.bz2");
-   AddPattern("Packages.lzma");
-   AddPattern("Sources");
-   AddPattern("Sources.gz");
-   AddPattern("Sources.bz2");
-   AddPattern("Sources.lzma");
-   AddPattern("Release");
-   AddPattern("md5sum.txt");
+   if (_config->FindB("APT::FTPArchive::Release::Default-Patterns", true) == true)
+   {
+      AddPattern("Packages");
+      AddPattern("Packages.gz");
+      AddPattern("Packages.bz2");
+      AddPattern("Packages.lzma");
+      AddPattern("Sources");
+      AddPattern("Sources.gz");
+      AddPattern("Sources.bz2");
+      AddPattern("Sources.lzma");
+      AddPattern("Release");
+      AddPattern("md5sum.txt");
+   }
+   AddPatterns(_config->FindVector("APT::FTPArchive::Release::Patterns"));
 
    Output = stdout;
    time_t const now = time(NULL);

+ 2 - 0
ftparchive/writer.h

@@ -69,6 +69,8 @@ class FTWScanner
    bool LoadFileList(string const &BaseDir,string const &File);
    void ClearPatterns() { Patterns.clear(); };
    void AddPattern(string const &Pattern) { Patterns.push_back(Pattern); };
+   void AddPattern(char const *Pattern) { Patterns.push_back(Pattern); };
+   void AddPatterns(std::vector<std::string> const &patterns) { Patterns.insert(Patterns.end(), patterns.begin(), patterns.end()); };
    bool SetExts(string const &Vals);
       
    FTWScanner(string const &Arch = string());