From patchwork Thu Jan 4 16:48:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 58353 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id E4A5927BBEA; Thu, 4 Jan 2024 16:51:06 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 9654227BBE9 for ; Thu, 4 Jan 2024 16:51:06 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLQvs-0003Sb-Nq; Thu, 04 Jan 2024 11:51:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLQvq-0003S6-Vx for guix-patches@gnu.org; Thu, 04 Jan 2024 11:50:59 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLQvq-000139-NB for guix-patches@gnu.org; Thu, 04 Jan 2024 11:50:58 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rLQvu-0005WP-EF for guix-patches@gnu.org; Thu, 04 Jan 2024 11:51:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68242] [PATCH 1/5] utils: Lower xz compression memory usage limit to 20%. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 04 Jan 2024 16:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68242 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68242@debbugs.gnu.org Cc: Maxim Cournoyer Received: via spool by 68242-submit@debbugs.gnu.org id=B68242.170438700321102 (code B ref 68242); Thu, 04 Jan 2024 16:51:02 +0000 Received: (at 68242) by debbugs.gnu.org; 4 Jan 2024 16:50:03 +0000 Received: from localhost ([127.0.0.1]:55545 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLQuw-0005UH-5H for submit@debbugs.gnu.org; Thu, 04 Jan 2024 11:50:02 -0500 Received: from mail-qv1-xf29.google.com ([2607:f8b0:4864:20::f29]:60781) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLQut-0005TY-Al for 68242@debbugs.gnu.org; Thu, 04 Jan 2024 11:49:59 -0500 Received: by mail-qv1-xf29.google.com with SMTP id 6a1803df08f44-680adbf077dso3358986d6.1 for <68242@debbugs.gnu.org>; Thu, 04 Jan 2024 08:49:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704386989; x=1704991789; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=c1I23V7l8eXQA+lX6MILN8YlIog5MupwuEFf7p6YhT4=; b=P+UPLhfangMXj0yLTsQfdK0Byb2JOJNdtfxvRIeXHi/GevTdrY6kHMc6phvNoW+8nf kdQDo3CtFtRkBLtl0chvwZt0TfTCP8mUrNGZYBu7AXrJBB1VguJQop8aHe/1qa7dXDX7 hwUaOW14FEKSX0cx/4RhJMcZBh1bFxzswKBid0psDYXAhqay4sGGzmpIlsPbLgFElhVk ITfIJD2dPCgj4CSWmN1Lu3UOSiw8Gh5ZYmZHLjgUo4TxUKRH6p4b3mT2xO3I14HuvSXj /5Fjy5dLLJPazGTtUpdWvPn+42LMkXg+WWmF8X9Nl2TArYuNbOkkw/ab+S/5mpmObXXO GAkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704386989; x=1704991789; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c1I23V7l8eXQA+lX6MILN8YlIog5MupwuEFf7p6YhT4=; b=lLastnO9reKbsLW3RvON/VDURzo7RpFf3Yninn9xDvI88avazFdwVF0IVeSC1xucwv JcaliWj5+2dbSJV9fCHB9Tu5Kwkb8HYWszkT4aaUrJz363bkSWT0qhlT+yx9Bmivjcep Pvl9SefQGHO8064c9E0DFuZYRzI517oBpEVaFZb8VaKg4Rd8Elv2ZMMVeG4X7vGVNFWE XwpG+UKL7kcNYiToaDEFaiyHTazYdE0iHjge8dt/9JQZv/xDshJoguZ4YxSHqGMeNEAq L/qoozxWTSK3QB+rd2qDxi7Bv5TCUdS85XpkRzmbq2X2JAHmkxxfOsI2Acu6mt0bD1Ji xYtQ== X-Gm-Message-State: AOJu0YyIvz4l7Zg/6N5549sT42fKciGmoS4vIlG9ygg3oBQ9X/kt/GZ4 qAhlrXROAwCMSdr9yFYTpf13GhSdvlwWOg== X-Google-Smtp-Source: AGHT+IHE18ldLUKI8RGU2h7MM7kB4Z4ZUons7U3qu1qVw8PJm/ubCWuPgCNayftPinWHctXy+RfAGQ== X-Received: by 2002:a05:6214:20ec:b0:67f:1c79:88e1 with SMTP id 12-20020a05621420ec00b0067f1c7988e1mr936542qvk.40.1704386989278; Thu, 04 Jan 2024 08:49:49 -0800 (PST) Received: from localhost.localdomain (dsl-10-135-125.b2b2c.ca. [72.10.135.125]) by smtp.gmail.com with ESMTPSA id o2-20020a0cecc2000000b0067aab230ed9sm11854706qvq.21.2024.01.04.08.49.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 08:49:48 -0800 (PST) From: Maxim Cournoyer Date: Thu, 4 Jan 2024 11:48:17 -0500 Message-ID: <148980a1febb6921bd1b02da6c6d5b9defecd50a.1704386901.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches There were sometimes out of memory errors on the Berlin build farm, especially for i686 or arm machines having less memory. * guix/build/utils.scm (%xz-parallel-args): Reduce --memlimit value from 50% to 20%. Change-Id: If848bed92ef4c42d11a96057e59ee51a019d0573 --- guix/build/utils.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 8e630ad586..e87066cc02 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -186,7 +186,7 @@ (define (tarball? file-name) (define (%xz-parallel-args) "The xz arguments required to enable bit-reproducible, multi-threaded compression." - (list "--memlimit=50%" + (list "--memlimit=20%" (format #f "--threads=~a" (max 2 (parallel-job-count))))) From patchwork Thu Jan 4 16:48:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 58356 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1E70327BBEA; Thu, 4 Jan 2024 16:51:40 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 9208827BBE2 for ; Thu, 4 Jan 2024 16:51:39 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLQvu-0003T7-Eu; Thu, 04 Jan 2024 11:51:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLQvr-0003SR-Ew for guix-patches@gnu.org; Thu, 04 Jan 2024 11:50:59 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLQvr-00016u-6L for guix-patches@gnu.org; Thu, 04 Jan 2024 11:50:59 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rLQvu-0005WW-TV for guix-patches@gnu.org; Thu, 04 Jan 2024 11:51:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68242] [PATCH 2/5] compression: Enable zstd parallel compression. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 04 Jan 2024 16:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68242 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68242@debbugs.gnu.org Cc: Maxim Cournoyer Received: via spool by 68242-submit@debbugs.gnu.org id=B68242.170438700521123 (code B ref 68242); Thu, 04 Jan 2024 16:51:02 +0000 Received: (at 68242) by debbugs.gnu.org; 4 Jan 2024 16:50:05 +0000 Received: from localhost ([127.0.0.1]:55549 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLQuy-0005UY-O7 for submit@debbugs.gnu.org; Thu, 04 Jan 2024 11:50:05 -0500 Received: from mail-qk1-x730.google.com ([2607:f8b0:4864:20::730]:58794) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLQuu-0005Tb-RG for 68242@debbugs.gnu.org; Thu, 04 Jan 2024 11:50:01 -0500 Received: by mail-qk1-x730.google.com with SMTP id af79cd13be357-78160ce40ceso44959685a.1 for <68242@debbugs.gnu.org>; Thu, 04 Jan 2024 08:49:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704386991; x=1704991791; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MRpF8Igy6aH+4rajax5A1C1kV57pcy2RBWf3lBfFgqw=; b=XJYwg6svc7BD0udnYUYM1aSXnqNQkCKbw6/CLU3gPLRDr/9MlzCg59V3b6W3bbcB43 K+O9hfbPLCRPfL0efsP3gTKwq+Xt8qocF1/tGo8Qr5r03hWMzcotrVCt8XcDKlUaV1qR y9OVkQ6FwPAsUNVr/C6qzZHh6LkJ0P1QUxVJnDPcGwGN6+pYx+6VyWa/mIE76eiv7ADP AMqcfRm+Beoa9l+kTActcgHfFN3xleDxdQYh9yTLxFp8kK3lV69qAvOo0tZGcTt/LMLY ebsnlfnYYXwFGQBXRkybOz0rkj4QsSYbcBEoYy0Fmbrn7b7zra7F22UYSUm78/9xRKl3 6aZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704386991; x=1704991791; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MRpF8Igy6aH+4rajax5A1C1kV57pcy2RBWf3lBfFgqw=; b=PSHOvTMHL7ZyOj9tjyOdgBaS46lEboYcbduBP/oRYSUgkDGABsB7t10764nos/nCMP yLKVjzZRt5HSfYQMPoQiKqbznhvoeMDk8xq0+1JjBP/bHYZTqdwo5TAs+wv3y17t5UL7 7ScGgeu+UUJpt1OUuVj8p08TN+J13YlZHhAU/hYyZ4uZAfbx8g3XMDTYrZSXfI0ZH3Kt P9NmvXVJ1Vx1z/X2uYkyxiWF5ghWSECzUbhJoiJUnO3wIU3ZvKI6nBgzSAYxrRciPvQ3 gBExHtB5f0/Fx7etvIlfheLOQ+pMpo+EfHjmBhT+6Aa+623TeZXfBEtwQh3hvamFz9bU EcWQ== X-Gm-Message-State: AOJu0Yy1UfcYJPegH4sec71iv9JMT541lAqX+QxVVPYtqCleFv+TyE1x EPjIYMrg1gXvWElOgxf9Rdz/r090QpNVvQ== X-Google-Smtp-Source: AGHT+IEd2AIW5I8ToY7p9uTIO5jwc/UdYE1TQEe5/UvPlf4te6PVl69zW6DFv0DvnKtn3hxLjka9cg== X-Received: by 2002:a05:6214:d4d:b0:67f:7781:1f88 with SMTP id 13-20020a0562140d4d00b0067f77811f88mr923181qvr.1.1704386990927; Thu, 04 Jan 2024 08:49:50 -0800 (PST) Received: from localhost.localdomain (dsl-10-135-125.b2b2c.ca. [72.10.135.125]) by smtp.gmail.com with ESMTPSA id o2-20020a0cecc2000000b0067aab230ed9sm11854706qvq.21.2024.01.04.08.49.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 08:49:50 -0800 (PST) From: Maxim Cournoyer Date: Thu, 4 Jan 2024 11:48:18 -0500 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/compression.scm (%compressors) [zstd]: Provide the --threads argument. Change-Id: I4e8dfe725d1b0721c0016c3013b9e609fee94367 --- gnu/compression.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gnu/compression.scm b/gnu/compression.scm index 0418e80a15..6e48de5979 100644 --- a/gnu/compression.scm +++ b/gnu/compression.scm @@ -56,7 +56,8 @@ (define %compressors ;; The default level 3 compresses better than gzip in a ;; fraction of the time, while the highest level 19 ;; (de)compresses more slowly and worse than xz. - #~(list #+(file-append zstd "/bin/zstd") "-3")) + #~(list #+(file-append zstd "/bin/zstd") "-3" + (format #f "--threads=~a" (parallel-job-count)))) (compressor "none" "" #f))) (define (lookup-compressor name) From patchwork Thu Jan 4 16:48:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 58355 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 4935627BBE2; Thu, 4 Jan 2024 16:51:38 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 321F027BBE9 for ; Thu, 4 Jan 2024 16:51:37 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLQvy-0003WR-W3; Thu, 04 Jan 2024 11:51:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLQvx-0003Ud-7X for guix-patches@gnu.org; Thu, 04 Jan 2024 11:51:05 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLQvv-0001Ts-Og; Thu, 04 Jan 2024 11:51:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rLQvv-0005We-BQ; Thu, 04 Jan 2024 11:51:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68242] [PATCH 3/5] packages: Repack patched source archives via zstd by default. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Thu, 04 Jan 2024 16:51:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68242 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68242@debbugs.gnu.org Cc: Maxim Cournoyer , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 68242-submit@debbugs.gnu.org id=B68242.170438700621131 (code B ref 68242); Thu, 04 Jan 2024 16:51:03 +0000 Received: (at 68242) by debbugs.gnu.org; 4 Jan 2024 16:50:06 +0000 Received: from localhost ([127.0.0.1]:55551 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLQuz-0005Uj-8n for submit@debbugs.gnu.org; Thu, 04 Jan 2024 11:50:06 -0500 Received: from mail-qv1-xf2d.google.com ([2607:f8b0:4864:20::f2d]:58741) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLQuw-0005Td-K2 for 68242@debbugs.gnu.org; Thu, 04 Jan 2024 11:50:03 -0500 Received: by mail-qv1-xf2d.google.com with SMTP id 6a1803df08f44-68015293aa3so2952766d6.1 for <68242@debbugs.gnu.org>; Thu, 04 Jan 2024 08:49:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704386993; x=1704991793; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gorrJbbDJd4H+7mdRg3rdxzNxojXiDwitWD4uR6K/yg=; b=K0qA1C1TgrTXFz2QMepKbKxJq1a+6NUkgchQkdZYmf3LazNcIQ+5mthUWOWYTHNmXb CJAECELtFcUis0Te/K7sLkWapuy4n8+5yEkFz6eWK6xkvHqXzIv7MDmw03UpGPBabh7m D1XQUSDLk2Wo262ZD2uRxYQ9TQxeDFV9SEFyK4ClkPsRanNXPZeGI8kqTU2/Wn9RsaZk fS09KAb2f2urujaXW3ZiFbFSdUFAcESOUOMBNx/JKurQaVyVdEcx/B671L+AKWSI81Ho nnmo3aeKNP6LpkiXgNKuqrwKcapySuUx/C5ScCDTd5lTM6+VOPEQrCX3irJfJxjyAb26 eP1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704386993; x=1704991793; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gorrJbbDJd4H+7mdRg3rdxzNxojXiDwitWD4uR6K/yg=; b=XZTXcxlkpK3DmD3oiqyE+wGM8tVGduQkhzOmFbi56ozcKcxUYbWRt0PvvdmrS73xnB xKodE5ljKRN2x+tcTglEszr+NZwkw25drBFQEnz6SDNdveMMBdNKsuwAQjtjq18sQGC2 lQhd3Ppprq46mCRTKtG6uEcnvNJY28A88YkjAZlzWD9VezpJZWDyr/t7wVTcIGtplvLM ZCqUvMzZo20kXSB2wkmvXthKH6K2WqNlrVkzHVbPTa+uWI8KHkHco9igXZVI0Rs27lu0 EUCukK4G0jFfsV1qwbXa+Q1AUltFSpRnSmIkGeqmHrj4bXK2G1RFBqjotL0gHJnIVByM ijWg== X-Gm-Message-State: AOJu0YypL2gjMiBUk53IJHrOhIJ2Pws37PZ/MGZ4Ldmg75Ljan8Daj7f +WRFoB0DzmHdt+c80tCI3nGzNJDN2krlyA== X-Google-Smtp-Source: AGHT+IE5DZQAgR7cstUkGiYq/ujo4trk7xlgJDkhouHvSR+tP7ZkiD8Epn6FJ0sKVPAiEbo71uuweQ== X-Received: by 2002:a05:6214:5007:b0:67a:a721:ec03 with SMTP id jo7-20020a056214500700b0067aa721ec03mr1013737qvb.71.1704386992752; Thu, 04 Jan 2024 08:49:52 -0800 (PST) Received: from localhost.localdomain (dsl-10-135-125.b2b2c.ca. [72.10.135.125]) by smtp.gmail.com with ESMTPSA id o2-20020a0cecc2000000b0067aab230ed9sm11854706qvq.21.2024.01.04.08.49.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 08:49:52 -0800 (PST) From: Maxim Cournoyer Date: Thu, 4 Jan 2024 11:48:19 -0500 Message-ID: <731e80fc6d38e18709f359ea2f982e9b302b2864.1704386901.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/build/utils.scm (compressor): Register zst file name extension. * guix/packages.scm (%standard-patch-inputs): Add zstd. (patch-and-repack): Rename tarxz-name nested procedure to tar-file-name, and accept a new 'ext' argument; adjust accordingly. Add zstd binding, and replace the XZ_DEFAULTS environment variable with ZSTD_NBTHREADS. Fallback to xz when zstd is not available. Change-Id: I614a6be8c87a4a0858eadce616c51d8e9b9fc020 --- guix/build/utils.scm | 1 + guix/packages.scm | 50 +++++++++++++++++++++++++------------------- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/guix/build/utils.scm b/guix/build/utils.scm index e87066cc02..9c1e19f6d8 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -177,6 +177,7 @@ (define (compressor file-name) ((string-suffix? "lz" file-name) "lzip") ((string-suffix? "zip" file-name) "unzip") ((string-suffix? "xz" file-name) "xz") + ((string-suffix? "zst" file-name) "zstd") (else #f))) ;no compression used/unknown file extension (define (tarball? file-name) diff --git a/guix/packages.scm b/guix/packages.scm index cb8db925f8..ce1ba7c53a 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -5,7 +5,7 @@ ;;; Copyright © 2016 Alex Kost ;;; Copyright © 2017, 2019, 2020, 2022 Efraim Flashner ;;; Copyright © 2019 Marius Bakke -;;; Copyright © 2020, 2021 Maxim Cournoyer +;;; Copyright © 2020, 2021, 2024 Maxim Cournoyer ;;; Copyright © 2021 Chris Marusich ;;; Copyright © 2022 Maxime Devos ;;; Copyright © 2022 jgart @@ -862,6 +862,7 @@ (define (%standard-patch-inputs system) (module-ref (resolve-interface module) var)))))) `(("tar" ,(ref '(gnu packages base) 'tar)) ("xz" ,(ref '(gnu packages compression) 'xz)) + ("zstd" ,(ref '(gnu packages compression) 'zstd)) ("bzip2" ,(ref '(gnu packages compression) 'bzip2)) ("gzip" ,(ref '(gnu packages compression) 'gzip)) ("lzip" ,(ref '(gnu packages compression) 'lzip)) @@ -926,31 +927,35 @@ (define* (patch-and-repack source patches ;; Return true if DIRECTORY is a checkout (git, svn, etc). (string-suffix? "-checkout" directory)) - (define (tarxz-name file-name) - ;; Return a '.tar.xz' file name based on FILE-NAME. + (define (tar-file-name file-name ext) + ;; Return a '$filename.tar.$ext' file name based on FILE-NAME and EXT. (let ((base (if (numeric-extension? file-name) original-file-name (file-sans-extension file-name)))) (string-append base (if (equal? (file-extension base) "tar") - ".xz" - ".tar.xz")))) + (string-append "." ext) + (string-append ".tar." ext))))) (define instantiate-patch (match-lambda - ((? string? patch) ;deprecated + ((? string? patch) ;deprecated (local-file patch #:recursive? #t)) - ((? struct? patch) ;origin, local-file, etc. + ((? struct? patch) ;origin, local-file, etc. patch))) - (let ((tar (lookup-input "tar")) - (gzip (lookup-input "gzip")) - (bzip2 (lookup-input "bzip2")) - (lzip (lookup-input "lzip")) - (xz (lookup-input "xz")) - (patch (lookup-input "patch")) - (comp (and=> (compressor source-file-name) lookup-input)) - (patches (map instantiate-patch patches))) + (let* ((tar (lookup-input "tar")) + (gzip (lookup-input "gzip")) + (bzip2 (lookup-input "bzip2")) + (lzip (lookup-input "lzip")) + (xz (lookup-input "xz")) + (zstd (or (lookup-input "zstd") + ;; Fallback to xz in case zstd is not available, such as + ;; for bootstrap packages. + xz)) + (patch (lookup-input "patch")) + (comp (and=> (compressor source-file-name) lookup-input)) + (patches (map instantiate-patch patches))) (define build (with-imported-modules '((guix build utils)) #~(begin @@ -1028,12 +1033,12 @@ (define* (patch-and-repack source patches locale (system-error-errno args))))) (setenv "PATH" - (string-append #+xz "/bin" + (string-append #+zstd "/bin" (if #+comp (string-append ":" #+comp "/bin") ""))) - (setenv "XZ_DEFAULTS" (string-join (%xz-parallel-args))) + (setenv "ZSTD_NBTHREADS" (number->string (parallel-job-count))) ;; SOURCE may be either a directory, a tarball or a simple file. (let ((name (strip-store-file-name #+source)) @@ -1088,10 +1093,13 @@ (define* (patch-and-repack source patches (else ;single uncompressed file (copy-file file #$output))))))) - (let ((name (if (or (checkout? original-file-name) - (not (compressor original-file-name))) - original-file-name - (tarxz-name original-file-name)))) + (let* ((ext (if zstd + "zst" ;usual case + "xz")) ;zstd-less bootstrap-origin + (name (if (or (checkout? original-file-name) + (not (compressor original-file-name))) + original-file-name + (tar-file-name original-file-name ext)))) (gexp->derivation name build #:graft? #f #:system system From patchwork Thu Jan 4 16:48:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 58357 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id BF40627BBEA; Thu, 4 Jan 2024 16:51:44 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id B35A927BBE2 for ; Thu, 4 Jan 2024 16:51:43 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLQvv-0003TH-2P; Thu, 04 Jan 2024 11:51:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLQvs-0003Sa-AY for guix-patches@gnu.org; Thu, 04 Jan 2024 11:51:00 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLQvs-0001DK-2h for guix-patches@gnu.org; Thu, 04 Jan 2024 11:51:00 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rLQvv-0005Wk-QU for guix-patches@gnu.org; Thu, 04 Jan 2024 11:51:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68242] [PATCH 4/5] build: gnu-build-system: Compress man pages with zstd. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 04 Jan 2024 16:51:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68242 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68242@debbugs.gnu.org Cc: Maxim Cournoyer Received: via spool by 68242-submit@debbugs.gnu.org id=B68242.170438700921148 (code B ref 68242); Thu, 04 Jan 2024 16:51:03 +0000 Received: (at 68242) by debbugs.gnu.org; 4 Jan 2024 16:50:09 +0000 Received: from localhost ([127.0.0.1]:55554 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLQv2-0005Uz-5t for submit@debbugs.gnu.org; Thu, 04 Jan 2024 11:50:08 -0500 Received: from mail-qv1-xf2d.google.com ([2607:f8b0:4864:20::f2d]:43158) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLQuy-0005Tg-A6 for 68242@debbugs.gnu.org; Thu, 04 Jan 2024 11:50:04 -0500 Received: by mail-qv1-xf2d.google.com with SMTP id 6a1803df08f44-67f85fe5632so12649646d6.0 for <68242@debbugs.gnu.org>; Thu, 04 Jan 2024 08:50:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704386994; x=1704991794; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=asy7LyZfXPjVW081p0UTEaaCiZmbqSgwvwsjh3Rbp80=; b=Y+sBp/TerG3fCMxebOXIVdPWlIV8fDu43ohG+3h2qbfkOsn8Uk3iFZSbwkEpQqQLAA QT2P7qHfFDwf014+dmbqh+iI6G2upU1co/sZ+wDwvmf0zTYJQY4sYhwkZatGuq5QtvpD eMVy8tPf4FGZD1sGvE24LR6X8fww6R1jQJijm7+11/Iv/e8wAjyFPbufK9VXQPyoVV6a H3zNVX4pcgJtnWA8nY2iIPBxKu8dyeFliP+J8qw3KlXOetBa42WCdPMCgjjCX5sEffwy zQGxkRnKU94ORBvar+S3rEc4fGopNKHvo6XXbFS6TGx+wcc+53SYpItGYk3wHpETyald Ol3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704386994; x=1704991794; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=asy7LyZfXPjVW081p0UTEaaCiZmbqSgwvwsjh3Rbp80=; b=wf/atM5QwDKT2Xk3oRuIvGWpqFzWuFakEaluyy6jdeRhjr0f64CarCAi+jOeuWMSAb 0WBiIWhCfRqG/ian+dn7ybk1zmeQIIdJIOHAdnnmlwIJTbEy40UK0GlRvqvWBJOsdVH6 4QN4NThVMt/Q79rL3x3cFmqWEH3KSUidPwB/3jCbNCc3ehO32GmMfFBgJoBd/vrV0pK/ SaufJydf2SxzYSn3ni/qDic2kZL60VvJhdK4vlzw5uYao6MmHt0USGgPcxT2ZdbbhNCF OCUwfLnpITk1mVU8TCUPZQji5KNji342G7sP+DPFEx39Fv5G5JtDeqTusJsnsQf3qSnr 0kkw== X-Gm-Message-State: AOJu0YxlkiJgULZLp/e+LjxEtDUulbZQM7KWFQ+NnaduF6kSGRC0CvvC MwUYwjUJ5p1+96OWfnXPTbnBHkcCIEeswg== X-Google-Smtp-Source: AGHT+IF+HUbPTlS0d5rHRrCinyQwTwCatMn5AhGtH8zDkpJ/Rn27+EOIfh5Yjxm7oI1po0jExd+Rqw== X-Received: by 2002:a05:6214:21a2:b0:67f:67ca:1181 with SMTP id t2-20020a05621421a200b0067f67ca1181mr1008571qvc.40.1704386994578; Thu, 04 Jan 2024 08:49:54 -0800 (PST) Received: from localhost.localdomain (dsl-10-135-125.b2b2c.ca. [72.10.135.125]) by smtp.gmail.com with ESMTPSA id o2-20020a0cecc2000000b0067aab230ed9sm11854706qvq.21.2024.01.04.08.49.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 08:49:54 -0800 (PST) From: Maxim Cournoyer Date: Thu, 4 Jan 2024 11:48:20 -0500 Message-ID: <6425d5767b4ca53ed6de612c0f77e3d6a872af51.1704386901.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches The aim is to improve the efficiency of computing the man pages database, which must decompress the man pages. Zstd is faster than gzip, especially for decompression, and has a similar compression ratio. * gnu/packages/commencement.scm (%final-inputs): Add zstd. * guix/build/gnu-build-system.scm (compress-documentation) Update doc. : New arguments. : Rename argument to... : ... this. Add an 'extension' argument to the retarget-symlink nested procedure. Use new arguments in nested 'maybe-compress' procedure. Change-Id: Ibaad4658f8e5151633714d263d9198f56d255020 --- gnu/packages/commencement.scm | 3 +- guix/build/gnu-build-system.scm | 73 +++++++++++++++++++++------------ 2 files changed, 49 insertions(+), 27 deletions(-) diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index ae1c91f0d0..51c26339ef 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -3492,7 +3492,8 @@ (define-public %final-inputs (native-inputs (list (if (target-hurd?) glibc-utf8-locales-final/hurd - glibc-utf8-locales-final))))))) + glibc-utf8-locales-final))))) + ("zstd" ,zstd))) ("sed" ,sed-final) ("grep" ,grep-final) ("xz" ,xz-final) diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 51b8f9acbf..ff9b123ae6 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -2,7 +2,7 @@ ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès ;;; Copyright © 2018 Mark H Weaver ;;; Copyright © 2020 Brendan Tildesley -;;; Copyright © 2021 Maxim Cournoyer +;;; Copyright © 2021, 2022 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -644,21 +644,36 @@ (define* (reset-gzip-timestamps #:key outputs #:allow-other-keys) (((names . directories) ...) (for-each process-directory directories)))) -(define* (compress-documentation #:key outputs +(define* (compress-documentation #:key + outputs (compress-documentation? #t) - (documentation-compressor "gzip") - (documentation-compressor-flags + (info-compressor "gzip") + (info-compressor-flags '("--best" "--no-name")) - (compressed-documentation-extension ".gz") + (info-compressor-file-extension ".gz") + (man-compressor (if (which "zstd") + "zstd" + info-compressor)) + (man-compressor-flags + (if (which "zstd") + (list "-19" "--rm" + "--threads" (string->number + (parallel-job-count))) + info-compressor-flags)) + (man-compressor-file-extension + (if (which "zstd") + ".zst" + info-compressor-file-extension)) #:allow-other-keys) - "When COMPRESS-DOCUMENTATION? is true, compress man pages and Info files -found in OUTPUTS using DOCUMENTATION-COMPRESSOR, called with -DOCUMENTATION-COMPRESSOR-FLAGS." - (define (retarget-symlink link) + "When COMPRESS-INFO-MANUALS? is true, compress Info files found in OUTPUTS +using INFO-COMPRESSOR, called with INFO-COMPRESSOR-FLAGS. Similarly, when +COMPRESS-MAN-PAGES? is true, compress man pages files found in OUTPUTS using +MAN-COMPRESSOR, using MAN-COMPRESSOR-FLAGS." + (define (retarget-symlink link extension) (let ((target (readlink link))) (delete-file link) - (symlink (string-append target compressed-documentation-extension) - (string-append link compressed-documentation-extension)))) + (symlink (string-append target extension) + (string-append link extension)))) (define (has-links? file) ;; Return #t if FILE has hard links. @@ -676,23 +691,23 @@ (define* (compress-documentation #:key outputs (symbolic-link? target-absolute)) (lambda args (if (= ENOENT (system-error-errno args)) - (begin - (format (current-error-port) - "The symbolic link '~a' target is missing: '~a'\n" - symlink target-absolute) - #f) + (format (current-error-port) + "The symbolic link '~a' target is missing: '~a'\n" + symlink target-absolute) (apply throw args)))))) - (define (maybe-compress-directory directory regexp) + (define (maybe-compress-directory directory regexp + compressor + compressor-flags + compressor-extension) (when (directory-exists? directory) (match (find-files directory regexp) - (() ;nothing to compress + (() ;nothing to compress #t) - ((files ...) ;one or more files + ((files ...) ;one or more files (format #t "compressing documentation in '~a' with ~s and flags ~s~%" - directory documentation-compressor - documentation-compressor-flags) + directory compressor compressor-flags) (call-with-values (lambda () (partition symbolic-link? files)) @@ -702,20 +717,26 @@ (define* (compress-documentation #:key outputs ;; unchanged ('gzip' would refuse to compress them anyway.) ;; Also, do not retarget symbolic links pointing to other ;; symbolic links, since these are not compressed. - (for-each retarget-symlink + (for-each (cut retarget-symlink <> compressor-extension) (filter (lambda (symlink) (and (not (points-to-symlink? symlink)) (string-match regexp symlink))) symlinks)) - (apply invoke documentation-compressor - (append documentation-compressor-flags + (apply invoke compressor + (append compressor-flags (remove has-links? regular-files))))))))) (define (maybe-compress output) (maybe-compress-directory (string-append output "/share/man") - "\\.[0-9]+$") + "\\.[0-9]+$" + man-compressor + man-compressor-flags + man-compressor-file-extension) (maybe-compress-directory (string-append output "/share/info") - "\\.info(-[0-9]+)?$")) + "\\.info(-[0-9]+)?$" + info-compressor + info-compressor-flags + info-compressor-file-extension)) (if compress-documentation? (match outputs From patchwork Thu Jan 4 16:48:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 58354 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 94EBE27BBE2; Thu, 4 Jan 2024 16:51:21 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 63EDA27BBE9 for ; Thu, 4 Jan 2024 16:51:20 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLQvy-0003WN-W1; Thu, 04 Jan 2024 11:51:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLQvx-0003Ue-7n for guix-patches@gnu.org; Thu, 04 Jan 2024 11:51:05 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLQvv-0001Tf-FV; Thu, 04 Jan 2024 11:51:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rLQvw-0005Wt-BZ; Thu, 04 Jan 2024 11:51:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68242] [PATCH 5/5] man-db: Add support for zstd compressed man pages. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Thu, 04 Jan 2024 16:51:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68242 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68242@debbugs.gnu.org Cc: Maxim Cournoyer , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 68242-submit@debbugs.gnu.org id=B68242.170438700921154 (code B ref 68242); Thu, 04 Jan 2024 16:51:04 +0000 Received: (at 68242) by debbugs.gnu.org; 4 Jan 2024 16:50:09 +0000 Received: from localhost ([127.0.0.1]:55556 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLQv2-0005V4-Rg for submit@debbugs.gnu.org; Thu, 04 Jan 2024 11:50:09 -0500 Received: from mail-qt1-x82c.google.com ([2607:f8b0:4864:20::82c]:61552) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLQv0-0005To-5S for 68242@debbugs.gnu.org; Thu, 04 Jan 2024 11:50:07 -0500 Received: by mail-qt1-x82c.google.com with SMTP id d75a77b69052e-4280e3ab14fso4219031cf.2 for <68242@debbugs.gnu.org>; Thu, 04 Jan 2024 08:50:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704386996; x=1704991796; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=U1VUaYj9q2fqTmycjhUiIHy5KObjtlKMu8Eo6Cz5gUc=; b=kQpjiRTnPEMMP3HLCbu/ZqmTQUHa3TjNzNwNLrp21/S9CyFKrh2Cra48lrzmeH39rz k/oouXMO9HlNPKpoCVwhxHWOo4r8GlurTI2RZKC/ZH4C7bnLpe+Hjawo/b5XqLBn3aV0 Mn3sx1/5uQ7bWfllzoSUAAZ+Wogl+8HB6OzFo+g8qIazxu/ke/Z7thUyqy5LixVC8Afa 4/F0FuLTAAOywZSeVsvAlrXThB1wibuUoUh1/SFy2K4h5Itk1DNp9w1pOKM0O7KbMgnE n/Ix3J3IZMtafSQR20f55Pk59jWtahtyuAT6a3nJfZJJrOcI1OpCi+Ox8p+INLkqfmGI OZ4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704386996; x=1704991796; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U1VUaYj9q2fqTmycjhUiIHy5KObjtlKMu8Eo6Cz5gUc=; b=mWOqMntJw/KD87lNwM3nAmladlcy3tt1eT0VTXCTthdQ9B0LiKV3peQ3h2vzdIepJa LSeQyEVbBg0q+Nonol4IAjOGDgXaplQ1ta2r7gpj7eViSY8YEssyBuRKEKLUnTVkgW+o 4XFMaHloeAInULFuMMPergjX5hHGvlvX0CqCab0SvbbQe7ZGYswecnoyIjxSMl6U2L0H Bk1Iz+SdRbK8IWPiuNXtSVQIKCo/9MQ2knL4urMjs7T/uCumfqfYfxPrw2Vte3I/r54S RbOjNEV9cHuuIzE6HAi5exbJ/dJ2ZsIzOzEyEcO1aQ1fI9CYzF2tLWpZsiSIJqAPc5f7 TS8w== X-Gm-Message-State: AOJu0YyonF9InIXhn+cxTj+aSADqoTif3wUEBVU5horpgKHVm8G+YRU6 UbAqmLPVXaFliNRZp0Jvsk64ys4vMQIqDw== X-Google-Smtp-Source: AGHT+IF93doo9qXtuKzVZPx1eBU1ULGpuSqMPliUYCZG3gPA/Dex6NQ9C/hQHzmfqVzG6EdITS1UPA== X-Received: by 2002:a05:6214:262f:b0:680:d30a:d599 with SMTP id gv15-20020a056214262f00b00680d30ad599mr955397qvb.69.1704386996381; Thu, 04 Jan 2024 08:49:56 -0800 (PST) Received: from localhost.localdomain (dsl-10-135-125.b2b2c.ca. [72.10.135.125]) by smtp.gmail.com with ESMTPSA id o2-20020a0cecc2000000b0067aab230ed9sm11854706qvq.21.2024.01.04.08.49.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 08:49:56 -0800 (PST) From: Maxim Cournoyer Date: Thu, 4 Jan 2024 11:48:21 -0500 Message-ID: <44d6f0f8471ad290a78c102228352481a131f60f.1704386901.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/man-db.scm (): Adjust comment. (abbreviate-file-name): Adjust regexp. (gz-compressed?, zstd-compressed?): New predicates. (entry->string): Use them. (man-page->entry): Adjust doc. Use input port reader appropriate to the compression type, if any. (man-files): Adjust regexp. (mandb-entries): Adjust link resolving predicate. * guix/profiles.scm (manual-database): Add guile-zlib extension. Change-Id: I6336e46e2d324c520a7d15d6cafd12bbf43c5b09 --- guix/man-db.scm | 45 +++++++++++++++++++++++++++++++++++---------- guix/profiles.scm | 8 ++++++-- 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/guix/man-db.scm b/guix/man-db.scm index 7d9707a592..12887ce400 100644 --- a/guix/man-db.scm +++ b/guix/man-db.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017, 2018 Ludovic Courtès +;;; Copyright © 2022, 2024 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -18,6 +19,7 @@ (define-module (guix man-db) #:use-module (zlib) + #:use-module (zstd) #:use-module ((guix build utils) #:select (find-files)) #:use-module (gdbm) ;gdbm-ffi #:use-module (srfi srfi-9) @@ -48,7 +50,7 @@ (define-module (guix man-db) (define-record-type (mandb-entry file-name name section synopsis kind) mandb-entry? - (file-name mandb-entry-file-name) ;e.g., "../abiword.1.gz" + (file-name mandb-entry-file-name) ;e.g., "../abiword.1.zst" (name mandb-entry-name) ;e.g., "ABIWORD" (section mandb-entry-section) ;number (synopsis mandb-entry-synopsis) ;string @@ -63,7 +65,7 @@ (define (mandb-entrystring entry) "Return the wire format for ENTRY as a string." (match entry @@ -92,7 +102,11 @@ (define (entry->string entry) "\t-\t-\t" - (if (string-suffix? ".gz" file) "gz" "") + (cond + ((gzip-compressed? file) "gz") + ((zstd-compressed? file) "zst") + (else "")) + "\t" synopsis "\x00")))) @@ -148,7 +162,8 @@ (define (read-synopsis port) (loop (cons line lines)))))) (define* (man-page->entry file #:optional (resolve identity)) - "Parse FILE, a gzipped man page, and return a for it." + "Parse FILE, a gzip or zstd compressed man page, and return a +for it." (define (string->number* str) (if (and (string-prefix? "\"" str) (> (string-length str) 1) @@ -156,8 +171,13 @@ (define* (man-page->entry file #:optional (resolve identity)) (string->number (string-drop (string-drop-right str 1) 1)) (string->number str))) - ;; Note: This works for both gzipped and uncompressed files. - (call-with-gzip-input-port (open-file file "r0") + (define call-with-input-port* + (cond + ((gzip-compressed? file) call-with-gzip-input-port) + ((zstd-compressed? file) call-with-zstd-input-port) + (else call-with-port))) + + (call-with-input-port* (open-file file "r0") (lambda (port) (let loop ((name #f) (section #f) @@ -191,14 +211,19 @@ (define* (man-page->entry file #:optional (resolve identity)) (define (man-files directory) "Return the list of man pages found under DIRECTORY, recursively." ;; Filter the list to ensure that broken symlinks are excluded. - (filter file-exists? (find-files directory "\\.[0-9][a-z]?(\\.gz)?$"))) + (filter file-exists? + (find-files directory "\\.[0-9][a-z]?(\\.(gz|zst))?$"))) (define (mandb-entries directory) "Return mandb entries for the man pages found under DIRECTORY, recursively." (map (lambda (file) (man-page->entry file (lambda (link) - (let ((file (string-append directory "/" link - ".gz"))) - (and (file-exists? file) file))))) + (let ((file-gz (string-append directory "/" link + ".gz")) + (file-zst (string-append directory "/" link + ".zst"))) + (and (or (file-exists? file-gz) + (file-exists? file-zst) file) + file))))) (man-files directory))) diff --git a/guix/profiles.scm b/guix/profiles.scm index da7790d819..7fa5dab62a 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -7,7 +7,7 @@ ;;; Copyright © 2016, 2017, 2018, 2019, 2021, 2022 Ricardo Wurmus ;;; Copyright © 2016 Chris Marusich ;;; Copyright © 2017 Huang Ying -;;; Copyright © 2017, 2021 Maxim Cournoyer +;;; Copyright © 2017, 2021, 2024 Maxim Cournoyer ;;; Copyright © 2019 Kyle Meyer ;;; Copyright © 2019 Mathieu Othacehe ;;; Copyright © 2020 Danny Milosavljevic @@ -1701,6 +1701,9 @@ (define* (manual-database manifest #:optional system) (define guile-zlib (module-ref (resolve-interface '(gnu packages guile)) 'guile-zlib)) + (define guile-zstd + (module-ref (resolve-interface '(gnu packages guile)) 'guile-zstd)) + (define modules (delete '(guix config) (source-module-closure `((guix build utils) @@ -1709,7 +1712,8 @@ (define* (manual-database manifest #:optional system) (define build (with-imported-modules modules (with-extensions (list gdbm-ffi ;for (guix man-db) - guile-zlib) + guile-zlib + guile-zstd) #~(begin (use-modules (guix man-db) (guix build utils)