From cfc0e3b9d99f67c6816237e41e33a308fbb2e72a Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Fri, 19 Sep 2014 16:25:50 +0200 Subject: [PATCH] xbps-create: do not compress with xz -9 xz -9 is very expensive in terms of CPU and memory usage, and also memory usage for decompression. Thus we stick to default of -6 for xz. For gzip and bzip2, -9 is ok. --- bin/xbps-create/main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bin/xbps-create/main.c b/bin/xbps-create/main.c index 0533a0b2..f84d630e 100644 --- a/bin/xbps-create/main.c +++ b/bin/xbps-create/main.c @@ -833,14 +833,17 @@ main(int argc, char **argv) /* * Set compression format, xz if unset. */ - if (compression == NULL || strcmp(compression, "xz") == 0) + if (compression == NULL || strcmp(compression, "xz") == 0) { archive_write_add_filter_xz(ar); - else if (strcmp(compression, "gzip") == 0) + } else if (strcmp(compression, "gzip") == 0) { archive_write_add_filter_gzip(ar); - else if (strcmp(compression, "bzip2") == 0) + archive_write_set_options(ar, "compression-level=9"); + } else if (strcmp(compression, "bzip2") == 0) { archive_write_add_filter_bzip2(ar); - else + archive_write_set_options(ar, "compression-level=9"); + } else { die("unknown compression format %s"); + } archive_write_set_format_pax_restricted(ar); if ((resolver = archive_entry_linkresolver_new()) == NULL) @@ -848,7 +851,6 @@ main(int argc, char **argv) archive_entry_linkresolver_set_strategy(resolver, archive_format(ar)); - archive_write_set_options(ar, "compression-level=9"); if (archive_write_open_fd(ar, pkg_fd) != 0) die("Failed to open %s fd for writing:", tname);