]> git.saurik.com Git - apt.git/blobdiff - ftparchive/apt-ftparchive.cc
* debian/apt.cron.daily:
[apt.git] / ftparchive / apt-ftparchive.cc
index e69c88ddd5c2b8d11fd8132ef8ea2719995795e9..6f9fa7ab39b992f85e90c89e4217eb70b0dfcace 100644 (file)
@@ -16,6 +16,7 @@
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/init.h>
 #include <config.h>
 #include <apti18n.h>
 #include <algorithm>
@@ -63,6 +64,7 @@ struct PackageMap
    string SrcExtraOverride;
 
    // Translation master file
+   bool LongDesc;
    TranslationWriter *TransWriter;
 
    // Contents 
@@ -103,7 +105,7 @@ struct PackageMap
                    vector<PackageMap>::iterator End,
                    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),
                  ContentsMTime(0) {};
 };
@@ -133,8 +135,6 @@ void PackageMap::GetGeneral(Configuration &Setup,Configuration &Block)
    PkgExt = Block.Find("Packages::Extensions",
                       Setup.Find("Default::Packages::Extensions",".deb").c_str());
    
-   Permissions = Setup.FindI("Default::FileMode",0644);
-   
    if (FLFile.empty() == false)
       FLFile = flCombine(Setup.Find("Dir::FileListDir"),FLFile);
    
@@ -174,6 +174,7 @@ bool PackageMap::GenPackages(Configuration &Setup,struct CacheDB::Stats &Stats)
    Packages.InternalPrefix = flCombine(ArchiveDir,InternalPrefix);
 
    Packages.TransWriter = TransWriter;
+   Packages.LongDescription = LongDesc;
 
    Packages.Stats.DeLinkBytes = Stats.DeLinkBytes;
    Packages.DeLinkLimit = DeLinkLimit;
@@ -456,6 +457,12 @@ void LoadTree(vector<PackageMap> &PkgList,Configuration &Setup)
    string DFLFile = Setup.Find("TreeDefault::FileList", "");
    string DSFLFile = Setup.Find("TreeDefault::SourceFileList", "");
 
+   int const Permissions = Setup.FindI("Default::FileMode",0644);
+
+   bool const LongDescription = Setup.FindB("Default::LongDescription",
+                                       _config->FindB("APT::FTPArchive::LongDescription", true));
+   string const TranslationCompress = Setup.Find("Default::Translation::Compress",". gzip").c_str();
+
    // Process 'tree' type sections
    const Configuration::Item *Top = Setup.Tree("tree");
    for (Top = (Top == 0?0:Top->Child); Top != 0;)
@@ -474,12 +481,15 @@ void LoadTree(vector<PackageMap> &PkgList,Configuration &Setup)
                                         {"$(SECTION)",&Section},
                                         {"$(ARCH)",&Arch},
                                         {}};
+        mode_t const Perms = Block.FindI("FileMode", Permissions);
+        bool const LongDesc = Block.FindB("LongDescription", LongDescription);
         TranslationWriter *TransWriter;
-        if (DTrans.empty() == false)
+        if (DTrans.empty() == false && LongDesc == false)
         {
            string const TranslationFile = flCombine(Setup.FindDir("Dir::ArchiveDir"),
                        SubstVar(Block.Find("Translation", DTrans.c_str()), Vars));
-           TransWriter = new TranslationWriter(TranslationFile);
+           string const TransCompress = Block.Find("Translation::Compress", TranslationCompress);
+           TransWriter = new TranslationWriter(TranslationFile, TransCompress, Perms);
         }
         else
            TransWriter = NULL;
@@ -489,7 +499,7 @@ void LoadTree(vector<PackageMap> &PkgList,Configuration &Setup)
         while (ParseQuoteWord(Archs,Arch) == true)
         {
            PackageMap Itm;
-           
+           Itm.Permissions = Perms;
            Itm.BinOverride = SubstVar(Block.Find("BinOverride"),Vars);
            Itm.InternalPrefix = SubstVar(Block.Find("InternalPrefix",DIPrfx.c_str()),Vars);
 
@@ -509,6 +519,7 @@ void LoadTree(vector<PackageMap> &PkgList,Configuration &Setup)
               Itm.PkgFile = SubstVar(Block.Find("Packages",DPkg.c_str()),Vars);
               Itm.Tag = SubstVar("$(DIST)/$(SECTION)/$(ARCH)",Vars);
               Itm.Arch = Arch;
+              Itm.LongDesc = LongDesc;
               if (TransWriter != NULL)
               {
                  TransWriter->IncreaseRefCounter();
@@ -956,7 +967,7 @@ int main(int argc, const char *argv[])
 
    // Parse the command line and initialize the package library
    CommandLine CmdL(Args,_config);
-   if (CmdL.Parse(argc,argv) == false)
+   if (pkgInitConfig(*_config) == false || CmdL.Parse(argc,argv) == false)
    {
       _error->DumpErrors();
       return 100;