From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46574) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f2cVl-0007C8-Ny for guix-patches@gnu.org; Sun, 01 Apr 2018 08:55:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f2cVi-00035s-J4 for guix-patches@gnu.org; Sun, 01 Apr 2018 08:55:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:53909) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f2cVi-00035l-Fj for guix-patches@gnu.org; Sun, 01 Apr 2018 08:55:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1f2cVi-00041b-5U for guix-patches@gnu.org; Sun, 01 Apr 2018 08:55:02 -0400 Subject: [bug#31015] [PATCH] packages, scripts, utils: Respect (parallel-job-count) when xz-compressing. Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46480) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f2cVP-0006xG-Ov for guix-patches@gnu.org; Sun, 01 Apr 2018 08:54:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f2cVM-0002tE-Lb for guix-patches@gnu.org; Sun, 01 Apr 2018 08:54:43 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:59305) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f2cVM-0002sN-CM for guix-patches@gnu.org; Sun, 01 Apr 2018 08:54:40 -0400 From: Marius Bakke Date: Sun, 1 Apr 2018 14:54:31 +0200 Message-Id: <20180401125431.11996-1-mbakke@fastmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 31015@debbugs.gnu.org * guix/packages.scm (patch-and-repack): When invoking 'xz', tell it to use the amount of cores specified by e.g. 'guix build -c'. * guix/scripts/pack.scm (%compressors, bootstrap-xz): Likewise. While at it, use the long form '--threads=' for clarity. * guix/utils.scm (decompressed-port, compressed-port, compressed-output-port): Likewise. --- guix/packages.scm | 3 ++- guix/scripts/pack.scm | 7 +++++-- guix/utils.scm | 18 +++++++++++++++--- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/guix/packages.scm b/guix/packages.scm index ab4b6278d..cca2c6357 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -604,7 +604,8 @@ specifies modules in scope when evaluating SNIPPET." ;; threaded compression (introduced in ;; 5.2.0), but it ignores the extra flag. (string-append "--use-compress-program=" - #+xz "/bin/xz --threads=0") + #+xz "/bin/xz --threads=" + (number->string (parallel-job-count))) ;; avoid non-determinism in the archive "--mtime=@0" "--owner=root:0" diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index 488638adc..818de0f32 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -65,7 +65,9 @@ (compressor "lzip" ".lz" #~(#+(file-append lzip "/bin/lzip") "-9")) (compressor "xz" ".xz" - #~(#+(file-append xz "/bin/xz") "-e -T0")) + #~(#+(file-append xz "/bin/xz") + (string-append "-e --threads=" + (number->string (parallel-job-count))))) (compressor "bzip2" ".bz2" #~(#+(file-append bzip2 "/bin/bzip2") "-9")) (compressor "none" "" #f))) @@ -73,7 +75,8 @@ ;; This one is only for use in this module, so don't put it in %compressors. (define bootstrap-xz (compressor "bootstrap-xz" ".xz" - #~(#+(file-append %bootstrap-coreutils&co "/bin/xz") "-e -T0"))) + #~(#+(file-append %bootstrap-coreutils&co "/bin/xz") + (string-append "-e --threads=" (number->string (parallel-job-count)))))) (define (lookup-compressor name) "Return the compressor object called NAME. Error out if it could not be diff --git a/guix/utils.scm b/guix/utils.scm index 92e45de61..043034e99 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -172,7 +172,11 @@ a symbol such as 'xz." (match compression ((or #f 'none) (values input '())) ('bzip2 (filtered-port `(,%bzip2 "-dc") input)) - ('xz (filtered-port `(,%xz "-dc" "-T0") input)) + ('xz (filtered-port + `(,%xz "-dc" (string-append + "--threads=" + (number->string (parallel-job-count)))) + input)) ('gzip (filtered-port `(,%gzip "-dc") input)) (else (error "unsupported compression scheme" compression)))) @@ -182,7 +186,11 @@ a symbol such as 'xz." (match compression ((or #f 'none) (values input '())) ('bzip2 (filtered-port `(,%bzip2 "-c") input)) - ('xz (filtered-port `(,%xz "-c" "-T0") input)) + ('xz (filtered-port + `(,%xz "-c" (string-append + "--threads=" + (number->string (parallel-job-count)))) + input)) ('gzip (filtered-port `(,%gzip "-c") input)) (else (error "unsupported compression scheme" compression)))) @@ -239,7 +247,11 @@ program--e.g., '(\"--fast\")." (match compression ((or #f 'none) (values output '())) ('bzip2 (filtered-output-port `(,%bzip2 "-c" ,@options) output)) - ('xz (filtered-output-port `(,%xz "-c" "-T0" ,@options) output)) + ('xz (filtered-output-port + `(,%xz "-c" (string-append + "--threads=" + (number->string (parallel-job-count))) + ,@options) output)) ('gzip (filtered-output-port `(,%gzip "-c" ,@options) output)) (else (error "unsupported compression scheme" compression)))) -- 2.16.3