]> git.saurik.com Git - apt.git/blobdiff - ftparchive/apt-ftparchive.cc
apt-pkg/cdrom.h: move new member to the end to minimize ABI risk
[apt.git] / ftparchive / apt-ftparchive.cc
index f3e91d90db330749d354604e8c8339a408ab4493..0c29002e60cf4e9eadf149ffd8ef0045ae0ac029 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>
@@ -135,7 +136,7 @@ void PackageMap::GetGeneral(Configuration &Setup,Configuration &Block)
                       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);
    
@@ -458,8 +459,11 @@ void LoadTree(vector<PackageMap> &PkgList,Configuration &Setup)
    string DFLFile = Setup.Find("TreeDefault::FileList", "");
    string DSFLFile = Setup.Find("TreeDefault::SourceFileList", "");
 
-   bool const LongDescription = Setup.FindB("TreeDefault::LongDescription",
+   mode_t 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");
@@ -479,13 +483,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 && 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;
@@ -495,7 +501,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);
 
@@ -544,6 +550,8 @@ void LoadTree(vector<PackageMap> &PkgList,Configuration &Setup)
 /* */
 void LoadBinDir(vector<PackageMap> &PkgList,Configuration &Setup)
 {
+   mode_t const Permissions = Setup.FindI("Default::FileMode",0644);
+
    // Process 'bindirectory' type sections
    const Configuration::Item *Top = Setup.Tree("bindirectory");
    for (Top = (Top == 0?0:Top->Child); Top != 0;)
@@ -563,6 +571,7 @@ void LoadBinDir(vector<PackageMap> &PkgList,Configuration &Setup)
       Itm.InternalPrefix = Block.Find("InternalPrefix",Top->Tag.c_str());
       Itm.Contents = Block.Find("Contents");
       Itm.ContentsHead = Block.Find("Contents::Header");
+      Itm.Permissions = Block.FindI("FileMode", Permissions);
       
       Itm.GetGeneral(Setup,Block);
       PkgList.push_back(Itm);
@@ -823,7 +832,7 @@ bool Generate(CommandLine &CmdL)
    }
 
    // close the Translation master files
-   for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); I++)
+   for (vector<PackageMap>::reverse_iterator I = PkgList.rbegin(); I != PkgList.rend(); I++)
       if (I->TransWriter != NULL && I->TransWriter->DecreaseRefCounter() == 0)
         delete I->TransWriter;
 
@@ -963,7 +972,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;