handle pkgnames shorter than modifiers
[ntk/apt.git] / apt-pkg / aptconfiguration.cc
index 941a9c3..9982759 100644 (file)
@@ -462,13 +462,21 @@ const Configuration::getCompressors(bool const Cached) {
 #endif
        if (_config->Exists("Dir::Bin::xz") == false || FileExists(_config->FindFile("Dir::Bin::xz")) == true)
                compressors.push_back(Compressor("xz",".xz","xz","-6","-d",4));
+#ifdef HAVE_LZMA
+       else
+               compressors.push_back(Compressor("xz",".xz","false", NULL, NULL, 4));
+#endif
        if (_config->Exists("Dir::Bin::lzma") == false || FileExists(_config->FindFile("Dir::Bin::lzma")) == true)
                compressors.push_back(Compressor("lzma",".lzma","lzma","-9","-d",5));
+#ifdef HAVE_LZMA
+       else
+               compressors.push_back(Compressor("lzma",".lzma","false", NULL, NULL, 5));
+#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 == "." || *c == "gzip" || *c == "bzip2" || *c == "lzma" || *c == "xz")
+               if (c->empty() || *c == "." || *c == "gzip" || *c == "bzip2" || *c == "lzma" || *c == "xz")
                        continue;
                compressors.push_back(Compressor(c->c_str(), std::string(".").append(*c).c_str(), c->c_str(), "-9", "-d", 100));
        }