]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/aptconfiguration.cc
apt-key: change to / before find to satisfy its CWD needs
[apt.git] / apt-pkg / aptconfiguration.cc
index 53f29df799d4f9effd99905e9954bf5ac535092a..32778e273039bff82a08d3f2df96fa3d555d5bee 100644 (file)
@@ -35,8 +35,10 @@ namespace APT {
 // setDefaultConfigurationForCompressors                               /*{{{*/
 static void setDefaultConfigurationForCompressors() {
        // Set default application paths to check for optional compression types
 // setDefaultConfigurationForCompressors                               /*{{{*/
 static void setDefaultConfigurationForCompressors() {
        // Set default application paths to check for optional compression types
+       _config->CndSet("Dir::Bin::gzip", "/bin/gzip");
        _config->CndSet("Dir::Bin::bzip2", "/bin/bzip2");
        _config->CndSet("Dir::Bin::xz", "/usr/bin/xz");
        _config->CndSet("Dir::Bin::bzip2", "/bin/bzip2");
        _config->CndSet("Dir::Bin::xz", "/usr/bin/xz");
+       _config->CndSet("Dir::Bin::lz4", "/usr/bin/lz4");
        if (FileExists(_config->FindFile("Dir::Bin::xz")) == true) {
                _config->Set("Dir::Bin::lzma", _config->FindFile("Dir::Bin::xz"));
                _config->Set("APT::Compressor::lzma::Binary", "xz");
        if (FileExists(_config->FindFile("Dir::Bin::xz")) == true) {
                _config->Set("Dir::Bin::lzma", _config->FindFile("Dir::Bin::xz"));
                _config->Set("APT::Compressor::lzma::Binary", "xz");
@@ -59,6 +61,12 @@ static void setDefaultConfigurationForCompressors() {
                        _config->Set("APT::Compressor::lzma::UncompressArg::", "-d");
                }
        }
                        _config->Set("APT::Compressor::lzma::UncompressArg::", "-d");
                }
        }
+       // setup the defaults for the compressiontypes => method mapping
+       _config->CndSet("Acquire::CompressionTypes::xz","xz");
+       _config->CndSet("Acquire::CompressionTypes::bz2","bzip2");
+       _config->CndSet("Acquire::CompressionTypes::lzma","lzma");
+       _config->CndSet("Acquire::CompressionTypes::gz","gzip");
+       _config->CndSet("Acquire::CompressionTypes::lz4","lz4");
 }
                                                                        /*}}}*/
 // getCompressionTypes - Return Vector of usable compressiontypes      /*{{{*/
 }
                                                                        /*}}}*/
 // getCompressionTypes - Return Vector of usable compressiontypes      /*{{{*/
@@ -74,13 +82,6 @@ const Configuration::getCompressionTypes(bool const &Cached) {
                        types.clear();
        }
 
                        types.clear();
        }
 
-       // setup the defaults for the compressiontypes => method mapping
-       _config->CndSet("Acquire::CompressionTypes::xz","xz");
-       _config->CndSet("Acquire::CompressionTypes::bz2","bzip2");
-       _config->CndSet("Acquire::CompressionTypes::lzma","lzma");
-       _config->CndSet("Acquire::CompressionTypes::gz","gzip");
-
-       setDefaultConfigurationForCompressors();
        std::vector<APT::Configuration::Compressor> const compressors = getCompressors();
 
        // load the order setting into our vector
        std::vector<APT::Configuration::Compressor> const compressors = getCompressors();
 
        // load the order setting into our vector
@@ -396,12 +397,12 @@ const Configuration::getCompressors(bool const Cached) {
                compressors.push_back(Compressor("lzma",".lzma","false", NULL, NULL, 400));
 #endif
 
                compressors.push_back(Compressor("lzma",".lzma","false", NULL, NULL, 400));
 #endif
 
-       std::vector<std::string> const comp = _config->FindVector("APT::Compressor");
-       for (std::vector<std::string>::const_iterator c = comp.begin();
-            c != comp.end(); ++c) {
-               if (c->empty() || *c == "." || *c == "gzip" || *c == "bzip2" || *c == "lzma" || *c == "xz")
+       std::vector<std::string> const comp = _config->FindVector("APT::Compressor", "", true);
+       for (auto const &c: comp)
+       {
+               if (c.empty() || std::any_of(compressors.begin(), compressors.end(), [&c](Compressor const &ac) { return ac.Name == c; }))
                        continue;
                        continue;
-               compressors.push_back(Compressor(c->c_str(), std::string(".").append(*c).c_str(), c->c_str(), "-9", "-d", 100));
+               compressors.push_back(Compressor(c.c_str(), std::string(".").append(c).c_str(), c.c_str(), nullptr, nullptr, 1000));
        }
 
        return compressors;
        }
 
        return compressors;