From 2024154c6d4fa1142b022d54f8c88cf8991929ff Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 5 Apr 2012 18:49:13 +0200 Subject: * apt-pkg/aptconfiguration.cc: - if present, prefer xz binary over lzma --- apt-pkg/aptconfiguration.cc | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index 4324f0e63..2fdb837c5 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -432,9 +432,30 @@ bool const Configuration::checkArchitecture(std::string const &Arch) { // setDefaultConfigurationForCompressors /*{{{*/ void Configuration::setDefaultConfigurationForCompressors() { // Set default application paths to check for optional compression types - _config->CndSet("Dir::Bin::lzma", "/usr/bin/lzma"); - _config->CndSet("Dir::Bin::xz", "/usr/bin/xz"); _config->CndSet("Dir::Bin::bzip2", "/bin/bzip2"); + _config->CndSet("Dir::Bin::xz", "/usr/bin/xz"); + if (FileExists(_config->FindFile("Dir::Bin::xz")) == true) { + _config->CndSet("Dir::Bin::lzma", _config->Find("Dir::Bin::xz")); + _config->Set("APT::Compressor::lzma::Binary", "xz"); + if (_config->Exists("APT::Compressor::lzma::CompressArg") == false) { + _config->Set("APT::Compressor::lzma::CompressArg::", "--format=lzma"); + _config->Set("APT::Compressor::lzma::CompressArg::", "-9"); + } + if (_config->Exists("APT::Compressor::lzma::UncompressArg") == false) { + _config->Set("APT::Compressor::lzma::UncompressArg::", "--format=lzma"); + _config->Set("APT::Compressor::lzma::UncompressArg::", "-d"); + } + } else { + _config->CndSet("Dir::Bin::lzma", "/usr/bin/lzma"); + if (_config->Exists("APT::Compressor::lzma::CompressArg") == false) { + _config->Set("APT::Compressor::lzma::CompressArg::", "--suffix="); + _config->Set("APT::Compressor::lzma::CompressArg::", "-9"); + } + if (_config->Exists("APT::Compressor::lzma::UncompressArg") == false) { + _config->Set("APT::Compressor::lzma::UncompressArg::", "--suffix="); + _config->Set("APT::Compressor::lzma::UncompressArg::", "-d"); + } + } } /*}}}*/ // getCompressors - Return Vector of usbale compressors /*{{{*/ @@ -458,10 +479,10 @@ const Configuration::getCompressors(bool const Cached) { compressors.push_back(Compressor("gzip",".gz","gzip","-9n","-d",2)); if (_config->Exists("Dir::Bin::bzip2") == false || FileExists(_config->FindFile("Dir::Bin::bzip2")) == true) compressors.push_back(Compressor("bzip2",".bz2","bzip2","-9","-d",3)); - if (_config->Exists("Dir::Bin::lzma") == false || FileExists(_config->FindFile("Dir::Bin::lzma")) == true) - compressors.push_back(Compressor("lzma",".lzma","lzma","-9","-d",4)); if (_config->Exists("Dir::Bin::xz") == false || FileExists(_config->FindFile("Dir::Bin::xz")) == true) - compressors.push_back(Compressor("xz",".xz","xz","-6","-d",5)); + compressors.push_back(Compressor("xz",".xz","xz","-6","-d",4)); + if (_config->Exists("Dir::Bin::lzma") == false || FileExists(_config->FindFile("Dir::Bin::lzma")) == true) + compressors.push_back(Compressor("lzma",".lzma","lzma","-9","-d",5)); std::vector const comp = _config->FindVector("APT::Compressor"); for (std::vector::const_iterator c = comp.begin(); @@ -494,7 +515,7 @@ Configuration::Compressor::Compressor(char const *name, char const *extension, char const *binary, char const *compressArg, char const *uncompressArg, unsigned short const cost) { - std::string const config = std::string("APT:Compressor::").append(name).append("::"); + std::string const config = std::string("APT::Compressor::").append(name).append("::"); Name = _config->Find(std::string(config).append("Name"), name); Extension = _config->Find(std::string(config).append("Extension"), extension); Binary = _config->Find(std::string(config).append("Binary"), binary); -- cgit v1.2.3-70-g09d2