From patchwork Fri Jan 5 19:52:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 58395 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 26FB727BBEA; Fri, 5 Jan 2024 19:54:33 +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 6E2F527BBE9 for ; Fri, 5 Jan 2024 19:54:32 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLqGW-00010E-TU; Fri, 05 Jan 2024 14:54: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 1rLqGU-0000yd-L6 for guix-patches@gnu.org; Fri, 05 Jan 2024 14:53:58 -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 1rLqGU-0007cc-Bf for guix-patches@gnu.org; Fri, 05 Jan 2024 14:53:58 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rLqGY-0000e2-PM for guix-patches@gnu.org; Fri, 05 Jan 2024 14:54:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68242] [PATCH core-updates v2 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: Fri, 05 Jan 2024 19:54: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.17044844182403 (code B ref 68242); Fri, 05 Jan 2024 19:54:02 +0000 Received: (at 68242) by debbugs.gnu.org; 5 Jan 2024 19:53:38 +0000 Received: from localhost ([127.0.0.1]:57962 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLqGA-0000ch-Ay for submit@debbugs.gnu.org; Fri, 05 Jan 2024 14:53:38 -0500 Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]:49576) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLqG4-0000bu-VF for 68242@debbugs.gnu.org; Fri, 05 Jan 2024 14:53:35 -0500 Received: by mail-qk1-x72c.google.com with SMTP id af79cd13be357-78117e97becso105458085a.3 for <68242@debbugs.gnu.org>; Fri, 05 Jan 2024 11:53:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704484402; x=1705089202; 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=nPaGytFP2GBEUwTHQTSZm5fTrRJgcqu0JymPnfzZhsk=; b=U+Q8cmEOFVgilPLe7bg+P4U3oZ/F6IO78hcVSk9jQABMth2DLh/Wg/H6sihBdUBhCK kx8hONFkybyk/g65H85jLDHKULgEymeZjALR1I6PzorjBj3T2ir4PdqwtpMxYwnbBGAp avdnNIHd60w1aMcbcAyaALwL4GClDjqQHwdvob0Sts9Gdw9ITslj4VTEW7X6+Q9eVzEx 8kka04iRNeZBTZUD2ZwnOOKMPLUVNaBDABFBTS/5LP7A3371GIsr3Yynd6Fa6WP3biN+ 9pXO4SjccjTe5823jYSIipBcO10eVC5Q4bH7LVLTZLd3e13AC+dxG01wAxz8n/otaD+U B8bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704484402; x=1705089202; 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=nPaGytFP2GBEUwTHQTSZm5fTrRJgcqu0JymPnfzZhsk=; b=c6KKq2Ak3GOvo5aSMEjG1/yOza0fUPO9LyRBvIFevAWndhtixFn8+4ad8MeAaCjJnq nWhu4rp1nd2i8JFWFYDPu7GpplgggzTvw2dRhy4w++6QhYuw0NK+nHV7j0Kzg1EJdO8i aRuTwuhDQrAtgAEYynUoNVkXD84YQsfjv9W1akFtskV82CxbbKkFBFvanBl5dsoxd0uM 9Wy1bjTkBHyI7+bn5ad8WUN8OAvPlWF+YHwl1MR7JwPeGLokav4PUj/abHRQI+cqroRJ U37MlMWuRAvOseeT8RSo/78WDqwK4GrNtkawTrO4Kabc/26DOVQy+LLibH+bmV9joRMk WdYA== X-Gm-Message-State: AOJu0YwS5GwSO3AiZoCg286YCTw6JwudL/SiAtBiCudoTfxNHxcnZsj8 aXIrueicaAplPCdqVvLEyPzOWuKP3aQ= X-Google-Smtp-Source: AGHT+IHu8+6PIKtxz5wqlAqw/zdYcEkEU6WdzyLNfkwkiSyxyrBpekFKrXAHhHK/Yp1Hlt/QXE/+8Q== X-Received: by 2002:a05:620a:244e:b0:781:ea60:b466 with SMTP id h14-20020a05620a244e00b00781ea60b466mr2876560qkn.119.1704484402225; Fri, 05 Jan 2024 11:53:22 -0800 (PST) Received: from localhost.localdomain (dsl-10-135-125.b2b2c.ca. [72.10.135.125]) by smtp.gmail.com with ESMTPSA id c22-20020a05620a11b600b00781e1c466e7sm823178qkk.24.2024.01.05.11.53.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 11:53:21 -0800 (PST) From: Maxim Cournoyer Date: Fri, 5 Jan 2024 14:52:50 -0500 Message-ID: <2d37c22fc834b1062c456c8b23974d9be5a2ff56.1704484373.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 --- (no changes since v1) 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 Fri Jan 5 19:52:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 58394 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 0761727BBEB; Fri, 5 Jan 2024 19:54:28 +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 5075C27BBE2 for ; Fri, 5 Jan 2024 19:54:27 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLqGV-0000za-L0; Fri, 05 Jan 2024 14:53:59 -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 1rLqGU-0000yV-9D for guix-patches@gnu.org; Fri, 05 Jan 2024 14:53:58 -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 1rLqGU-0007cW-0Z for guix-patches@gnu.org; Fri, 05 Jan 2024 14:53:58 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rLqGY-0000dv-A5 for guix-patches@gnu.org; Fri, 05 Jan 2024 14:54:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68242] [PATCH core-updates v2 2/5] compression: Enable zstd parallel compression. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 05 Jan 2024 19:54: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.17044844162389 (code B ref 68242); Fri, 05 Jan 2024 19:54:02 +0000 Received: (at 68242) by debbugs.gnu.org; 5 Jan 2024 19:53:36 +0000 Received: from localhost ([127.0.0.1]:57959 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLqG8-0000cT-11 for submit@debbugs.gnu.org; Fri, 05 Jan 2024 14:53:36 -0500 Received: from mail-qk1-x72f.google.com ([2607:f8b0:4864:20::72f]:60639) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLqG6-0000bx-D0 for 68242@debbugs.gnu.org; Fri, 05 Jan 2024 14:53:34 -0500 Received: by mail-qk1-x72f.google.com with SMTP id af79cd13be357-781600ab3d8so132804385a.0 for <68242@debbugs.gnu.org>; Fri, 05 Jan 2024 11:53:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704484404; x=1705089204; 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=tneTWMQJp/iJi+zlwLYnjycGc1BxzYlhSwN2fmbNXbE=; b=OqZrv8fQY1bhBm7eBdvRTu88GdnSQZ3Qtg9YaN23K1uvOsw5lKxWziriqCAi3jQ4t5 ug728P8zxvFGIuRAjbIfpiDpicM8OXJvX0c9FYa+WO/4yWOB0u/f9EsjaWn5J4rYXq5c DmrNcs3Ej1sUNe/LKaZNrVyG6Yq/HNeJVp2q5ySwX3Q9ChmKdur6yu0xPhYKmlhIltQp fS19OvOCI5gJuN//Rl3xUJyivLGDmtjgPQIJUJc609tijFVuU62mSnTTbKQMyzH3pslA 3roz4bePlWR7xebhenfj7+IkiBTaR5S1r1ICwCNl6+S1wJa6OgLrfNduaRI5lnUKM6Jb l54g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704484404; x=1705089204; 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=tneTWMQJp/iJi+zlwLYnjycGc1BxzYlhSwN2fmbNXbE=; b=LXF01IuSalP8BaAKgjyBd8ulKFT8sQOkiVlEUvoJCHPI73up6i30DuJOIcu0X7ZEdy rl3/oOW2Rl3wSlSch0jMOkB6vKZ39zOsasdjTV6Ee4g2OFlCd1R5TaNvSaa7zMobBb0k bfPSfuNRYRsL4Dyhp0wErb1fLZmnr8jYb9aaTvdwxFEnf0NCUmKjVmO5O6NI95EtehTA DJIBl/SIbMPd/43sn+nYJ8hF+8lFgTz43V8Cz/f4njyyUrlNNSctLOexgVbdKm3PyPGe Ek/HAZxpImT/8NYAhDPbX7XFvnSqBqvmMeDoIcjcW7YaSlD+56HILlhy+gmopmbxDrtW PZ9g== X-Gm-Message-State: AOJu0YzI9+7eAgqT4ZpdXi1rg/RoxJWq51h8vm2SqYY9w0by4cIHeUFs Cgytq7J30/Klo+OpujfdhTq7aABEp0k= X-Google-Smtp-Source: AGHT+IGXaaRI/DAhlopWOKWpBodOXBUgPRja6D2vHXoR4FOTbviY6bj8YV/h+YN9JehMihhmaEfjJQ== X-Received: by 2002:a05:620a:8223:b0:782:b6a1:cc97 with SMTP id ow35-20020a05620a822300b00782b6a1cc97mr2908113qkn.19.1704484403998; Fri, 05 Jan 2024 11:53:23 -0800 (PST) Received: from localhost.localdomain (dsl-10-135-125.b2b2c.ca. [72.10.135.125]) by smtp.gmail.com with ESMTPSA id c22-20020a05620a11b600b00781e1c466e7sm823178qkk.24.2024.01.05.11.53.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 11:53:23 -0800 (PST) From: Maxim Cournoyer Date: Fri, 5 Jan 2024 14:52:51 -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 --- (no changes since v1) 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 Fri Jan 5 19:52:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 58396 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 6C3BC27BBEA; Fri, 5 Jan 2024 19:54:46 +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 6379027BBE2 for ; Fri, 5 Jan 2024 19:54:45 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLqGb-00011N-4l; Fri, 05 Jan 2024 14:54:05 -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 1rLqGZ-00010y-61 for guix-patches@gnu.org; Fri, 05 Jan 2024 14:54:03 -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 1rLqGY-0007d4-OA; Fri, 05 Jan 2024 14:54:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rLqGZ-0000eD-Dt; Fri, 05 Jan 2024 14:54:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68242] [PATCH core-updates v2 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: Fri, 05 Jan 2024 19:54: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.17044844212423 (code B ref 68242); Fri, 05 Jan 2024 19:54:03 +0000 Received: (at 68242) by debbugs.gnu.org; 5 Jan 2024 19:53:41 +0000 Received: from localhost ([127.0.0.1]:57966 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLqGC-0000cw-Kb for submit@debbugs.gnu.org; Fri, 05 Jan 2024 14:53:41 -0500 Received: from mail-qk1-x72e.google.com ([2607:f8b0:4864:20::72e]:58371) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLqG8-0000c0-Dy for 68242@debbugs.gnu.org; Fri, 05 Jan 2024 14:53:38 -0500 Received: by mail-qk1-x72e.google.com with SMTP id af79cd13be357-781edcbb495so122176385a.0 for <68242@debbugs.gnu.org>; Fri, 05 Jan 2024 11:53:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704484406; x=1705089206; 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=WY2zrLmbm2SWhH3iTQSppY95X01nFe/0vLW/hINWGpY=; b=RslV6L+NmmK55zwrHqfyRAQAn6iNRQw6UzBh7HwUUmH2YTBEjV7rSemKjdXscRGl+j vaAMHpYr599RMWr6c09i/EWh4Xxr9C/6aVibU/BHyBwCspUtCdCaszbMrX+5o4sdmTyc 4eqMQ51D2eNGwNo6CPflV4IOhKPREbm1haKdotvarQhXA1NcIWvh6wwDZNp0H8kCcAEC lcyS8QDlt+n+ZZG0Zphtb/CA1Gi7rlXOJjdWCmeRA+6WmE5uEY7zvxL/B6hTPNUtc4KS ohlxByM5624U0Txt0Eet5fnIcpCM9aLfx/e4Q1IQnUPKo3nHPm78xR3i8msqW92hO7Oz JCeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704484406; x=1705089206; 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=WY2zrLmbm2SWhH3iTQSppY95X01nFe/0vLW/hINWGpY=; b=p5v7UfjU59dsmdM7tXwP3+RKJqIV2bTNMJiN6Yimj1i1T4+FBB9nDGWHp4/a54hwku kxjrcXNUHBr6k3TcUbw3t+Kl95Tp1W6MXgQ2gwvrgkcByrOjSCxKezemNRttcEZowVx6 /XGgbx7eibI8cHB+qAy/7H7WJSXXWyxNia9/E6EpgGm5PjR3YxvM7xuxpv3Fy6d6Y+vy cq69GejHLznQfZc267NtLLsUiACzZQNw8GJdMxOXr6/NrAi7R7IfwhAs6Lj5TzL25ehi trC102T0eSyzAWdVFDsyINrRQVQlVQzpVNxScAipBhePS19qq/uTLkQkvAe/B4RmGwS+ UQLg== X-Gm-Message-State: AOJu0YwY8L6d58B6iBZARbfaDUTYpu3lTYxol9q9NdDtn4e+6x9bD8o4 j457GRHWML7SgUPsXaMizJiWem8TVa8= X-Google-Smtp-Source: AGHT+IGhUk0H4MjbPJhSlibPFyo4UzPrv900qr1r0x/K7mJjRFamDtAyijA1UqIyEDyYspIZdEYqIg== X-Received: by 2002:a05:620a:6019:b0:783:7df:7c7c with SMTP id dw25-20020a05620a601900b0078307df7c7cmr1771022qkb.67.1704484406124; Fri, 05 Jan 2024 11:53:26 -0800 (PST) Received: from localhost.localdomain (dsl-10-135-125.b2b2c.ca. [72.10.135.125]) by smtp.gmail.com with ESMTPSA id c22-20020a05620a11b600b00781e1c466e7sm823178qkk.24.2024.01.05.11.53.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 11:53:25 -0800 (PST) From: Maxim Cournoyer Date: Fri, 5 Jan 2024 14:52:52 -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 * 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 --- (no changes since v1) 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 Fri Jan 5 19:52:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 58393 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 268CE27BBEA; Fri, 5 Jan 2024 19:54:27 +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 C5B2C27BBE2 for ; Fri, 5 Jan 2024 19:54:22 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLqGY-00010j-Su; Fri, 05 Jan 2024 14:54: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 1rLqGV-0000zg-Og for guix-patches@gnu.org; Fri, 05 Jan 2024 14:53: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 1rLqGV-0007cn-GD for guix-patches@gnu.org; Fri, 05 Jan 2024 14:53:59 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rLqGZ-0000eL-UP for guix-patches@gnu.org; Fri, 05 Jan 2024 14:54:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68242] [PATCH core-updates v2 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: Fri, 05 Jan 2024 19:54: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.17044844222433 (code B ref 68242); Fri, 05 Jan 2024 19:54:03 +0000 Received: (at 68242) by debbugs.gnu.org; 5 Jan 2024 19:53:42 +0000 Received: from localhost ([127.0.0.1]:57968 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLqGD-0000d0-7l for submit@debbugs.gnu.org; Fri, 05 Jan 2024 14:53:41 -0500 Received: from mail-qk1-x736.google.com ([2607:f8b0:4864:20::736]:59887) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLqGA-0000c4-FM for 68242@debbugs.gnu.org; Fri, 05 Jan 2024 14:53:39 -0500 Received: by mail-qk1-x736.google.com with SMTP id af79cd13be357-7815547f2c5so121356085a.3 for <68242@debbugs.gnu.org>; Fri, 05 Jan 2024 11:53:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704484408; x=1705089208; 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=x+mVD14beS+srRzXQtAc4+5pf7mOTb9TfWsqvebFxF0=; b=Vzy3nzrAxKM0D0sovpmbhDwlDd9pm+cAqvbz/lmR7R/OVTFUaleeK9vDj0+GHsm4wA e60bxMQLMlFK5HUxC9Ym6ekFhEpfvpOjh+C39D7wy+hbDD7gs6phusBd/zQVNFzfhYrf YuJoCHQnQE7YkBS7cv+i5Pq22WuMr6Ue+WiC8iGr/6LoNn6YmdaTh76brXfCrGva4N9Q 6Nj9fRtioxFhfE9C5YLEofnCPDJUrOYrXxcSaw/Xm/gZd3gAB2nf0/szXNKcGcyc1D68 BfOWDPzOSMWB6HqtgEQz6cMgJwJDFMdZNZGBcBWmfUQnwO9S2RmsE234Y6odlgjK1U0o nqyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704484408; x=1705089208; 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=x+mVD14beS+srRzXQtAc4+5pf7mOTb9TfWsqvebFxF0=; b=QjWXQOA6paHJPY2AAJGI3whMTRmZBAWY1lF4za5i5LNIx28RJcZY410md8hqrOXb5s hvDqOk3PmXT+oMuSjVpgTNX2tgPWamB3kuKoCAMDdJUaMdVGu7jgaBfPuAfIdWrZGWU5 86uxfxkG3w/JJOdzG82sbK1xvVI0Z9+y2pGf4xwkSYmyTcmg9CK9NhrNXrUiLi4K0wyO RP2ryWVk0euMpTRlSi7F2moGmcmA1UsPj2nnZ0AByYZgPcOtiEU48qqz3Qomtrv22jre gdHsiOZx93WMHSk8mj3TeJwRkBhe/1MFkT6tjW6xB7XlsAVkKmiPJjNRP/0ZEXhpLcek HEBg== X-Gm-Message-State: AOJu0Yxe+KCYglo/6y64OOCUo43KCfJDS+/RG1YtjCzTnwEMp64gW2gO qNADm1kT+8r+ZUtdOoZG8jGEKycFGGE= X-Google-Smtp-Source: AGHT+IFfQVoYp4D+zc9rd2tXWxb9vfa3iNBCYH7Il+4IE/xlrWDytrwrs/Xe8d22VzKucwUgm6YKYw== X-Received: by 2002:a05:620a:7ef:b0:781:25aa:21fd with SMTP id k15-20020a05620a07ef00b0078125aa21fdmr2220556qkk.72.1704484407970; Fri, 05 Jan 2024 11:53:27 -0800 (PST) Received: from localhost.localdomain (dsl-10-135-125.b2b2c.ca. [72.10.135.125]) by smtp.gmail.com with ESMTPSA id c22-20020a05620a11b600b00781e1c466e7sm823178qkk.24.2024.01.05.11.53.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 11:53:27 -0800 (PST) From: Maxim Cournoyer Date: Fri, 5 Jan 2024 14:52:53 -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 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 --- Changes in v2: - Turn string->number into number->string 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..2f0ffe36fc 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" (number->string + (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 Fri Jan 5 19:52:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 58397 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 D82D227BBEC; Fri, 5 Jan 2024 19:54:56 +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 A9E0127BBE2 for ; Fri, 5 Jan 2024 19:54:55 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLqGa-00011L-VG; Fri, 05 Jan 2024 14:54:04 -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 1rLqGZ-000118-Ok for guix-patches@gnu.org; Fri, 05 Jan 2024 14:54:03 -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 1rLqGZ-0007dG-GD; Fri, 05 Jan 2024 14:54:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rLqGa-0000eT-DS; Fri, 05 Jan 2024 14:54:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68242] [PATCH core-updates v2 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: Fri, 05 Jan 2024 19:54: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.17044844222440 (code B ref 68242); Fri, 05 Jan 2024 19:54:04 +0000 Received: (at 68242) by debbugs.gnu.org; 5 Jan 2024 19:53:42 +0000 Received: from localhost ([127.0.0.1]:57970 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLqGE-0000dD-0F for submit@debbugs.gnu.org; Fri, 05 Jan 2024 14:53:42 -0500 Received: from mail-yw1-x1134.google.com ([2607:f8b0:4864:20::1134]:50437) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLqGC-0000cM-BK for 68242@debbugs.gnu.org; Fri, 05 Jan 2024 14:53:41 -0500 Received: by mail-yw1-x1134.google.com with SMTP id 00721157ae682-5f6b77c4743so1033137b3.1 for <68242@debbugs.gnu.org>; Fri, 05 Jan 2024 11:53:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704484410; x=1705089210; 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=BPx8/9xAygxLze+IkhW71JXdJJCMX0EatZkvKj/wqUY=; b=cjp/pn43n11L4jcgPu2pfCdb2ylf1q7a2ozOyhKiQhjigxDIxzVIk4n/02poYf5w08 AtQIlSl6wxtGawUo+cupkEk1leK9BmuOroAQjQtfzgwbwtJmw4EsN0Ni0P0msksRnjrC TYWw8mMIQ6k0X0dvGmZoYY5CIxY9NoSXulS4Rw0dyHGW+7zQhHVkaa+K3dLW+MkCjm++ y3vc0a9iwNMU0ibGzoMwFagQeBQOqaYrfRhlCeFCrr1DGOKLt/z+Ft00YwDa9/uP9ttT tcPHOPJZCsPVzO24bLodpeoxYl0IKau03dQr1O5kJUBUIrqhCuilJZKfZEpbcdhNATyS XXLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704484410; x=1705089210; 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=BPx8/9xAygxLze+IkhW71JXdJJCMX0EatZkvKj/wqUY=; b=sq9fsqdkbucjFRryoGQGTqv/pVnyv5C7PxUsSlKJlUZ4kKXpY8qmHI9LvvxPvOZl59 PpqAgq3MDBz6091ngDS7RwzeX2VnJYyi8imfD5iZMG2AFbYdEm9YPiXCsbTr+jBH/l41 Jk4vjFe6vEQH8qUVtBFbJmP+Qz68QB7kcdJyFStQv4G0GLV7OkxYFnGkQd6w9e9TSbdd Nv9Ol6e06qa7jAj3evs+eLGdD19B1UFya2/sP1Xc8RE/uAFOsg96NxvsM4Pv+wEB9Gbz 91Fk/KhU+p1PHNtzB4+q5/D8+7LNSnwVlEf5J2aF0wOQrBH0tsuPpP3e0f+IxNYmPbDg EYtg== X-Gm-Message-State: AOJu0Yy5AEli18srgdSYeM0CveiJ293vWrH/ob/h+5n+X2e/BiCYqi/9 gGdHGLmCLvkku/yZ+prCsH+BzbnQ2Eg= X-Google-Smtp-Source: AGHT+IEXr7/7wG5sHf09XyHirbEA2huiXq8aIe78cia9NWDIWLfa6V9PhtyKMmJ/7q0SrblFCtVRmQ== X-Received: by 2002:a81:71d7:0:b0:5ef:f83d:ab23 with SMTP id m206-20020a8171d7000000b005eff83dab23mr3120037ywc.5.1704484409867; Fri, 05 Jan 2024 11:53:29 -0800 (PST) Received: from localhost.localdomain (dsl-10-135-125.b2b2c.ca. [72.10.135.125]) by smtp.gmail.com with ESMTPSA id c22-20020a05620a11b600b00781e1c466e7sm823178qkk.24.2024.01.05.11.53.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 11:53:29 -0800 (PST) From: Maxim Cournoyer Date: Fri, 5 Jan 2024 14:52:54 -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 * 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 --- (no changes since v1) 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)