summaryrefslogtreecommitdiff
path: root/apt-pkg/aptconfiguration.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2018-03-08 09:33:39 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2018-03-12 08:56:59 +0100
commit4de4200ec2717e777bbf99ed82d1b4344f078ec2 (patch)
tree0b7e2c89802a69564f45e55907b698e63a84f205 /apt-pkg/aptconfiguration.cc
parent5206249ea92fccf9e812a2d373cbd2f16c623059 (diff)
apt-pkg: Add support for zstd
zstd is a compression algorithm developed by facebook. At level 19, it is about 6% worse in size than xz -6, but decompression is multiple times faster, saving about 40% install time, especially with eatmydata on cloud instances.
Diffstat (limited to 'apt-pkg/aptconfiguration.cc')
-rw-r--r--apt-pkg/aptconfiguration.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc
index 0421ea949..61e53ec3a 100644
--- a/apt-pkg/aptconfiguration.cc
+++ b/apt-pkg/aptconfiguration.cc
@@ -39,6 +39,7 @@ static void setDefaultConfigurationForCompressors() {
_config->CndSet("Dir::Bin::bzip2", "/bin/bzip2");
_config->CndSet("Dir::Bin::xz", "/usr/bin/xz");
_config->CndSet("Dir::Bin::lz4", "/usr/bin/lz4");
+ _config->CndSet("Dir::Bin::zstd", "/usr/bin/zstd");
if (FileExists(_config->Find("Dir::Bin::xz")) == true) {
_config->Set("Dir::Bin::lzma", _config->Find("Dir::Bin::xz"));
_config->Set("APT::Compressor::lzma::Binary", "xz");
@@ -67,6 +68,7 @@ static void setDefaultConfigurationForCompressors() {
_config->CndSet("Acquire::CompressionTypes::lzma","lzma");
_config->CndSet("Acquire::CompressionTypes::gz","gzip");
_config->CndSet("Acquire::CompressionTypes::lz4","lz4");
+ _config->CndSet("Acquire::CompressionTypes::zst", "zstd");
}
/*}}}*/
// getCompressionTypes - Return Vector of usable compressiontypes /*{{{*/
@@ -369,6 +371,12 @@ const Configuration::getCompressors(bool const Cached) {
# define APT_ADD_COMPRESSOR(NAME, EXT, BINARY, ARG, DEARG, COST) \
{ CompressorsDone.push_back(NAME); compressors.emplace_back(NAME, EXT, BINARY, ARG, DEARG, COST); }
APT_ADD_COMPRESSOR(".", "", "", nullptr, nullptr, 0)
+ if (_config->Exists("Dir::Bin::zstd") == false || FileExists(_config->Find("Dir::Bin::zstd")) == true)
+ APT_ADD_COMPRESSOR("zstd", ".zst", "zstd", "-19", "-d", 60)
+#ifdef HAVE_ZSTD
+ else
+ APT_ADD_COMPRESSOR("zstd", ".zst", "false", nullptr, nullptr, 60)
+#endif
if (_config->Exists("Dir::Bin::lz4") == false || FileExists(_config->Find("Dir::Bin::lz4")) == true)
APT_ADD_COMPRESSOR("lz4",".lz4","lz4","-1","-d",50)
#ifdef HAVE_LZ4