From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id iPUPE+JaA2AuIwAA0tVLHw (envelope-from ) for ; Sat, 16 Jan 2021 21:30:10 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id CcjQDuJaA2AHWQAAbx9fmQ (envelope-from ) for ; Sat, 16 Jan 2021 21:30:10 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 04BDD940309 for ; Sat, 16 Jan 2021 21:30:10 +0000 (UTC) Received: from localhost ([::1]:51626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0t97-0002GO-0k for larch@yhetil.org; Sat, 16 Jan 2021 16:30:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48484) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0t91-0002G5-3h for guix-patches@gnu.org; Sat, 16 Jan 2021 16:30:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:60833) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l0t90-00015L-SD for guix-patches@gnu.org; Sat, 16 Jan 2021 16:30:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l0t90-0000RG-OL for guix-patches@gnu.org; Sat, 16 Jan 2021 16:30:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#45891] [PATCH] packages: 'patch-and-repack' returns a directory when given a directory. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 16 Jan 2021 21:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45891 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxim Cournoyer Received: via spool by 45891-submit@debbugs.gnu.org id=B45891.16108325461600 (code B ref 45891); Sat, 16 Jan 2021 21:30:02 +0000 Received: (at 45891) by debbugs.gnu.org; 16 Jan 2021 21:29:06 +0000 Received: from localhost ([127.0.0.1]:44146 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l0t86-0000Pk-IK for submit@debbugs.gnu.org; Sat, 16 Jan 2021 16:29:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54912) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l0t83-0000PF-RX for 45891@debbugs.gnu.org; Sat, 16 Jan 2021 16:29:04 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:58591) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0t7y-0000fI-LS; Sat, 16 Jan 2021 16:28:58 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=37586 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1l0t7w-000377-VE; Sat, 16 Jan 2021 16:28:58 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20210115131548.8792-1-ludo@gnu.org> <878s8tluev.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 27 =?UTF-8?Q?Niv=C3=B4se?= an 229 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Sat, 16 Jan 2021 22:28:54 +0100 In-Reply-To: <878s8tluev.fsf@gmail.com> (Maxim Cournoyer's message of "Fri, 15 Jan 2021 17:14:32 -0500") Message-ID: <87lfcsy3jd.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: , Cc: 45891@debbugs.gnu.org Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -2.86 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 04BDD940309 X-Spam-Score: -2.86 X-Migadu-Scanner: scn0.migadu.com X-TUID: cuZGZLCiJfAQ Hi Maxim, Maxim Cournoyer skribis: > Ludovic Court=C3=A8s writes: > >> Previously, 'patch-and-repack' would always create a tar.xz archive as a >> result, even if the input was a directory (a checkout). This change >> reduces gratuitous CPU and storage overhead. > > I like it! > > Note that on core-updates, xz compression is relatively fast on modern > machines as it can do multi-threading. About space the savings; could > the 'temporary' pristine source be cleared from the store always? No, it=E2=80=99s not possible=E2=80=94the GC will remove what=E2=80=99s unr= eachable when it eventually runs. >> (define (tarxz-name file-name) >> ;; Return a '.tar.xz' file name based on FILE-NAME. >> - (let ((base (cond ((numeric-extension? file-name) >> - original-file-name) >> - ((checkout? file-name) >> - (string-drop-right file-name 9)) >> - (else (file-sans-extension file-name))))) >> + (let ((base (if (numeric-extension? file-name) >> + original-file-name >> + (file-sans-extension file-name)))) > > This is not new code, but I'm wondering what's the purpose of > numeric-extension? It=E2=80=99s for file names like =E2=80=9Chello-2.10=E2=80=9D, where you wo= uldn=E2=80=99t want to strip =E2=80=9C.10=E2=80=9D. (Such file names should be rare, but it=E2=80=99s n= ot impossible.) > What kind of files does it expect to catch? Also, what happened to > stripping the '-checkout' suffix that used to be done? It doesn't > seem like it will happen anymore. Stripping =E2=80=9C-checkout=E2=80=9D is no longer necessary because for th= ese we keep the original name. >> - (let ((name (tarxz-name original-file-name))) >> + (let ((name (if (checkout? original-file-name) >> + original-file-name >> + (tarxz-name original-file-name)))) >> (gexp->derivation name build >> #:graft? #f >> #:system system > > Was these cases (tar archive source derivation, directory source > derivation) already covered by tests under tests/packages.cm? How did > you otherwise test it? World rebuilding changes are not fun to test > without unit tests. In this case I rebuilt the world and tested =E2=80=98guix build -S=E2=80=99= on a git-fetch package with a snippet, but I agree that=E2=80=99s super expensiv= e (I tested the handful of commits I recently pushed to =E2=80=98core-updates=E2= =80=99 at the same time.) There are no unit tests specifically for this procedure, but I think we=E2=80=99ll quickly find out if it doesn=E2=80=99t behave as intended. WDYT? Thanks, Ludo=E2=80=99.