Просмотр исходного кода

Inclusion of Long Descriptions in the Packages files can be set now
also in TreeDefaults and Tree to support generation of archives which
should support and which shouldn't support splitted out Translation-en
files in the same run.

David Kalnischkies лет назад: 16
Родитель
Сommit
4e794c509b
2 измененных файлов с 32 добавлено и 6 удалено
  1. 23 4
      doc/apt-ftparchive.1.xml
  2. 9 2
      ftparchive/apt-ftparchive.cc

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

@@ -289,7 +289,20 @@
       Sets the output Sources file. Defaults to 
       Sets the output Sources file. Defaults to 
       <filename>$(DIST)/$(SECTION)/source/Sources</filename></para></listitem>
       <filename>$(DIST)/$(SECTION)/source/Sources</filename></para></listitem>
       </varlistentry>
       </varlistentry>
-      
+
+      <varlistentry><term>Translation</term>
+      <listitem><para>
+      Set the output Translation-en master file with the long descriptions if they
+      should be not included in the Packages file. Defaults to
+      <filename>$(DIST)/$(SECTION)/i18n/Translation-en</filename></para></listitem>
+      </varlistentry>
+
+      <varlistentry><term>LongDescription</term>
+      <listitem><para>
+      Sets if long descriptions should be included in the Packages file or split
+      out into a master Translation-en file.</para></listitem>
+      </varlistentry>
+
       <varlistentry><term>InternalPrefix</term>
       <varlistentry><term>InternalPrefix</term>
       <listitem><para>
       <listitem><para>
       Sets the path prefix that causes a symlink to be
       Sets the path prefix that causes a symlink to be
@@ -371,7 +384,13 @@ for i in Sections do
       architectures that appear under search section. The special architecture 
       architectures that appear under search section. The special architecture 
       'source' is used to indicate that this tree has a source archive.</para></listitem>
       'source' is used to indicate that this tree has a source archive.</para></listitem>
       </varlistentry>
       </varlistentry>
-      
+
+      <varlistentry><term>LongDescription</term>
+      <listitem><para>
+      Sets if long descriptions should be included in the Packages file or split
+      out into a master Translation-en file.</para></listitem>
+      </varlistentry>
+
       <varlistentry><term>BinOverride</term>
       <varlistentry><term>BinOverride</term>
       <listitem><para>
       <listitem><para>
       Sets the binary override file. The override file 
       Sets the binary override file. The override file 
@@ -568,8 +587,8 @@ for i in Sections do
      <listitem><para>
      <listitem><para>
      This configuration option defaults to "<literal>true</literal>" and should only be set to
      This configuration option defaults to "<literal>true</literal>" and should only be set to
      <literal>"false"</literal> if the Archive generated with &apt-ftparchive; also provides
      <literal>"false"</literal> if the Archive generated with &apt-ftparchive; also provides
-     <filename>Translation</filename> files. Note that it is currently not possible to create these
-     files with <command>apt-ftparchive</command>.
+     <filename>Translation</filename> files. Note that the <filename>Translation-en</filename>
+     master file can only be created in the generate command.
      </para></listitem>
      </para></listitem>
      </varlistentry>
      </varlistentry>
 
 

+ 9 - 2
ftparchive/apt-ftparchive.cc

@@ -63,6 +63,7 @@ struct PackageMap
    string SrcExtraOverride;
    string SrcExtraOverride;
 
 
    // Translation master file
    // Translation master file
+   bool LongDesc;
    TranslationWriter *TransWriter;
    TranslationWriter *TransWriter;
 
 
    // Contents 
    // Contents 
@@ -103,7 +104,7 @@ struct PackageMap
 		    vector<PackageMap>::iterator End,
 		    vector<PackageMap>::iterator End,
 		    unsigned long &Left);
 		    unsigned long &Left);
    
    
-   PackageMap() : TransWriter(NULL), DeLinkLimit(0), Permissions(1),
+   PackageMap() : LongDesc(true), TransWriter(NULL), DeLinkLimit(0), Permissions(1),
 		  ContentsDone(false), PkgDone(false), SrcDone(false),
 		  ContentsDone(false), PkgDone(false), SrcDone(false),
 		  ContentsMTime(0) {};
 		  ContentsMTime(0) {};
 };
 };
@@ -174,6 +175,7 @@ bool PackageMap::GenPackages(Configuration &Setup,struct CacheDB::Stats &Stats)
    Packages.InternalPrefix = flCombine(ArchiveDir,InternalPrefix);
    Packages.InternalPrefix = flCombine(ArchiveDir,InternalPrefix);
 
 
    Packages.TransWriter = TransWriter;
    Packages.TransWriter = TransWriter;
+   Packages.LongDescription = LongDesc;
 
 
    Packages.Stats.DeLinkBytes = Stats.DeLinkBytes;
    Packages.Stats.DeLinkBytes = Stats.DeLinkBytes;
    Packages.DeLinkLimit = DeLinkLimit;
    Packages.DeLinkLimit = DeLinkLimit;
@@ -456,6 +458,9 @@ void LoadTree(vector<PackageMap> &PkgList,Configuration &Setup)
    string DFLFile = Setup.Find("TreeDefault::FileList", "");
    string DFLFile = Setup.Find("TreeDefault::FileList", "");
    string DSFLFile = Setup.Find("TreeDefault::SourceFileList", "");
    string DSFLFile = Setup.Find("TreeDefault::SourceFileList", "");
 
 
+   bool const LongDescription = Setup.FindB("TreeDefault::LongDescription",
+					_config->FindB("APT::FTPArchive::LongDescription", true));
+
    // Process 'tree' type sections
    // Process 'tree' type sections
    const Configuration::Item *Top = Setup.Tree("tree");
    const Configuration::Item *Top = Setup.Tree("tree");
    for (Top = (Top == 0?0:Top->Child); Top != 0;)
    for (Top = (Top == 0?0:Top->Child); Top != 0;)
@@ -474,8 +479,9 @@ void LoadTree(vector<PackageMap> &PkgList,Configuration &Setup)
 					 {"$(SECTION)",&Section},
 					 {"$(SECTION)",&Section},
 					 {"$(ARCH)",&Arch},
 					 {"$(ARCH)",&Arch},
 					 {}};
 					 {}};
+	 bool const LongDesc = Block.FindB("LongDescription", LongDescription);
 	 TranslationWriter *TransWriter;
 	 TranslationWriter *TransWriter;
-	 if (DTrans.empty() == false)
+	 if (DTrans.empty() == false && LongDesc == false)
 	 {
 	 {
 	    string const TranslationFile = flCombine(Setup.FindDir("Dir::ArchiveDir"),
 	    string const TranslationFile = flCombine(Setup.FindDir("Dir::ArchiveDir"),
 			SubstVar(Block.Find("Translation", DTrans.c_str()), Vars));
 			SubstVar(Block.Find("Translation", DTrans.c_str()), Vars));
@@ -509,6 +515,7 @@ void LoadTree(vector<PackageMap> &PkgList,Configuration &Setup)
 	       Itm.PkgFile = SubstVar(Block.Find("Packages",DPkg.c_str()),Vars);
 	       Itm.PkgFile = SubstVar(Block.Find("Packages",DPkg.c_str()),Vars);
 	       Itm.Tag = SubstVar("$(DIST)/$(SECTION)/$(ARCH)",Vars);
 	       Itm.Tag = SubstVar("$(DIST)/$(SECTION)/$(ARCH)",Vars);
 	       Itm.Arch = Arch;
 	       Itm.Arch = Arch;
+	       Itm.LongDesc = LongDesc;
 	       if (TransWriter != NULL)
 	       if (TransWriter != NULL)
 	       {
 	       {
 		  TransWriter->IncreaseRefCounter();
 		  TransWriter->IncreaseRefCounter();