summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2012-04-05 18:49:13 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2012-04-05 18:49:13 +0200
commit2024154c6d4fa1142b022d54f8c88cf8991929ff (patch)
treea8ab445651015a6cd733015be4aba58c229ab71d /apt-pkg
parent7efb8c8ef10c1d0b9479c24a6a5b4e96fc0e6286 (diff)
* apt-pkg/aptconfiguration.cc:
- if present, prefer xz binary over lzma
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/aptconfiguration.cc33
1 files changed, 27 insertions, 6 deletions
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<std::string> const comp = _config->FindVector("APT::Compressor");
for (std::vector<std::string>::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);