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.
This commit is contained in:
Christian Neukirchen 2014-09-19 16:25:50 +02:00 committed by Juan RP
parent 1d8777b6f4
commit cfc0e3b9d9

View File

@ -833,14 +833,17 @@ main(int argc, char **argv)
/* /*
* Set compression format, xz if unset. * 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); archive_write_add_filter_xz(ar);
else if (strcmp(compression, "gzip") == 0) } else if (strcmp(compression, "gzip") == 0) {
archive_write_add_filter_gzip(ar); 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); archive_write_add_filter_bzip2(ar);
else archive_write_set_options(ar, "compression-level=9");
} else {
die("unknown compression format %s"); die("unknown compression format %s");
}
archive_write_set_format_pax_restricted(ar); archive_write_set_format_pax_restricted(ar);
if ((resolver = archive_entry_linkresolver_new()) == NULL) if ((resolver = archive_entry_linkresolver_new()) == NULL)
@ -848,7 +851,6 @@ main(int argc, char **argv)
archive_entry_linkresolver_set_strategy(resolver, archive_entry_linkresolver_set_strategy(resolver,
archive_format(ar)); archive_format(ar));
archive_write_set_options(ar, "compression-level=9");
if (archive_write_open_fd(ar, pkg_fd) != 0) if (archive_write_open_fd(ar, pkg_fd) != 0)
die("Failed to open %s fd for writing:", tname); die("Failed to open %s fd for writing:", tname);