From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] [PATCH 0/2] guix hash: eases conversion Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 20 Oct 2021 16:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51307@debbugs.gnu.org Cc: zimoun X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.163474863828257 (code B ref -1); Wed, 20 Oct 2021 16:51:01 +0000 Received: (at submit) by debbugs.gnu.org; 20 Oct 2021 16:50:38 +0000 Received: from localhost ([127.0.0.1]:55347 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdEnW-0007Lh-5w for submit@debbugs.gnu.org; Wed, 20 Oct 2021 12:50:38 -0400 Received: from lists.gnu.org ([209.51.188.17]:49358) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdEnU-0007LZ-FM for submit@debbugs.gnu.org; Wed, 20 Oct 2021 12:50:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54788) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdEnU-00005R-7a for guix-patches@gnu.org; Wed, 20 Oct 2021 12:50:36 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:50945) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mdEnS-0003CK-Jv for guix-patches@gnu.org; Wed, 20 Oct 2021 12:50:35 -0400 Received: by mail-wm1-x334.google.com with SMTP id o24so12909662wms.0 for ; Wed, 20 Oct 2021 09:50:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hl4YRx3tRT2y77Hxao98lVhlM9QWSE6hlk1KGV/G+vg=; b=qY6lSHs+0fAsCzrTr+2dbEXRS0sqSAobHszEIzuf4m7zJvctdu0Az4DuKqVRf/o5QD I7QfVqmLHdhTFIsl/st5zg2ZgaXJnxLPAcxWFLiOc7TTYnT/IRPGWeHY9WjsgejxOQPx 2H8GXkKkuMv+92Ikrq/vRecVIBa3No+YX0Qsm9IJF25NOgri6R0qiRggvj3y02T0t5iW IwFuMjZbnAtlP7FSOrY/BROh3yqAPzybEvZj92F9A+xwmnvWeGwC4xdjbypLa4tEX8SC vvwJRbnGJlUAAp5c3yfuKDxbyCTwh5L3LlYjqLvId3IhgDFEmzpRdlA9twNhYUF41s/F NwAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hl4YRx3tRT2y77Hxao98lVhlM9QWSE6hlk1KGV/G+vg=; b=fWhnf4lXbedU2ZLzLRXNgcZ5kHokFDHKAjiZAONzoojOyLH5cuGvjRdZgpvkkjFAbC q6IGM1pJiEFS7g7h1F7Py6OKsGBiaPKsjCKH3Ca5H/BsAUTPz1Q47QdOmCULkP4GK76m Jc/nJXRnZo34T5i9JMsVApebaxsFBB7p4sJrFnTKYlfg1KWAX/YW4qiZi8bSpogDzMBo GppmB+/zxrV1LLkNOkky32yOYodDsfB4YP1+r1Q6/an/Rft9fMBQKeyhkpZl2d6QJqzK YgBc9Z7bzFA+gei+q+6/mrCqJVDAhlNg7p/nzquXrMAMGQ69OMBrxgN1DpuWkIXt++FT zvpg== X-Gm-Message-State: AOAM533MPQeKHQDQK0OT2z76WkCZXnoj/pHfOQ7v5LeBfnx10T2bPPan JbAZRk/mWw/xhsdMB8e9OE8vurdY/ho= X-Google-Smtp-Source: ABdhPJy9LxXOSsPhVYv9Q8TsW7Op7k8rSkcGWtY/EGjKU80F+RZ3GzAwMVnDCmY8YjPhYWx+HDTZfA== X-Received: by 2002:a7b:c08b:: with SMTP id r11mr351448wmh.167.1634748632625; Wed, 20 Oct 2021 09:50:32 -0700 (PDT) Received: from localhost.localdomain ([193.48.40.117]) by smtp.gmail.com with ESMTPSA id r205sm2565688wma.3.2021.10.20.09.50.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 09:50:32 -0700 (PDT) From: zimoun Date: Wed, 20 Oct 2021 18:50:20 +0200 Message-Id: <20211020165020.3358311-1-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=zimon.toutoune@gmail.com; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Hi, The first patch is a tiny improvement on the error handling. 1. The current situation does not correctly handle error because of ’with-error-handling’. 2. Using the option recursive changes the result for tarball, as with: $ guix hash $(guix build hello -S) 0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i $ guix hash $(guix build hello -S) --recursive 1qx3qqk86vgdvpqkhpgzq3gfcxmys29wzfizjb9asn4crbn503x9 And I am not able to imagine a case. To me, it should be a fixed-point. That’s what the first patch correct. Moreover, it is possible to pass several arguments, --8<---------------cut here---------------start------------->8--- $ find . -maxdepth 1 -type d | xargs guix hash -r guix hash: erreur : nombre d'arguments incorrect $ find . -maxdepth 1 -type d | xargs ./pre-inst-env guix hash -r 1rzh9b4b4qc5nf4mq601jr2p3xsw690q6d4137ymgq0an9xsli9v 1cgdvnjlh1ziwb12ax2wcrs7ddr44c2nhjali1v3ilsv7fsm79fq 0x64hc3jqq1jwbym5gvcbnsck4v08xxa3kr44m9961nsml1rpmld 03gzaccd1cws05sf469l9ghf9mhxqsnlkkbr859l13alba5isirb 1qmmppfg65wdzcg137hg62ic31ykzvgb26brcv77is1nszvrqm14 1ajw5s2ykyyvpaisv8xbd8rn77q1whk2fxmyfqn3qyzxjf8vw7sz 1fjnk5hsfvsyahf997f6nca5c01jh7gm590xcx2d2adjj2vm51r2 0hm8s9hc6c4x32v3ff0kz7npd1n2i3ld6p69ya68wxfhhkhwpg6r 1k1y2hax62r2jj7j8vk8wx6mhww42g77x1fp7iy151alplv6mi23 1c3dg3mfl4kg0px7rdj52qyxkpn00sdaf7z1bxib4n2wy175gd9m 15680dqbzr7dcngyqblyzqnr5s74rka4qh76n2pdfndd9gc81j0h 0hvlnas7grx69hrxbxz3zw9z80wr02m2c0lbjs0kcxv6wv3da871 1zvw0k4gl3sj3hagp415iy0dcqx8c1k3zwph3n1xcg0z2ljfqpl2 --8<---------------cut here---------------end--------------->8--- Then, working on Disarchive which uses base16 as encoding, it is annoying twice, a) because it requires to download when all the sources b) because it sometimes requires to apply patches Compare, $ guix hash $(guix build ceph -S) 0ppd362s177cc47g75v0k27j7aaf27qc31cbbh0j2g30wmhl8gj7 with the checksum in the package definition: 0lmdri415hqczc9565s5m5568pnj97ipqxgnw6085kps0flwq5zh. With the second patch, it becomes easy to convert the checksum from upstream: $ ./pre-inst-env guix hash ceph -f base16 f017cca903face8280e1f6757ce349d25e644aa945175312fb0cc31248ccad52 and nothing is downloaded. Get the checksum of what Guix really builds is done via the current way, for instance, $ guix hash $(guix build ceph -S) -f base16 473e4461e5603c21015c8b85c1f0114ea9238f986097f30e61ec9ca08519ed5e and the second patch allows to convert the checksum from the package definition (without downloading). For instance, now it is really cheap to do: --8<---------------cut here---------------start------------->8--- guix package -A | cut -f1 | grep julia | xargs ./pre-inst-env guix hash -f base16 --8<---------------cut here---------------end--------------->8--- All the best, simon zimoun (2): scripts: hash: Improve error handling. scripts: hash: Support file or package. guix/scripts/hash.scm | 75 ++++++++++++++++++++++++++++++------------- tests/guix-hash.sh | 10 ++++++ 2 files changed, 63 insertions(+), 22 deletions(-) base-commit: 19d3cfec72720a4a1339be3d14f4d88ae5bd59f4 -- 2.32.0 From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] [PATCH 1/2] scripts: hash: Improve error handling. References: <20211020165020.3358311-1-zimon.toutoune@gmail.com> In-Reply-To: <20211020165020.3358311-1-zimon.toutoune@gmail.com> Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 20 Oct 2021 16:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51307@debbugs.gnu.org Cc: zimoun Received: via spool by 51307-submit@debbugs.gnu.org id=B51307.163474889128672 (code B ref 51307); Wed, 20 Oct 2021 16:55:02 +0000 Received: (at 51307) by debbugs.gnu.org; 20 Oct 2021 16:54:51 +0000 Received: from localhost ([127.0.0.1]:55357 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdErb-0007SN-0p for submit@debbugs.gnu.org; Wed, 20 Oct 2021 12:54:51 -0400 Received: from mail-wr1-f50.google.com ([209.85.221.50]:45632) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdErY-0007S2-MJ for 51307@debbugs.gnu.org; Wed, 20 Oct 2021 12:54:49 -0400 Received: by mail-wr1-f50.google.com with SMTP id r10so48265346wra.12 for <51307@debbugs.gnu.org>; Wed, 20 Oct 2021 09:54:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OCiq+B8eY3dy24gREyN0p0VuTvCUjlqt45JBpT64X1g=; b=iiZDbFfXtEJuoUFA5jn2VuLREdMKQv5qEclE5TvRv9yA4v/EH/O+Yy5kbpQzIFyyjh /jsSEJQsNCGVFop2/SNYOajwd0sMEiynuJNeKaTWo6RaHS3+ecHAAV4xNG5GTOPJkc+A 0zD6EKwLAy2TcMXyOgrjLVRCyoovOxRdciPWWEFlBez2AN+Cz3uBOSA9T/vQ4FvpD+PZ 22ZF/v/BmkuMzkpApf/aV9C5YgFbSOZmeKWDab+XD2XQiVtF9ttX/QHu3gejsVllZmtA ECsmDcIO4tlmBzLCe2jHMY6kaWkQxtHqamulAaWw/hIBcpbVRKqvZBhDCW2hQIExopNK baSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OCiq+B8eY3dy24gREyN0p0VuTvCUjlqt45JBpT64X1g=; b=h3kCHEqOxYE7b9hnQkD4kizwqxyshmH3okR5KbhHr5hKYTPw0AZDEDf8qFyM/S0/Nn 0OzOE80Yevyrw64d0dYdvGiIN8HTgCbo+20mN/NHQXazSfEARQIJqiZEcz6IQNNpq2vV NRnCYv0xRedUh4EAuVbkk9PKHOCJUIpeN8HUIy2kijvLW/JRY5w3hA+3GikzwCpWr9Vb ITWi7dhOFJkgy8DpErRFOENvhQs1ttkUxU4KQLrBhFGcnVE+4FrbvP6+/hDt5euNTUZW C+woVyPk1KOXj5xcYE8/cAEpA8nFj3PbCeBfPjzc6cKEFVdC9eTnai9P6eHAHO6U/j52 iRPg== X-Gm-Message-State: AOAM531SqonA7N09H4ur0xz72sU//zfbh5UiMk+ttKLEBWacQC4TBww8 BOQllvtUbDhZwkhROnmPt+bT43APUh0= X-Google-Smtp-Source: ABdhPJzEeEPHMwjPY8fy3pK763EZ5pD3BaG0siPnvRRUbHiZzSgP3tRkL/PeaAjbwMWmA1JH8nWnKg== X-Received: by 2002:a5d:47cb:: with SMTP id o11mr487718wrc.184.1634748882763; Wed, 20 Oct 2021 09:54:42 -0700 (PDT) Received: from localhost.localdomain ([193.48.40.117]) by smtp.gmail.com with ESMTPSA id o11sm3639977wry.0.2021.10.20.09.54.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 09:54:42 -0700 (PDT) From: zimoun Date: Wed, 20 Oct 2021 18:54:34 +0200 Message-Id: <20211020165435.3358398-1-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * guix/scripts/hash.scm (guix-hash): Allow several files. [directory?]: New procedure. [file-hash]: Catch system-error. [hash-to-display]: New procedure. --- guix/scripts/hash.scm | 56 +++++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/guix/scripts/hash.scm b/guix/scripts/hash.scm index b8622373cc..f3363549d3 100644 --- a/guix/scripts/hash.scm +++ b/guix/scripts/hash.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2013 Nikita Karetnikov ;;; Copyright © 2016 Jan Nieuwenhuizen ;;; Copyright © 2018 Tim Gesthuizen +;;; Copyright © 2021 Simon Tournier ;;; ;;; This file is part of GNU Guix. ;;; @@ -135,6 +136,11 @@ (define (vcs-file? file stat) (else #f))) + (define (directory? file) + (case (stat:type (stat file)) + ((directory) #t) + (else #f))) + (let* ((opts (parse-options)) (args (filter-map (match-lambda (('argument . value) @@ -149,27 +155,37 @@ (define (vcs-file? file stat) (define (file-hash file) ;; Compute the hash of FILE. ;; Catch and gracefully report possible '&nar-error' conditions. - (with-error-handling - (if (assoc-ref opts 'recursive?) + (if (and (assoc-ref opts 'recursive?) + (directory? file)) + (with-error-handling (let-values (((port get-hash) (open-hash-port (assoc-ref opts 'hash-algorithm)))) (write-file file port #:select? select?) (force-output port) - (get-hash)) - (match file - ("-" (port-hash (assoc-ref opts 'hash-algorithm) - (current-input-port))) - (_ (call-with-input-file file - (cute port-hash (assoc-ref opts 'hash-algorithm) - <>))))))) - - (match args - ((file) - (catch 'system-error - (lambda () - (format #t "~a~%" (fmt (file-hash file)))) - (lambda args - (leave (G_ "~a~%") - (strerror (system-error-errno args)))))) - (x - (leave (G_ "wrong number of arguments~%")))))) + (get-hash))) + (catch 'system-error + (lambda _ + (call-with-input-file file + (cute port-hash (assoc-ref opts 'hash-algorithm) + <>))) + (lambda args + (when (directory? file) + (display-hint (G_ "Try @option{--recursive}."))) + (leave (G_ "~a ~a~%") + file + (strerror (system-error-errno args))))))) + + (define (hash-to-display thing) + (match thing + ((? file-exists? file) + (fmt (file-hash file))) + ("-" (with-error-handling + (fmt (port-hash (assoc-ref opts 'hash-algorithm) + (current-input-port))))) + (x + (leave (G_ "wrong argument~%"))))) + + (for-each + (lambda (arg) + (format #t "~a~%" (hash-to-display arg))) + args))) -- 2.32.0 From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] [PATCH 2/2] scripts: hash: Support file or package. Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 20 Oct 2021 16:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51307@debbugs.gnu.org Cc: zimoun Received: via spool by 51307-submit@debbugs.gnu.org id=B51307.163474889128678 (code B ref 51307); Wed, 20 Oct 2021 16:55:02 +0000 Received: (at 51307) by debbugs.gnu.org; 20 Oct 2021 16:54:51 +0000 Received: from localhost ([127.0.0.1]:55359 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdErb-0007SP-DL for submit@debbugs.gnu.org; Wed, 20 Oct 2021 12:54:51 -0400 Received: from mail-wr1-f45.google.com ([209.85.221.45]:36707) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdErY-0007S3-Tg for 51307@debbugs.gnu.org; Wed, 20 Oct 2021 12:54:49 -0400 Received: by mail-wr1-f45.google.com with SMTP id o20so48413176wro.3 for <51307@debbugs.gnu.org>; Wed, 20 Oct 2021 09:54:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WydHqYw6Dw85SFFZAywbmj0Idl7DO7jpycThEmU3aGM=; b=O6+QbwDZYqGJ4O1mCFRV9O5wyyHPBWqI6CByRPvtWQuNZB+Uib0GYzy0/WVmQkkbYO BMWGA+0bxztDy7u+flXoe8gak5KLZ452vuth1wOcvQFQqa3Tbf+haj88Am3+d191oF8m Zhx7WpItGqRRO5g7v0aSR1iIkldx9MD1VOGVvP+nO2wOWj3Dhq55ug1RX1ToNPYwavQs lsmg3/6Y+qp51bW4xLIJ3ndiH5ueW8HBMfbTcy1w7T7OArbKLCeF5WzQuGA8MxcXN9rx 7JJmJScYoPKlS9uxeizLLo0D3XFvUjjWfYxC6WJCGq0fLDf9ertg6ZYtDriZubw+1q3n bVCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WydHqYw6Dw85SFFZAywbmj0Idl7DO7jpycThEmU3aGM=; b=ER7MT/IwBmkPvguUjrFFnyy9AU3/dsH3Jqzxs8saOLYkKJmwc7RsQRJJrkFvs91kXu je+xR/PpXsSl2E8/0VvbatzlvsDznDjr3j82KKykFSOQfruJpvXpCKn7SdNsIt/PzZci 8kQfCL+cHMb49oMAZa77paegAhJRDhO1Cv5Tj/48oCHkcPu0Jcgw91hsXnVRAG2zNchn DReam0T67X2GiiNE3vcDv1JipRivzkIGqx2PbPwd6mvTRTYbZjvA9cY/QMhCuMcAfimN Hvyl/OzNLrFMLAWd+J3mDFyzgwAUsEi/7GKTLVhh8BJMSHnBSA+6nA4d12lr/s2Bu8/M ZOmA== X-Gm-Message-State: AOAM533vMx9o9BWqbjeK0t6tWRUeYbwj/dKCzJ9GYReqR/XSPuZdttlr NxM44/TokgFMPT1cfLhqnGfk7VI9rQU= X-Google-Smtp-Source: ABdhPJyuyhStVb83QEVr+jaXqkC7mmOW2Gmm1E13hqScvRhWKaJD0l6VNLt0a5DN0Aya5cnknexhqQ== X-Received: by 2002:adf:a54f:: with SMTP id j15mr485809wrb.218.1634748883217; Wed, 20 Oct 2021 09:54:43 -0700 (PDT) Received: from localhost.localdomain ([193.48.40.117]) by smtp.gmail.com with ESMTPSA id o11sm3639977wry.0.2021.10.20.09.54.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 09:54:42 -0700 (PDT) From: zimoun Date: Wed, 20 Oct 2021 18:54:35 +0200 Message-Id: <20211020165435.3358398-2-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211020165435.3358398-1-zimon.toutoune@gmail.com> References: <20211020165435.3358398-1-zimon.toutoune@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * guix/scripts/hash.scm (guix-hash)[package?]: New procedure. [hash-to-display]: Use it. * tests/guix-hash.scm: New test. --- guix/scripts/hash.scm | 19 +++++++++++++++++-- tests/guix-hash.sh | 10 ++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/guix/scripts/hash.scm b/guix/scripts/hash.scm index f3363549d3..4f0d41629f 100644 --- a/guix/scripts/hash.scm +++ b/guix/scripts/hash.scm @@ -22,6 +22,9 @@ (define-module (guix scripts hash) #:use-module (gcrypt hash) + #:use-module ((gnu packages) #:select (find-best-packages-by-name)) + #:use-module (guix packages) + #:use-module ((guix utils) #:select (package-name->name+version)) #:use-module (guix serialization) #:use-module (guix ui) #:use-module (guix scripts) @@ -48,8 +51,8 @@ (define %default-options (hash-algorithm . ,(hash-algorithm sha256)))) (define (show-help) - (display (G_ "Usage: guix hash [OPTION] FILE -Return the cryptographic hash of FILE.\n")) + (display (G_ "Usage: guix hash [OPTION] FILE-OR-PACKAGE +Return the cryptographic hash of FILE-OR-PACKAGE.\n")) (newline) (display (G_ "\ Supported formats: 'base64', 'nix-base32' (default), 'base32', @@ -141,6 +144,12 @@ (define (directory? file) ((directory) #t) (else #f))) + (define (package? spec) + (let-values (((name version) (package-name->name+version spec))) + (match (find-best-packages-by-name name version) + ((package) package) + (_ #f)))) + (let* ((opts (parse-options)) (args (filter-map (match-lambda (('argument . value) @@ -182,6 +191,12 @@ (define (hash-to-display thing) ("-" (with-error-handling (fmt (port-hash (assoc-ref opts 'hash-algorithm) (current-input-port))))) + ((? package? spec) + (let* ((package (package? spec)) + (origin (package-source package)) + (content-hash (origin-hash origin)) + (hash (content-hash-value content-hash))) + (fmt hash))) (x (leave (G_ "wrong argument~%"))))) diff --git a/tests/guix-hash.sh b/tests/guix-hash.sh index c4461fa955..41bd2b1588 100644 --- a/tests/guix-hash.sh +++ b/tests/guix-hash.sh @@ -1,6 +1,7 @@ # GNU Guix --- Functional package management for GNU # Copyright © 2013, 2014, 2016, 2020, 2021 Ludovic Courtès # Copyright © 2016 Jan Nieuwenhuizen +# Copyright © 2021 Simon Tournier # # This file is part of GNU Guix. # @@ -65,3 +66,12 @@ test `guix hash -r $tmpdir -x` = 10k1lw41wyrjf9mxydi0is5nkpynlsvgslinics4ppir13g # Without '-r', this should fail. ! guix hash "$tmpdir" +cat > "$tmpdir/foo.scm"<base16-string + (content-hash-value (origin-hash (package-source hello))))) +EOF +test `guix hash hello -f base16` = `guix repl -- $tmpdir/foo.scm` -- 2.32.0 From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] [PATCH 0/2] guix hash: eases conversion Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 30 Oct 2021 14:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: zimoun Cc: 51307@debbugs.gnu.org Received: via spool by 51307-submit@debbugs.gnu.org id=B51307.163560518814628 (code B ref 51307); Sat, 30 Oct 2021 14:47:02 +0000 Received: (at 51307) by debbugs.gnu.org; 30 Oct 2021 14:46:28 +0000 Received: from localhost ([127.0.0.1]:58132 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mgpcp-0003ns-OI for submit@debbugs.gnu.org; Sat, 30 Oct 2021 10:46:27 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38104) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mgpco-0003nf-NF for 51307@debbugs.gnu.org; Sat, 30 Oct 2021 10:46:26 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:54912) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgpcj-0006PW-EZ; Sat, 30 Oct 2021 10:46:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=+tjRRrur6psz8e3ZD6i2AQyVIudKbWKoNfY00cNSW5I=; b=bc14r2ezY1Ovs3oQ7X5Z Anv9iwwHbMCAWCOvU3i+Jc33pXG7YgKAaGj5uhU/R4ceU+OVhJBxZVW5miwOm7g8+cn9SBz+vXXXf 1bm8fFRSb86dxflrHtNdwdkeVsog3P34qwxUhI6wEIusufai4ti8lNlrZlfkFlCM2jBVz0qdwPI+T FwJcUQYkaJ2dDZ40KnBT428Na8JEkKXXiUL9C3dtSRPGgfVlkb7yrIyas6FOpgExBOtWdw7ZBuP43 6h/hLUQcq15uwL1B55DL6BIn1XMYI+AwP68e+w4X+u5gwRupDFLPCyUmbkqXdsj3qD/zIirLDDNXz uCMPdmpDxFlwQg==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:55488 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgpcj-0001yG-23; Sat, 30 Oct 2021 10:46:21 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20211020165020.3358311-1-zimon.toutoune@gmail.com> <20211020165435.3358398-1-zimon.toutoune@gmail.com> Date: Sat, 30 Oct 2021 16:46:18 +0200 In-Reply-To: <20211020165435.3358398-1-zimon.toutoune@gmail.com> (zimoun's message of "Wed, 20 Oct 2021 18:54:34 +0200") Message-ID: <875ytetvt1.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, zimoun skribis: > * guix/scripts/hash.scm (guix-hash): Allow several files. > [directory?]: New procedure. > [file-hash]: Catch system-error. > [hash-to-display]: New procedure. Nice! Could you update guix.texi and tests/guix-hash.texi? > - (with-error-handling > - (if (assoc-ref opts 'recursive?) > + (if (and (assoc-ref opts 'recursive?) > + (directory? file)) This change is not related to the main purpose of the patch. More importantly, note that =E2=80=98--recursive=E2=80=99 is not limited to= directories: it preserves file properties (directory, executable, or regular), so it=E2=80=99s also useful for executable files for instance. It can also be= used for regular files, even if it=E2=80=99s less useful. > + (define (hash-to-display thing) > + (match thing > + ((? file-exists? file) > + (fmt (file-hash file))) > + ("-" (with-error-handling > + (fmt (port-hash (assoc-ref opts 'hash-algorithm) > + (current-input-port))))) I=E2=80=99d swap the order of the two clauses and remove the call to =E2=80=98file-exists?=E2=80=99: if the file doesn=E2=80=99t exist, =E2=80= =98file-hash=E2=80=99 will raise an error. > + (x > + (leave (G_ "wrong argument~%"))))) > + > + (for-each > + (lambda (arg) > + (format #t "~a~%" (hash-to-display arg))) Or just (compose display hash-to-display) ? Maybe s/hash-to-display/formatted-hash/. Could you send an updated patch? Thanks, Ludo=E2=80=99. From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] [PATCH 0/2] guix hash: eases conversion Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 30 Oct 2021 14:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: zimoun Cc: 51307@debbugs.gnu.org Received: via spool by 51307-submit@debbugs.gnu.org id=B51307.163560533515042 (code B ref 51307); Sat, 30 Oct 2021 14:49:02 +0000 Received: (at 51307) by debbugs.gnu.org; 30 Oct 2021 14:48:55 +0000 Received: from localhost ([127.0.0.1]:58137 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mgpfD-0003uY-5y for submit@debbugs.gnu.org; Sat, 30 Oct 2021 10:48:55 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38418) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mgpfB-0003uK-IB for 51307@debbugs.gnu.org; Sat, 30 Oct 2021 10:48:54 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:54952) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgpf6-0007wY-4V; Sat, 30 Oct 2021 10:48:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=SghBQjzJax+JS2n3X19tz98zmU9Xv645OZEbXIvNcp8=; b=P+NZXISB5yupucGCC80J ZaVzAVUpoBFFL9mfNpG85PlDR7sQQNC/5yirQyBIxOy66OswL9AJp8UTnhrIYzRXjXn/Ppk2snbnh HQwVr0IVAvPlKnwkJeSm4EFzDLh5DO99Jko7L09IMIA6lhOLKAnuivJlfU+eLVPzXcQ/UfKLSPGmJ GJTom0C4jFCmccXgpnea0w0g2eha2YCLEnX7SlKmRQ99AxrmfdfBrQNn8dUg4jCuGn97h4+s6yM1o NNHnbOkPD8zJwbTObgFvPAu3lD1KmeJD9zEzIbgsdqJaHGlfs3T8grS6Fdfwpwu0WUk4wouTU/GTT yM+qwD1AX3Rpbw==; Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=55426 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgpf5-0002AW-Lr; Sat, 30 Oct 2021 10:48:47 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20211020165435.3358398-1-zimon.toutoune@gmail.com> <20211020165435.3358398-2-zimon.toutoune@gmail.com> Date: Sat, 30 Oct 2021 16:48:45 +0200 In-Reply-To: <20211020165435.3358398-2-zimon.toutoune@gmail.com> (zimoun's message of "Wed, 20 Oct 2021 18:54:35 +0200") Message-ID: <871r42tvoy.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) zimoun skribis: > * guix/scripts/hash.scm (guix-hash)[package?]: New procedure. > [hash-to-display]: Use it. > * tests/guix-hash.scm: New test. > --- > guix/scripts/hash.scm | 19 +++++++++++++++++-- > tests/guix-hash.sh | 10 ++++++++++ > 2 files changed, 27 insertions(+), 2 deletions(-) > > diff --git a/guix/scripts/hash.scm b/guix/scripts/hash.scm > index f3363549d3..4f0d41629f 100644 > --- a/guix/scripts/hash.scm > +++ b/guix/scripts/hash.scm > @@ -22,6 +22,9 @@ >=20=20 > (define-module (guix scripts hash) > #:use-module (gcrypt hash) > + #:use-module ((gnu packages) #:select (find-best-packages-by-name)) > + #:use-module (guix packages) > + #:use-module ((guix utils) #:select (package-name->name+version)) I think I would prefer to keep (guix scripts hash) bare-bones, not depending on the package machinery. Most of the time one can run: guix hash $(guix build -S PACKAGE) It=E2=80=99s not quite what you want if the package has patches or a snippe= t, but that=E2=80=99s okay IMO. WDYT? Thanks, Ludo=E2=80=99. From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] [PATCH 0/2] guix hash: eases conversion Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 30 Oct 2021 14:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: zimoun Cc: 51307@debbugs.gnu.org Received: via spool by 51307-submit@debbugs.gnu.org id=B51307.163560560615521 (code B ref 51307); Sat, 30 Oct 2021 14:54:02 +0000 Received: (at 51307) by debbugs.gnu.org; 30 Oct 2021 14:53:26 +0000 Received: from localhost ([127.0.0.1]:58142 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mgpjZ-00042H-OX for submit@debbugs.gnu.org; Sat, 30 Oct 2021 10:53:25 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38976) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mgpjY-000425-D7 for 51307@debbugs.gnu.org; Sat, 30 Oct 2021 10:53:24 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:55006) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgpjT-0008R4-20; Sat, 30 Oct 2021 10:53:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=S9PEHJ4sYAlFwxKInelHg1Pou2XCJLRkkRRanF7T+Jw=; b=nyIXtGDhb+Yyq87ZpBcL 9a+QSvHJNK+nlOc6t1MzzP5DHvjXt4waSGAXWpRc+ihzBnGjLZMHTCwXmiLA4wPjqV399asMy1fRX NVaMWuqG7f2QnLjm2CgfB0/vBrQAzeClDwROP3NTKxA7K67ju7dElulEIwfw1oE3oKjhja4LsfOnu yHHnHGqwHUSSBi2F/JNVXjA2E1AQ+Un6DWnCKFccmu8bOinOoHexlChL6VToI0SL1+yDnwjOSyBBa 2tnXtcbrP8da7HTkULSolcEG0fwAKnTt0CBy/1JDxrWk4WSfAA7Go6yNH14gjYEgVE4mjoV87HM6x PwBkQ+ZW7MxMpA==; Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=55428 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgpjS-0002ac-HQ; Sat, 30 Oct 2021 10:53:18 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20211020165020.3358311-1-zimon.toutoune@gmail.com> Date: Sat, 30 Oct 2021 16:53:17 +0200 In-Reply-To: <20211020165020.3358311-1-zimon.toutoune@gmail.com> (zimoun's message of "Wed, 20 Oct 2021 18:50:20 +0200") Message-ID: <87wnlusgwy.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, zimoun skribis: > 2. Using the option recursive changes the result for tarball, as with: > > $ guix hash $(guix build hello -S) > 0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i > > $ guix hash $(guix build hello -S) --recursive > 1qx3qqk86vgdvpqkhpgzq3gfcxmys29wzfizjb9asn4crbn503x9 > > And I am not able to imagine a case. To me, it should be a fixed-poi= nt. > That=E2=80=99s what the first patch correct. That=E2=80=99s expected: =E2=80=98--recursive=E2=80=99 uses a different com= putation method, including file metadata (technically, it serializes the file as a nar and computes the hash of the nar). [...] > Then, working on Disarchive which uses base16 as encoding, it is annoying > twice, > > a) because it requires to download when all the sources > b) because it sometimes requires to apply patches > > Compare, > > $ guix hash $(guix build ceph -S) > 0ppd362s177cc47g75v0k27j7aaf27qc31cbbh0j2g30wmhl8gj7 > > with the checksum in the package definition: > 0lmdri415hqczc9565s5m5568pnj97ipqxgnw6085kps0flwq5zh. > > With the second patch, it becomes easy to convert the checksum from upstr= eam: > > $ ./pre-inst-env guix hash ceph -f base16 > f017cca903face8280e1f6757ce349d25e644aa945175312fb0cc31248ccad52 > > and nothing is downloaded. Get the checksum of what Guix really builds is > done via the current way, for instance, > > $ guix hash $(guix build ceph -S) -f base16 > 473e4461e5603c21015c8b85c1f0114ea9238f986097f30e61ec9ca08519ed5e > > and the second patch allows to convert the checksum from the package > definition (without downloading). Ah yes, got it. (I should read messages in the right order, oops!) An obvious problem with the interface you propose is that it=E2=80=99s ambiguous: are you printing the hash of the =E2=80=98ceph=E2=80=99 package,= or computing that of the =E2=80=98ceph=E2=80=99 file? I=E2=80=99m sure the Zen of Pytho= n has something on ambiguity. ;-) Do you think there=E2=80=99s another place where we could provide helpers f= or the die-hard Disarchive hackers among us? Maybe we could get =E2=80=98guix= lint -c archival=E2=80=99 to print Disarchive URLs upon failure, and that=E2=80= =99d already help? WDYT? Thanks! Ludo=E2=80=99. From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] [PATCH 0/2] guix hash: eases conversion Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 30 Oct 2021 15:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 51307@debbugs.gnu.org Received: via spool by 51307-submit@debbugs.gnu.org id=B51307.163560767619274 (code B ref 51307); Sat, 30 Oct 2021 15:28:01 +0000 Received: (at 51307) by debbugs.gnu.org; 30 Oct 2021 15:27:56 +0000 Received: from localhost ([127.0.0.1]:58167 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mgqGx-00050m-P4 for submit@debbugs.gnu.org; Sat, 30 Oct 2021 11:27:56 -0400 Received: from mail-wm1-f47.google.com ([209.85.128.47]:51075) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mgqGv-00050J-Gm for 51307@debbugs.gnu.org; Sat, 30 Oct 2021 11:27:53 -0400 Received: by mail-wm1-f47.google.com with SMTP id 133so1110163wme.0 for <51307@debbugs.gnu.org>; Sat, 30 Oct 2021 08:27:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-transfer-encoding; bh=v+Ibs/l/f+XV1/PwBR1Z0B0FiXxQDSMX9HEqpW8qAgc=; b=CY6C5gkiqVn9NOfEhtICrlkAzVGL/BbmlgKFTFp1jR+1md/YL22NDK5DTzoZtsVILd Tnnc7vXrHIUzmt8CHJ5vsT7vN/spN1dF6RXZFPYiqrgx77yF+a5+T8D4RBw3PpV72r9h Qjiy9PIFxqmKbEVDR7W/VHp5qCOCjj2YMuPhxlM2C+YfYxEx7GAzsjD3A+uTbE55jKtt NkU1PtlVoykAXHMbIqowq/r1WJeG+kqnrJyxBS974kHjHMq0amXbzNPgzBL96kszzkkn hwfN8VGnqd/joJmRdwnInDCdCJN1v7nTAvX0qizUAHddsA8KG04oZSwhcldQQ3ZrBTV/ 3AlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=v+Ibs/l/f+XV1/PwBR1Z0B0FiXxQDSMX9HEqpW8qAgc=; b=qouKNO0TmkzXMrl7BzzcORf6rPgdf394EJ7JzcLrut/5ICIv57KHys1CXwr0k3wIp3 MsyBHV9fcmRMRf7LPslSLhOIEuop8FfP0dVFlyG7mzixJ0On5Km40a9w6mMs0sQggERw 2GLSxsPxoozTrt4YaacSVFOGNQC4BDSQjtJDKVbyKSXLmjJ/RKTU/zNavD4fRUE1Bwje aON4Dn2KXKNARu6o2EJdgbi/DMsRu+WzUJdFPpFJp6Lzc3hhgOgkZMc5uj/zYzEWuDlV gHJKLT9bmscv/Ntc+yLrwB+f0ZGJg+6yauDkyz0P7rcetxOoH3Bf+Ei1jcubI8869KNx WXRA== X-Gm-Message-State: AOAM53340LYTaLmYgi7HHAvuOZ6l0TXi9DRg+7gU6mlJSMVTJbZUIc6/ Enj41ts93dfzHtAs9wl17xn56UF+tQ4= X-Google-Smtp-Source: ABdhPJxEYIVjmwjpA7Psrdh0FJf2pJZoYboQPK0AgdYyu0LO+k11DYKOnDgsqLxCsjoZzmJDhs0fcQ== X-Received: by 2002:a1c:9851:: with SMTP id a78mr6600128wme.116.1635607667595; Sat, 30 Oct 2021 08:27:47 -0700 (PDT) Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id n9sm8173586wmq.6.2021.10.30.08.27.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Oct 2021 08:27:47 -0700 (PDT) From: zimoun In-Reply-To: <87wnlusgwy.fsf@gnu.org> References: <20211020165020.3358311-1-zimon.toutoune@gmail.com> <87wnlusgwy.fsf@gnu.org> Date: Sat, 30 Oct 2021 17:19:56 +0200 Message-ID: <86tugyleub.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Ludo, On Sat, 30 Oct 2021 at 16:53, Ludovic Court=C3=A8s wrote: > zimoun skribis: > >> 2. Using the option recursive changes the result for tarball, as with: >> >> $ guix hash $(guix build hello -S) >> 0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i >> >> $ guix hash $(guix build hello -S) --recursive >> 1qx3qqk86vgdvpqkhpgzq3gfcxmys29wzfizjb9asn4crbn503x9 >> >> And I am not able to imagine a case. To me, it should be a fixed-po= int. >> That=E2=80=99s what the first patch correct. > > That=E2=80=99s expected: =E2=80=98--recursive=E2=80=99 uses a different c= omputation method, > including file metadata (technically, it serializes the file as a nar > and computes the hash of the nar). Yes, but that=E2=80=99s odd. It should be the same computation method for tarballs. Nothing is recursive for a tarball therefore, the option should be skipped. This proposal is perhaps not the best approach although I lacked of imagination about corner cases. >> Then, working on Disarchive which uses base16 as encoding, it is annoying >> twice, >> >> a) because it requires to download when all the sources >> b) because it sometimes requires to apply patches >> >> Compare, >> >> $ guix hash $(guix build ceph -S) >> 0ppd362s177cc47g75v0k27j7aaf27qc31cbbh0j2g30wmhl8gj7 >> >> with the checksum in the package definition: >> 0lmdri415hqczc9565s5m5568pnj97ipqxgnw6085kps0flwq5zh. >> >> With the second patch, it becomes easy to convert the checksum from upst= ream: >> >> $ ./pre-inst-env guix hash ceph -f base16 >> f017cca903face8280e1f6757ce349d25e644aa945175312fb0cc31248ccad52 >> >> and nothing is downloaded. Get the checksum of what Guix really builds = is >> done via the current way, for instance, >> >> $ guix hash $(guix build ceph -S) -f base16 >> 473e4461e5603c21015c8b85c1f0114ea9238f986097f30e61ec9ca08519ed5e >> >> and the second patch allows to convert the checksum from the package >> definition (without downloading). > > Ah yes, got it. (I should read messages in the right order, oops!) > > An obvious problem with the interface you propose is that it=E2=80=99s > ambiguous: are you printing the hash of the =E2=80=98ceph=E2=80=99 packag= e, or computing > that of the =E2=80=98ceph=E2=80=99 file? I=E2=80=99m sure the Zen of Pyt= hon has something on > ambiguity. ;-) The patch is printing the hash of upstream and it is the only hash which matters =E2=80=93 speaking both about packaging and about Disarchive. Therefore, there is no ambiguity here. Better said, the ambiguity is from =E2=80=9Cguix build --source=E2=80=9D where it is not predictable befo= rehand what it will return. For instance, can you guess what =E2=80=9Cguix build -S graphviz=E2=80=9D r= eturns? ;-) And can you guess the hash? > Do you think there=E2=80=99s another place where we could provide helpers= for > the die-hard Disarchive hackers among us? Maybe we could get =E2=80=98gu= ix lint > -c archival=E2=80=99 to print Disarchive URLs upon failure, and that=E2= =80=99d already > help? To me, =E2=80=9Cguix hash=E2=80=9D is about hashing therefore it appears to= me the right place for getting the hash of something. For instance, I do not find =E2=80=9Cguix lint -c archival=E2=80=9D the right place for sending a reque= st and saving to SWH; as olasd said at the time, IIRC. :-) However, the good is that =E2=80=9Cguix lint =E2=80=9D just works (for archiving). :-) Last, I do not want Diarchive URLs upon failure, I would like hashes and upstream URLs on request. :-) Well, I do not know. What could be better? Another subcommand =E2=80=9Cgu= ix archival=E2=80=9D doing all these plumbings: save, display hashes, upstream= URL, disarchive URL, etc. WDYT? Cheers, simon From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] [PATCH 0/2] guix hash: eases conversion Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 30 Oct 2021 15:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 51307@debbugs.gnu.org Received: via spool by 51307-submit@debbugs.gnu.org id=B51307.163560768219316 (code B ref 51307); Sat, 30 Oct 2021 15:29:02 +0000 Received: (at 51307) by debbugs.gnu.org; 30 Oct 2021 15:28:02 +0000 Received: from localhost ([127.0.0.1]:58170 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mgqH4-00051T-5t for submit@debbugs.gnu.org; Sat, 30 Oct 2021 11:28:02 -0400 Received: from mail-wr1-f53.google.com ([209.85.221.53]:38426) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mgqGw-00050M-Ku for 51307@debbugs.gnu.org; Sat, 30 Oct 2021 11:27:55 -0400 Received: by mail-wr1-f53.google.com with SMTP id u18so21398929wrg.5 for <51307@debbugs.gnu.org>; Sat, 30 Oct 2021 08:27:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-transfer-encoding; bh=V6vCoXb8RfNoHY5Rjuog64H7cMKEaBqQtnOc8Rilz2I=; b=ZvrsChQm/dZYBEvTteUjlKJWTZy3f1jBo7MnfMJVXJoAT6zZg/wolxbiU417GP54nk CFkDkVbDYtVwPM0IhtxsLxC7KtF56XOC4AAhxOsTLL+R62gvBCRWujD6VrDVhKZhb4iX QHj4sf2VHnIhMbHb36ncAcL783Zb0mRzP1bMznfEsr6PczjZijAeBm8H5zvK7QLW97/j 5EmUVyM6p1IFzIc7ERcJzbnyoub7sw3j73pufpYS51Dk78CVr+pW/hKBQ9wfQ2jehXI0 OdU8jgyRck0JVgzKGaqXRvb2wnBJ/Si5mNBrkhBYuvREkO7yh9R4SVH2Vg+OA8i8ha7N GDkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=V6vCoXb8RfNoHY5Rjuog64H7cMKEaBqQtnOc8Rilz2I=; b=kw4V82VkDs6lj6wLj7rEiLm/1/81zrUnDZQWRE/v+1LQ7eReZBxzsJjFS522ALy2On 3OqDplomYayzuu+MFQIH/cokc7DjLF8UzGD5Qk5X7/2ACwLG5XN/RFzX9qWlStj1ezxE rBJBJ/JrbPbnS16GoLyRr0oOjk2UrjSOk4CRamLEdSGaU6/Prx12vFHIVTySQBgcRczj rkTaQy+LpsBv/EjbufF8EYTNvDzkbYVhaZXQUS2W+sHL4qHm+jnPeP2wQqltBP7w8L9/ 4SVdLbXTkuwE1XvuxpJeQCcVHQbq/SE5h3PqbNk2ctpL5P7D47evHKb46TOKw7pNjvOe vtIw== X-Gm-Message-State: AOAM533o/m3AjO3kPDSHG3xK+PkSdGUH7jBwXOEaArINfDy7gmdksX0D DVtduzqvxgtg6UnGikiaBSMR8qFoS1w= X-Google-Smtp-Source: ABdhPJwk2S1+417nK548SKqoCM4QPhWgrPqHE57Iz7qw+bSpruiHS4HcjubgdtLwdoiuhZH8OX67iA== X-Received: by 2002:adf:d0cf:: with SMTP id z15mr23135819wrh.219.1635607668857; Sat, 30 Oct 2021 08:27:48 -0700 (PDT) Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id j17sm1517967wrw.63.2021.10.30.08.27.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Oct 2021 08:27:48 -0700 (PDT) From: zimoun In-Reply-To: <86tugyleub.fsf@gmail.com> References: <20211020165020.3358311-1-zimon.toutoune@gmail.com> <87wnlusgwy.fsf@gnu.org> <86tugyleub.fsf@gmail.com> Date: Sat, 30 Oct 2021 17:24:34 +0200 Message-ID: <86pmrmleml.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Re, On Sat, 30 Oct 2021 at 17:19, zimoun wrote: >> An obvious problem with the interface you propose is that it=E2=80=99s >> ambiguous: are you printing the hash of the =E2=80=98ceph=E2=80=99 packa= ge, or computing >> that of the =E2=80=98ceph=E2=80=99 file? I=E2=80=99m sure the Zen of Py= thon has something on >> ambiguity. ;-) [...] > Well, I do not know. What could be better? Another subcommand =E2=80=9C= guix > archival=E2=80=9D doing all these plumbings: save, display hashes, upstre= am URL, > disarchive URL, etc. Ah, I forgot. Zen of Python says, Now is better than never. and the proposed patch does =E2=80=9Cnow=E2=80=9D the things I need and thi= s hypothetical other subcommand falls into =E2=80=9Cnever=E2=80=9D. :-) Cheers, simon From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] [PATCH 0/2] guix hash: eases conversion Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 30 Oct 2021 15:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 51307@debbugs.gnu.org Received: via spool by 51307-submit@debbugs.gnu.org id=B51307.163560827420397 (code B ref 51307); Sat, 30 Oct 2021 15:38:02 +0000 Received: (at 51307) by debbugs.gnu.org; 30 Oct 2021 15:37:54 +0000 Received: from localhost ([127.0.0.1]:58179 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mgqQc-0005Iv-FU for submit@debbugs.gnu.org; Sat, 30 Oct 2021 11:37:54 -0400 Received: from mail-wr1-f47.google.com ([209.85.221.47]:40729) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mgqQb-0005Ij-G4 for 51307@debbugs.gnu.org; Sat, 30 Oct 2021 11:37:53 -0400 Received: by mail-wr1-f47.google.com with SMTP id r8so8592028wra.7 for <51307@debbugs.gnu.org>; Sat, 30 Oct 2021 08:37:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-transfer-encoding; bh=RE6aTBKB+2nvnVDyUkiurUGvR+9PpCZRQ1Prmaz5wsQ=; b=DQDKTNeBc+rGru29wTkOyT8kbThtd3660ZdTGYGdDNcIKEhFInsYOWma08CH4v53DQ RLK0uQP6214ieJTShRViUwhlhZLci0pRgOI9MAeCaKeIn6h+vWV8f1TWq2rdMqATt8bt O8ljIvmgKzxsOTIAUTVy59kZuRciNU88N/R7HTN+BfEiRXIS603mFS7stPHZvpgbB8yl hQAePLBjhRKcKWYG3c/ziWQbr9+isiCB+i6cxc5scb+jVxesAPrb+/YajtUzS13WXQvV JeY0x5Jj5NaqUjj7T6Z8mmxbMbBFsO3Ys8VYc5ebzlWuTN5SXdM4emf0tU7k50EEh6A/ 5LTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=RE6aTBKB+2nvnVDyUkiurUGvR+9PpCZRQ1Prmaz5wsQ=; b=BDsxczh99NUgRAM8VNbrt4AVTdtGK/kBBRqgpknS/c590w1IdeJVXWlsXvLyMCeiu/ w7O1RBqTC+ODyTqhgSx4WbyidHnVoc8ey+gbwTo/KJeP69BBOH6ajMNGzpZv3ZtVPV2C 4h1PKqo5bxxU/hQXYmiM5oScar0aCvrPtoc4ZVwSDFYKbQrf2oSB5AR0xE/I/xgt232h fGP9DISdwM7dGyuyWQf0xUoYDrK8GMRlgxK0Iwh4RnSy/ynfqr7p3Dql2J/Q5iPKp1ao DaNypyut1GZLxnBLjoJRc1oVYixE4kuFrD14xEXbEutU69j+Zt0/ymkS04svXqJgr9B6 x/QA== X-Gm-Message-State: AOAM533rk58llJidB7jz8WYR0Bjk0ONseofdoVsHLdZl2lLz9DepzyDH Ud1DNiC/G+tC8X3rHVoSNT+xPIUUu58= X-Google-Smtp-Source: ABdhPJzv8THvNJoCTYIpOEzaWt1n4GO7VSRrvrSvs+j/ZJNAz4oGdRfDo+8o+wdXWpMZnB0/BSaILQ== X-Received: by 2002:adf:ec45:: with SMTP id w5mr8732272wrn.183.1635608267592; Sat, 30 Oct 2021 08:37:47 -0700 (PDT) Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id 13sm11646601wrz.38.2021.10.30.08.37.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Oct 2021 08:37:47 -0700 (PDT) From: zimoun In-Reply-To: <871r42tvoy.fsf_-_@gnu.org> References: <20211020165435.3358398-1-zimon.toutoune@gmail.com> <20211020165435.3358398-2-zimon.toutoune@gmail.com> <871r42tvoy.fsf_-_@gnu.org> Date: Sat, 30 Oct 2021 17:34:55 +0200 Message-ID: <86h7cyle5c.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Sat, 30 Oct 2021 at 16:48, Ludovic Court=C3=A8s wrote: > zimoun skribis: > >> * guix/scripts/hash.scm (guix-hash)[package?]: New procedure. >> [hash-to-display]: Use it. >> * tests/guix-hash.scm: New test. >> --- >> guix/scripts/hash.scm | 19 +++++++++++++++++-- >> tests/guix-hash.sh | 10 ++++++++++ >> 2 files changed, 27 insertions(+), 2 deletions(-) >> >> diff --git a/guix/scripts/hash.scm b/guix/scripts/hash.scm >> index f3363549d3..4f0d41629f 100644 >> --- a/guix/scripts/hash.scm >> +++ b/guix/scripts/hash.scm >> @@ -22,6 +22,9 @@ >>=20=20 >> (define-module (guix scripts hash) >> #:use-module (gcrypt hash) >> + #:use-module ((gnu packages) #:select (find-best-packages-by-name)) >> + #:use-module (guix packages) >> + #:use-module ((guix utils) #:select (package-name->name+version)) > > I think I would prefer to keep (guix scripts hash) bare-bones, not > depending on the package machinery. I understand but I do not have better to propose. :-) > Most of the time one can run: > > guix hash $(guix build -S PACKAGE) First, it is not true. For instance, $ guix hash $(guix build -S graphviz) 00skvq94xanwmprz5073mhmssz953dwf7h23p5czrpgd5s7hy444 and this hash does not correspond to the hash used by Disarchive. Because =E2=80=9Cguix build -S=E2=80=9D does not return what Gu= ix downloads but what Guix builds. The cover letter provides another example for the package =E2=80=99ceph=E2=80=99. Each time a patch or a snippet is added to origin, then it is not true. Second, it requires to download for hashing. When the hash is already in the source. I would like to avoid unnecessary downloads. I mean, it is ok to download for a couple of packages. But it becomes impractical for batch of 1200 (or more). > It=E2=80=99s not quite what you want if the package has patches or a snip= pet, > but that=E2=80=99s okay IMO. No, that=E2=80=99s not OK. :-) Because, it becomes really annoying. I hav= e to open gnu/packages, then recompose URL, then download and hash with the right format. Too many manual and boring steps when all is there. Just require CLI to be displayed. Cheers, simon PS: That=E2=80=99s what the cover letter was explaining. Sorry if it was badly worded or unclear. From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] [PATCH 0/2] guix hash: eases conversion Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 30 Oct 2021 15:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 51307@debbugs.gnu.org Received: via spool by 51307-submit@debbugs.gnu.org id=B51307.163560893530202 (code B ref 51307); Sat, 30 Oct 2021 15:49:02 +0000 Received: (at 51307) by debbugs.gnu.org; 30 Oct 2021 15:48:55 +0000 Received: from localhost ([127.0.0.1]:58206 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mgqbH-0007r4-1i for submit@debbugs.gnu.org; Sat, 30 Oct 2021 11:48:55 -0400 Received: from mail-wr1-f48.google.com ([209.85.221.48]:36413) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mgqbF-0007qp-Hm for 51307@debbugs.gnu.org; Sat, 30 Oct 2021 11:48:53 -0400 Received: by mail-wr1-f48.google.com with SMTP id s13so14266471wrb.3 for <51307@debbugs.gnu.org>; Sat, 30 Oct 2021 08:48:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-transfer-encoding; bh=wg8lcnmThwI4lkWMat/GkomoUBjNHgc7NwKoOrjIrVY=; b=pn5CJprzeT7KYxHc9jWwauqgxHZ7bWZb5cflsPEDjn0H7sryMwEgXOp4Wiy1J3JW1T 5vlu5+rbOYlTYiZwFLps+cgtzJsNHQsDpTMe7R8VOJuwrk4AHb2Nooy/aRjLYJFY/zdE +93VhUGp+g+jjGbdluyeLfYpywqc0fOf151A8dkE23HkI+MZ/P7vXiExdq19/TqjJAVD Kz8iIt3AmL3EbpTspOrZYunXadgQOC7WDfOVnX3UJd5EM95zBCoxlOB2383kLhGcxIxq 6UmtfH6RdaOVovgbfNaYbevgv0VbkR1F9XHgpO8nHDJl+Tq1tVDS3PIqRunJDS0Vp52U cKfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=wg8lcnmThwI4lkWMat/GkomoUBjNHgc7NwKoOrjIrVY=; b=012U+3jp8+zUxMdS5TmqtmM3PflZ9yphe9JajzEgs/mYvpVv4a//QtaKMXih7DMH0m q6yr+O/LuZwyjPzRw+f6njuqp3q5QMdMTcNUKHpOAxtMb5NOKwTr5zMMWEWxbPjRniqu EnUbiZDNxuzXwOI5/zjTJrtjByc7UQGwlvGgpDfPb94Cr2OvxwML625zYf0aGzQFr98A jdJOeAbujxvpC6vIMmPesRI3/ms4KNTe/4doRqAJfksBBz4huzpdyM7xr2u28HTOvimA vgiq85rO8NruVQ0Iwe2xwbop1dH0rKYwzBJdN5CGbQ6iJy4BTuWwawddTxluieAq1Mqn NDjQ== X-Gm-Message-State: AOAM531lQw7xijqLgLAueGkuEilH0NTiebA1SMLXYTBIKciBxdzXjqzp YygbZQGiTAGW+LsSv2y0h7YnRjNGeZ0= X-Google-Smtp-Source: ABdhPJya8Wq+tPpdkal4oZ3VXPrDkO19KYxJ9kY0O4oVGiJXV6JHxHOzi4o02NGjF2DZ+dtAcwosNA== X-Received: by 2002:a5d:468f:: with SMTP id u15mr9132360wrq.171.1635608927551; Sat, 30 Oct 2021 08:48:47 -0700 (PDT) Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id y5sm11007251wrd.75.2021.10.30.08.48.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Oct 2021 08:48:47 -0700 (PDT) From: zimoun In-Reply-To: <875ytetvt1.fsf_-_@gnu.org> References: <20211020165020.3358311-1-zimon.toutoune@gmail.com> <20211020165435.3358398-1-zimon.toutoune@gmail.com> <875ytetvt1.fsf_-_@gnu.org> Date: Sat, 30 Oct 2021 17:40:59 +0200 Message-ID: <86cznmldv8.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Ludo, On Sat, 30 Oct 2021 at 16:46, Ludovic Court=C3=A8s wrote: > zimoun skribis: > >> * guix/scripts/hash.scm (guix-hash): Allow several files. >> [directory?]: New procedure. >> [file-hash]: Catch system-error. >> [hash-to-display]: New procedure. > > Nice! Could you update guix.texi and tests/guix-hash.texi? I will once we agree and reach consensus. ;-) >> - (with-error-handling >> - (if (assoc-ref opts 'recursive?) >> + (if (and (assoc-ref opts 'recursive?) >> + (directory? file)) > > This change is not related to the main purpose of the patch. > > More importantly, note that =E2=80=98--recursive=E2=80=99 is not limited = to directories: > it preserves file properties (directory, executable, or regular), so > it=E2=80=99s also useful for executable files for instance. It can also = be used > for regular files, even if it=E2=80=99s less useful. I understand. Could you provide concrete examples when it is not directory? In order to see if there is a pattern. >> + (define (hash-to-display thing) >> + (match thing >> + ((? file-exists? file) >> + (fmt (file-hash file))) >> + ("-" (with-error-handling >> + (fmt (port-hash (assoc-ref opts 'hash-algorithm) >> + (current-input-port))))) > > I=E2=80=99d swap the order of the two clauses and remove the call to > =E2=80=98file-exists?=E2=80=99: if the file doesn=E2=80=99t exist, =E2=80= =98file-hash=E2=80=99 will raise an > error. I can swap order but not remove file-exists? Otherwise, the next clause=E2= =80=A6 >> + (x >> + (leave (G_ "wrong argument~%"))))) will never happen. And some tests are failing. >> + (for-each >> + (lambda (arg) >> + (format #t "~a~%" (hash-to-display arg))) > > Or just (compose display hash-to-display) ? > > Maybe s/hash-to-display/formatted-hash/. Thanks. Indeed both are better. :-) > Could you send an updated patch? Yes, but before, from my understanding, we should agree on the goal of such patch. :-) See the two other replies. Cheers, simon From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] [PATCH 0/2] guix hash: eases conversion Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 31 Oct 2021 13:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: zimoun Cc: 51307@debbugs.gnu.org Received: via spool by 51307-submit@debbugs.gnu.org id=B51307.16356878322118 (code B ref 51307); Sun, 31 Oct 2021 13:44:02 +0000 Received: (at 51307) by debbugs.gnu.org; 31 Oct 2021 13:43:52 +0000 Received: from localhost ([127.0.0.1]:59271 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mhB7o-0000Y6-Au for submit@debbugs.gnu.org; Sun, 31 Oct 2021 09:43:52 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59088) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mhB7m-0000Xt-Ls for 51307@debbugs.gnu.org; Sun, 31 Oct 2021 09:43:51 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:53942) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhB7h-00006Q-6h; Sun, 31 Oct 2021 09:43:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=lTep9BqyU2R/t502HFAh3Uu/B0z15E3T99VGInnn/kY=; b=P5og/NiFYPpuwgXQdMen ldMFkvjXVoUe+KRjfZfreHMJYQari3IZlFffLXlL7D1G0/OltZ7UzQXyQ/ul65OJWmk9M3BBj7qYy wNTtH05ZD9aweNhz267355AucKk/fySUOwppAnWl/RvcbwMvr9G/81t9Ix5p+Y5bVctrs8oOX/n57 GrlP65cnuK0+UEX0FwIqthEF+ffRTyPV+4sdnf5Sp6dKhS69d1AqKneGZPvv+qGOVj4J0L1YjY2sw XmmVU1zm6uFLX1b2611h9//FwsWAAKh4m0oLD5ZK2N81JVaumEijz//wKNlXqjiB/FiWzRtOOW879 HbcUn9Nd5HcUMw==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:55504 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhB7g-0007Y3-QG; Sun, 31 Oct 2021 09:43:45 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20211020165020.3358311-1-zimon.toutoune@gmail.com> <20211020165435.3358398-1-zimon.toutoune@gmail.com> <875ytetvt1.fsf_-_@gnu.org> <86cznmldv8.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 10 Brumaire an 230 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: Sun, 31 Oct 2021 14:43:41 +0100 In-Reply-To: <86cznmldv8.fsf@gmail.com> (zimoun's message of "Sat, 30 Oct 2021 17:40:59 +0200") Message-ID: <87tugxqpgy.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, zimoun skribis: > On Sat, 30 Oct 2021 at 16:46, Ludovic Court=C3=A8s wrote: >> zimoun skribis: >> >>> * guix/scripts/hash.scm (guix-hash): Allow several files. >>> [directory?]: New procedure. >>> [file-hash]: Catch system-error. >>> [hash-to-display]: New procedure. >> >> Nice! Could you update guix.texi and tests/guix-hash.texi? > > I will once we agree and reach consensus. ;-) Apparently there=E2=80=99s consensus on this specific patch. >> This change is not related to the main purpose of the patch. >> >> More importantly, note that =E2=80=98--recursive=E2=80=99 is not limited= to directories: >> it preserves file properties (directory, executable, or regular), so >> it=E2=80=99s also useful for executable files for instance. It can also= be used >> for regular files, even if it=E2=80=99s less useful. > > I understand. Could you provide concrete examples when it is not > directory? In order to see if there is a pattern. See the executables used in (gnu packages bootstrap): to preserve their executable bit, you need =E2=80=98--recursive=E2=80=99. Same for symlinks. Anyway, this patch is about allowing for multiple arguments (which we agree on), so I think we should discuss the =E2=80=98--recursive=E2=80=99 i= ssue separately. Thanks! Ludo=E2=80=99. From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] [PATCH 0/2] guix hash: eases conversion Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 31 Oct 2021 14:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: zimoun Cc: 51307@debbugs.gnu.org Received: via spool by 51307-submit@debbugs.gnu.org id=B51307.16356889915781 (code B ref 51307); Sun, 31 Oct 2021 14:04:02 +0000 Received: (at 51307) by debbugs.gnu.org; 31 Oct 2021 14:03:11 +0000 Received: from localhost ([127.0.0.1]:60954 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mhBQV-0001VB-3o for submit@debbugs.gnu.org; Sun, 31 Oct 2021 10:03:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33604) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mhBQT-0001Uz-SQ for 51307@debbugs.gnu.org; Sun, 31 Oct 2021 10:03:10 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:54372) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhBQO-0003Ym-ME; Sun, 31 Oct 2021 10:03:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=7dEW5Ustj2akb5TApah1PlVOPFtyPu+oRCVzbgjkoa4=; b=n9OoVMxyyeQ+WWPvOIE3 fCVcInt/I13qtjJEQZ3k5dtvHPW+iv8oidQiX4trn/Q1Vf1M9y7LvIdB7UhOlqj/TQB8A9xaZ8Mra nmh+GxXGLtfPyks0gVcA9RUT0uypDNTUbfDEf4g/lYBrLY5Ho+ogUelzaGTyzUUvCdza2PBdKbgAq U0R014vSpDyz1J82JCTT3+KBdWjXAnSKR1hulaiELlTpQ2YzqdHkJpOSq+U2Vvnb42XdKWjpelbr+ z5Re7G2NL7mYWwD1JOlwDlRlTYAXp8MEUZgu79MUdC+YnPQGjMEboM8a6Oc6O/+tIEhl7RHnxxSLX 2+xafQo40J/JFA==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:55506 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhBQO-0002JZ-9z; Sun, 31 Oct 2021 10:03:04 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20211020165020.3358311-1-zimon.toutoune@gmail.com> <87wnlusgwy.fsf@gnu.org> <86tugyleub.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 10 Brumaire an 230 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: Sun, 31 Oct 2021 15:03:01 +0100 In-Reply-To: <86tugyleub.fsf@gmail.com> (zimoun's message of "Sat, 30 Oct 2021 17:19:56 +0200") Message-ID: <87mtmppa0a.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi! zimoun skribis: > On Sat, 30 Oct 2021 at 16:53, Ludovic Court=C3=A8s wrote: >> zimoun skribis: >> >>> 2. Using the option recursive changes the result for tarball, as with: >>> >>> $ guix hash $(guix build hello -S) >>> 0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i >>> >>> $ guix hash $(guix build hello -S) --recursive >>> 1qx3qqk86vgdvpqkhpgzq3gfcxmys29wzfizjb9asn4crbn503x9 >>> >>> And I am not able to imagine a case. To me, it should be a fixed-p= oint. >>> That=E2=80=99s what the first patch correct. >> >> That=E2=80=99s expected: =E2=80=98--recursive=E2=80=99 uses a different = computation method, >> including file metadata (technically, it serializes the file as a nar >> and computes the hash of the nar). > > Yes, but that=E2=80=99s odd. It should be the same computation method for > tarballs. Nothing is recursive for a tarball therefore, the option > should be skipped. This proposal is perhaps not the best approach > although I lacked of imagination about corner cases. The way I see it, =E2=80=98guix hash=E2=80=99 is a low-level tool and it sh= ould do what I ask for and not try to second-guess. >>> Then, working on Disarchive which uses base16 as encoding, it is annoyi= ng >>> twice, >>> >>> a) because it requires to download when all the sources >>> b) because it sometimes requires to apply patches >>> >>> Compare, >>> >>> $ guix hash $(guix build ceph -S) >>> 0ppd362s177cc47g75v0k27j7aaf27qc31cbbh0j2g30wmhl8gj7 >>> >>> with the checksum in the package definition: >>> 0lmdri415hqczc9565s5m5568pnj97ipqxgnw6085kps0flwq5zh. >>> >>> With the second patch, it becomes easy to convert the checksum from ups= tream: >>> >>> $ ./pre-inst-env guix hash ceph -f base16 >>> f017cca903face8280e1f6757ce349d25e644aa945175312fb0cc31248ccad52 >>> >>> and nothing is downloaded. Get the checksum of what Guix really builds= is >>> done via the current way, for instance, >>> >>> $ guix hash $(guix build ceph -S) -f base16 >>> 473e4461e5603c21015c8b85c1f0114ea9238f986097f30e61ec9ca08519ed5e >>> >>> and the second patch allows to convert the checksum from the package >>> definition (without downloading). >> >> Ah yes, got it. (I should read messages in the right order, oops!) >> >> An obvious problem with the interface you propose is that it=E2=80=99s >> ambiguous: are you printing the hash of the =E2=80=98ceph=E2=80=99 packa= ge, or computing >> that of the =E2=80=98ceph=E2=80=99 file? I=E2=80=99m sure the Zen of Py= thon has something on >> ambiguity. ;-) > > The patch is printing the hash of upstream and it is the only hash which > matters =E2=80=93 speaking both about packaging and about Disarchive. > Therefore, there is no ambiguity here. Sorry, I think I wasn=E2=80=99t clear. Consider this: touch ceph guix hash ceph What does it print? If the result depends on external context (the presence or not of a =E2=80=98ceph=E2=80=99 file in $PWD), that=E2=80=99s a brittle interface IM= O. This could be addressed by requiring users to be explicit, along these lines: guix hash ceph # compute the hash of the file called =E2=80=98ceph=E2= =80=99 guix hash -P ceph # print the hash of the =E2=80=98ceph=E2=80=99 package But there=E2=80=99s another issue with the interface: =E2=80=98guix hash -P= ceph=E2=80=99 would merely print the hash as it appears in the package definition. Thus =E2=80=98-H=E2=80=99 and =E2=80=98-r=E2=80=99 would have no effect, which c= an be confusing. > For instance, can you guess what =E2=80=9Cguix build -S graphviz=E2=80=9D= returns? ;-) I=E2=80=99m aware it returns the source after applying patches and snippets= ; I understand the shortcomings you mention quite well and I don=E2=80=99t deny there=E2=80=99s a need. :-) My comment is on the interface. >> Do you think there=E2=80=99s another place where we could provide helper= s for >> the die-hard Disarchive hackers among us? Maybe we could get =E2=80=98g= uix lint >> -c archival=E2=80=99 to print Disarchive URLs upon failure, and that=E2= =80=99d already >> help? > > To me, =E2=80=9Cguix hash=E2=80=9D is about hashing therefore it appears = to me the right > place for getting the hash of something. For instance, I do not find > =E2=80=9Cguix lint -c archival=E2=80=9D the right place for sending a req= uest and saving > to SWH; as olasd said at the time, IIRC. :-) However, the good is that > =E2=80=9Cguix lint =E2=80=9D just works (for archiving). :-) > > Last, I do not want Diarchive URLs upon failure, I would like hashes and > upstream URLs on request. :-) > > Well, I do not know. What could be better? Another subcommand =E2=80=9C= guix > archival=E2=80=9D doing all these plumbings: save, display hashes, upstre= am URL, > disarchive URL, etc. Yes, maybe? I don=E2=80=99t know. I think it=E2=80=99s important to take = a step back: perhaps we=E2=80=99re in need of a better tool around SWH and Disarchive, r= ather than just a tool that displays a hash. We already have all the APIs to do these things anyway, so if we clarify the use case, we can surely glue things together to build a tool that will be more convenient. (Maybe you=E2=80=99ve already written scripts to help you?) For example, if the use case is =E2=80=9Cis this tarball in Disarchive=E2= =80=9D, this is answered by =E2=80=98guix lint -c archival=E2=80=99, but perhaps we need a = more low-level or more focused tool in that area? Regarding base16: that too isn=E2=80=99t set in stone. Commit 3cb5ae8577db28b2c6013b9d9ecf99cb696e3432 provides more flexibility, so we don=E2=80=99t have to stick to base16. I hope this perspective is useful! Ludo=E2=80=99. From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] Content hashes and file tree serialization methods Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 31 Oct 2021 14:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: zimoun Cc: 51307@debbugs.gnu.org Received: via spool by 51307-submit@debbugs.gnu.org id=B51307.163569170826797 (code B ref 51307); Sun, 31 Oct 2021 14:49:02 +0000 Received: (at 51307) by debbugs.gnu.org; 31 Oct 2021 14:48:28 +0000 Received: from localhost ([127.0.0.1]:32790 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mhC8J-0006y9-Nx for submit@debbugs.gnu.org; Sun, 31 Oct 2021 10:48:27 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40086) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mhC8I-0006xx-Fi for 51307@debbugs.gnu.org; Sun, 31 Oct 2021 10:48:26 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:55480) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhC8B-0007PE-Tr; Sun, 31 Oct 2021 10:48:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=4IZKmrg09zASWnpd7e1QkH5WR6+7JWL6lHQB2cgl9cU=; b=nTiuMtkWlvp79F99jNXk hpM+vjov0OTJ6QYi4aaapGM8/AUUgcnlIci7O6GMrhsRLbJeTt0nDpTIWjF8E4DkM3AkkX2w3GiBZ IDJAx+NZdInd0q5zbmk9RBX3sknVXXPsiA21vSbqqFpPuM0sB8c9DIMtm8u2isUvMcZ03zXjwJkry EwpfoxD3mEz7QSmJ8AS8ZakM6jVBOyT98fVMk2URxbAJRjICrduMQG1PMNDVxMC7EJEtHyMBjAPCT 2ynTFAqpeP+gxcI42r6fbUDwSbBeG5oRVnRuf+HtYh4b9hCVwoBkwgSpJNBcXvLMB/v41hrqlTyTk dLdr3tYGcdJP9w==; Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=55430 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhC8B-0008RS-I7; Sun, 31 Oct 2021 10:48:19 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20211020165020.3358311-1-zimon.toutoune@gmail.com> <87wnlusgwy.fsf@gnu.org> <86tugyleub.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 10 Brumaire an 230 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: Sun, 31 Oct 2021 15:48:16 +0100 In-Reply-To: <86tugyleub.fsf@gmail.com> (zimoun's message of "Sat, 30 Oct 2021 17:19:56 +0200") Message-ID: <87mtmpntcf.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) zimoun skribis: >> That=E2=80=99s expected: =E2=80=98--recursive=E2=80=99 uses a different = computation method, >> including file metadata (technically, it serializes the file as a nar >> and computes the hash of the nar). > > Yes, but that=E2=80=99s odd. It should be the same computation method for > tarballs. Nothing is recursive for a tarball Thinking more about it, I think confusion stems from the term =E2=80=9Crecursive=E2=80=9D (inherited from Nix) because, as you write, it = doesn=E2=80=99t necessarily have to do with recursion and directory traversal. Instead, it has to do with the serialization method. Thus, probably, =E2=80=98--recursive=E2=80=99 could be replaced by a =E2=80= =98-S=E2=80=99 flag: guix hash -S nar something or: guix hash -S none something guix hash -S git something guix hash -S swh something =E2=80=98-S none=E2=80=99 would be like not passing =E2=80=98-r=E2=80=99; = =E2=80=98-S git=E2=80=99 would serialize the file/directory as a Git tree; =E2=80=98-S swh=E2=80=99 would serialize it t= he SWH way, which is like Git except it preserves empty directories (Disarchive implements the Git/SWH methods already.) Thoughts? As mentioned towards the end of , being able to deal with different tree serialization methods would be useful going forward; for instance, if we had the option to store SWH-style content hashes for origins, that=E2=80=99d help a lot. Allowing = =E2=80=98guix hash=E2=80=99 to deal with that is a first step in that direction. (Apologies for slipping a bit off-topic=E2=80=A6) Ludo=E2=80=99. From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] [PATCH 0/2] guix hash: eases conversion Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 09 Nov 2021 09:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 51307@debbugs.gnu.org Received: via spool by 51307-submit@debbugs.gnu.org id=B51307.163644950028723 (code B ref 51307); Tue, 09 Nov 2021 09:19:02 +0000 Received: (at 51307) by debbugs.gnu.org; 9 Nov 2021 09:18:20 +0000 Received: from localhost ([127.0.0.1]:60833 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mkNGm-0007TD-7N for submit@debbugs.gnu.org; Tue, 09 Nov 2021 04:18:20 -0500 Received: from mail-wm1-f52.google.com ([209.85.128.52]:38814) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mkNGi-0007Sw-P6 for 51307@debbugs.gnu.org; Tue, 09 Nov 2021 04:18:18 -0500 Received: by mail-wm1-f52.google.com with SMTP id a20-20020a1c7f14000000b003231d13ee3cso1323401wmd.3 for <51307@debbugs.gnu.org>; Tue, 09 Nov 2021 01:18:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-transfer-encoding; bh=ShxtBv0JImSrVdr2rWQwCW/nvjXlY9/Brb9828RxXAM=; b=Ha6MUJsMRsdwRuN4DDmmCGenQzcrWtC4WKc7MHvcFLeEc1ZalPju39GkWbeZS3EErQ 1GaqJ2MpwRHM1/kynVVxZgOesjAljbrXLEzrey1I0FvcEvPMeql0v1aVT+RGjR2dAOtF QKSjxuEaROlFgnkg3oUr7mGv9lWYDXoG4QasEnHNq9JluomhnPjPFJYkhB5Q3gGaShuJ 6NpbEQMgI6MQ08DZfxkOo2jjSLds4+vB5w910lW6aTcBkHYBCXWYk9cNaHtqRyw/XYhr AP4T3MbOqFMloQPG/g+mSZcM7zTs9jOv1Glwoo0rJ0eobXtvH/evBJGMAhWAaEBzWKW8 8Okw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=ShxtBv0JImSrVdr2rWQwCW/nvjXlY9/Brb9828RxXAM=; b=eGW3+4UJe7CkHGWoInGF64bO4xtt0vBeIOaKfGYhw6ci+k9mtBTOHSLFuSxjieYBfF LB/by0JH5z8iQqrrvctvQlC7KjR7JYh83dzd06IWLP/bUoUw0A+M48vFwK5/E5QPlhPf 60bWutgppnlBke0Tc3iRolg63iJCVpBi3Utm1DC2E1a85X0tJP4eFowJ3P1PdWTfaIgD vTVgwckis1n/+dmXPuTdQmMTe03WWA11oSfuAtiKg6SPnV4ngv//H8SSFpRW1auOQrVL 0y9QfxfDM6fd0GClwvYgwlCes9Hw9t5URk7XuMqk6YAeWOAB8Xp+syTwBfG7L7McoZed ffhw== X-Gm-Message-State: AOAM530d2brYyjphqIhdC0KUUFbhjinP+WzVL+9ghR38WPy/9c9u79X9 bvBkBOXmltc/o1i61QWnGhJNFVSnQEI= X-Google-Smtp-Source: ABdhPJwmvzffBrhyLoUFlOJNNh1W0Et4uTRRlsWh8GrHeeWvRxvk/dDFPpNoF6pPrDAJDj91aDXjiw== X-Received: by 2002:a05:600c:198f:: with SMTP id t15mr5574804wmq.94.1636449490780; Tue, 09 Nov 2021 01:18:10 -0800 (PST) Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id m14sm13705078wrp.28.2021.11.09.01.18.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Nov 2021 01:18:10 -0800 (PST) From: zimoun In-Reply-To: <87mtmppa0a.fsf@gnu.org> References: <20211020165020.3358311-1-zimon.toutoune@gmail.com> <87wnlusgwy.fsf@gnu.org> <86tugyleub.fsf@gmail.com> <87mtmppa0a.fsf@gnu.org> Date: Tue, 09 Nov 2021 10:18:01 +0100 Message-ID: <86zgqdbsc6.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Ludo, On Sun, 31 Oct 2021 at 15:03, Ludovic Court=C3=A8s wrote: [...] >> The patch is printing the hash of upstream and it is the only hash which >> matters =E2=80=93 speaking both about packaging and about Disarchive. >> Therefore, there is no ambiguity here. > > Sorry, I think I wasn=E2=80=99t clear. Consider this: > > touch ceph > guix hash ceph > > What does it print? It would print the first clause. Two things: 1. How many times do you run =E2=80=9Cguix hash foo=E2=80=9D inside a folder where there is a folder= or file =E2=80=99foo=E2=80=99? and 2. It is easy to document this corner case and = =E2=80=9Cguix hash ./ceph=E2=80=9D fixes the issue. Well, the root is that I disagree with your comment, I guess. :-) The way I see it, =E2=80=98guix hash=E2=80=99 is a low-level tool a= nd it should do what I ask for and not try to second-guess. Bah it is similar as Garbage Collector debate; Pythonista says: devs are too dumb for managing memory by themselves, it has to be done automatically; C devs says: managing memory is too important for second-guessing dev intent. ;-) Note that from my understanding, =E2=80=9Cguix hash=E2=80=9D and =E2=80=9Cg= uix download=E2=80=9D are somehow redundant, i.e., =E2=80=9Cguix download=E2=80=9D should be included= to =E2=80=9Cguix hash=E2=80=9D. Another story=E2=80=A6 but I was not drifting yet. ;-) > If the result depends on external context (the presence or not of a > =E2=80=98ceph=E2=80=99 file in $PWD), that=E2=80=99s a brittle interface = IMO. I trust your experience on designing interfaces. :-) > This could be addressed by requiring users to be explicit, along these > lines: > > guix hash ceph # compute the hash of the file called =E2=80=98ceph= =E2=80=99 > guix hash -P ceph # print the hash of the =E2=80=98ceph=E2=80=99 package Well, let=E2=80=99s go for that. One last question about bikeshedding, what should do guix hash -P ceph ceph =20=20=20 ? Print twice hash of ceph package? Or print hash of ceph package and hash of ceph file? > But there=E2=80=99s another issue with the interface: =E2=80=98guix hash = -P ceph=E2=80=99 would > merely print the hash as it appears in the package definition. Thus > =E2=80=98-H=E2=80=99 and =E2=80=98-r=E2=80=99 would have no effect, which= can be confusing. Wow, many many options of many many Guix commands cannot be composed. Aside, these two still open bugs, for instance, guix package --list-installed --show=3Dhello guix package --show=3Dhello --list-installed guix package --list-available --list-installed guix package --list-installed --list-available And many more, guix pull --commit=3D1234 --branch=3Dcore-updates and so =E2=80=9Cguix time-machine=E2=80=9D too. And I am not speaking abou= t build transformations. Bah, ok let=E2=80=99s avoid to add another one. :-) It seems possible to d= etect and display a warning that -H or -r does not take effect because -P. > Yes, maybe? I don=E2=80=99t know. I think it=E2=80=99s important to tak= e a step back: > perhaps we=E2=80=99re in need of a better tool around SWH and Disarchive,= rather > than just a tool that displays a hash. We already have all the APIs to > do these things anyway, so if we clarify the use case, we can surely > glue things together to build a tool that will be more convenient. > (Maybe you=E2=80=99ve already written scripts to help you?) I will start to collect my needs and what I am doing when playing with that. And I will try to put that inside an extension, such as =E2=80=9Cguix archival=E2=80=9D. It will be a basis for judging if it is worth or not. No, I do not have scripts. I mean, each time I work on that topic, I write again and again some quick and dirty stuff coupled to ugly Bash glue code. This patch is because I have been annoyed to repeat again and again. :-) Well, I am going to send another version adding multi FILE, first patch which is making consensus, and second patch the option --package/-P. Cheers, simon From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] [PATCH v2 1/3] scripts: hash: Support several files. Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 18 Nov 2021 00:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51307@debbugs.gnu.org Cc: ludo@gnu.org, zimoun Received: via spool by 51307-submit@debbugs.gnu.org id=B51307.163719484726865 (code B ref 51307); Thu, 18 Nov 2021 00:21:01 +0000 Received: (at 51307) by debbugs.gnu.org; 18 Nov 2021 00:20:47 +0000 Received: from localhost ([127.0.0.1]:34137 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mnVAU-0006zA-Rs for submit@debbugs.gnu.org; Wed, 17 Nov 2021 19:20:47 -0500 Received: from mail-wm1-f44.google.com ([209.85.128.44]:43932) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mnVAS-0006yf-1q for 51307@debbugs.gnu.org; Wed, 17 Nov 2021 19:20:45 -0500 Received: by mail-wm1-f44.google.com with SMTP id 67-20020a1c1946000000b0030d4c90fa87so3433710wmz.2 for <51307@debbugs.gnu.org>; Wed, 17 Nov 2021 16:20:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AsdNvgj5R7rdm45aQhwuhx082GGMq4PMmw6rHAjB99k=; b=YDc5ZNT6ah/qU09SQKpRm/41HdBk7yUxQjgy/CKze0ZJWpYY7SCeYdh30SpkSHbm+2 zRIJWucwgC/cIuUN2Py+fBBxk/enPhJ3uvWKBs1UpTPpSU2wr2wNrk7tGd/wPF/WRBOJ mhX+jfDVdSEe0dSl6jYJCNoOr4WVKkrNjC6alVVMbv6IAobx2UbdsRBdZoceGBy3FbsW ScdypyJU5kbsvK7FN8oAkCNZSBAMCjlOmHuaTw7TwWY+XLIM0iRf40+wldFNXg6HXoEs RZH1W26Pf3hhQssH3rzpH9LK6JGt+9CwLktaCCK67OYedzfI7x4YuJaCjFG800xU+J92 rPjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AsdNvgj5R7rdm45aQhwuhx082GGMq4PMmw6rHAjB99k=; b=1ZejHykEV5Q4fRK3gZgupyMszC8q6nFNHGzsIj8JSLewDb4Ydb8AAm512+XfUO4UXH ddzBVttRZTJs+ZT1BsVQEcfOIS5tWbxcialpVCMZoh4unFHSJaIbZ8Z8inKHwteAVvz5 y1EfPmhOB1RiqixLVPxYtlXyCpllH5Hb/3xLWXFGae5WkDSDyDbwqk463l5nhVRX36Au dXTgAZq4MrFgUEuKNfTyTqcDr45rGTewTlk8Y2GjCPg1QmoVN+Wi9AcLK0LgVdoHzx3d U+iAptfWCft3WQ83piivR+uRUHONNsJk0fXoxc05B0pgmw92rbLh3m1GwDO4LNhLLkPp IgLA== X-Gm-Message-State: AOAM530dEdGPwhK2jmCYixEw/hGHoCHrfnpT2/wcsALydOq+RnYgSgCA m8cSBDJq5/uUtrhH3WsN4xlXA6I4ap0= X-Google-Smtp-Source: ABdhPJxyVzW/cGvqNK9Fs9CSmhEzi8p2kXCAH9j+4FKwbTn3qWUm5w22eOUkPhkqbxUizvL6Te4gOQ== X-Received: by 2002:a05:600c:2dc1:: with SMTP id e1mr4652486wmh.170.1637194838264; Wed, 17 Nov 2021 16:20:38 -0800 (PST) Received: from localhost.localdomain ([193.48.40.117]) by smtp.gmail.com with ESMTPSA id y7sm1255927wrw.55.2021.11.17.16.20.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Nov 2021 16:20:37 -0800 (PST) From: zimoun Date: Thu, 18 Nov 2021 01:20:21 +0100 Message-Id: <20211118002023.3323307-2-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211118002023.3323307-1-zimon.toutoune@gmail.com> References: <20211118002023.3323307-1-zimon.toutoune@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * guix/scripts/hash.scm (guix-hash): Allow several files. [file-hash]: Catch system-error. [formatted-hash]: New procedure. --- guix/scripts/hash.scm | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/guix/scripts/hash.scm b/guix/scripts/hash.scm index b8622373cc..12f542929b 100644 --- a/guix/scripts/hash.scm +++ b/guix/scripts/hash.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2013 Nikita Karetnikov ;;; Copyright © 2016 Jan Nieuwenhuizen ;;; Copyright © 2018 Tim Gesthuizen +;;; Copyright © 2021 Simon Tournier ;;; ;;; This file is part of GNU Guix. ;;; @@ -149,27 +150,31 @@ (define (vcs-file? file stat) (define (file-hash file) ;; Compute the hash of FILE. ;; Catch and gracefully report possible '&nar-error' conditions. - (with-error-handling - (if (assoc-ref opts 'recursive?) + (if (assoc-ref opts 'recursive?) + (with-error-handling (let-values (((port get-hash) (open-hash-port (assoc-ref opts 'hash-algorithm)))) (write-file file port #:select? select?) (force-output port) - (get-hash)) - (match file - ("-" (port-hash (assoc-ref opts 'hash-algorithm) - (current-input-port))) - (_ (call-with-input-file file - (cute port-hash (assoc-ref opts 'hash-algorithm) - <>))))))) + (get-hash))) + (catch 'system-error + (lambda _ + (call-with-input-file file + (cute port-hash (assoc-ref opts 'hash-algorithm) + <>))) + (lambda args + (leave (G_ "~a ~a~%") + file + (strerror (system-error-errno args))))))) - (match args - ((file) - (catch 'system-error - (lambda () - (format #t "~a~%" (fmt (file-hash file)))) - (lambda args - (leave (G_ "~a~%") - (strerror (system-error-errno args)))))) - (x - (leave (G_ "wrong number of arguments~%")))))) + (define (formatted-hash thing) + (match thing + ("-" (with-error-handling + (fmt (port-hash (assoc-ref opts 'hash-algorithm) + (current-input-port))))) + (_ + (fmt (file-hash thing))))) + + (for-each + (compose (cute format #t "~a~%" <>) formatted-hash) + args))) -- 2.33.1 From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] [PATCH v2 3/3] scripts: hash: Add git serializer. Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 18 Nov 2021 00:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51307@debbugs.gnu.org Cc: ludo@gnu.org, zimoun Received: via spool by 51307-submit@debbugs.gnu.org id=B51307.163719484926878 (code B ref 51307); Thu, 18 Nov 2021 00:21:02 +0000 Received: (at 51307) by debbugs.gnu.org; 18 Nov 2021 00:20:49 +0000 Received: from localhost ([127.0.0.1]:34139 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mnVAX-0006zN-8Q for submit@debbugs.gnu.org; Wed, 17 Nov 2021 19:20:49 -0500 Received: from mail-wm1-f49.google.com ([209.85.128.49]:51171) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mnVAT-0006yl-0y for 51307@debbugs.gnu.org; Wed, 17 Nov 2021 19:20:46 -0500 Received: by mail-wm1-f49.google.com with SMTP id 133so3777508wme.0 for <51307@debbugs.gnu.org>; Wed, 17 Nov 2021 16:20:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SL/gIdANgdxZAgXsJxq4XvVCS8NHj/f/oZy9QdFOxNw=; b=PQjCP73Ed1W9i9OmbdPttpddetuhr3hpImdm2A7o8MzN/LvL9Kx0wFj2ZN4H2BlV8n QnWOvC8moio0UjXT9Uh/mEyLMHAkc1eiolb/nnEDEXuqstHoMcjrJwirWP7mfa+UCMx5 3f5LoyY57OTuBwd4k18Ja6YuUGe92BbXxsquZglXr+ZCN3AFYuG+aM3DJrztc8tN9VtL 6d8i+Er4jjki/HNgFJkPPeVFNmocy3YRvB9aCklUq2jOLMM8Rwa8HxJilV16lE0gCKOz KQF78MPcyNslR365vzeuEmqZgq0kDs8/TfgwPFJQwURJBzgjFVJ4+Y2zl17dTBGTGckQ YPKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SL/gIdANgdxZAgXsJxq4XvVCS8NHj/f/oZy9QdFOxNw=; b=TAVCI8fTSuMl7WPRsXysanLAUt40V9HcjxyZC4CFo1n2dj2Oph2aDrkQ9TqMuiH91g 4YYe1oH8QLdYowRt6Anc3Xvbegyh3CT8smZRsXLzum1xGTxO+p+qPnPXKaISuO0Tv/IS ir/jS3gHoN/9b3K1CSNWCam31Hd4hdk8dkyzqpQv1/ZYdcN8Egf/jMe4825I9NdrggIR TfZjCU2lQi+es3kVjTuJmW1/EF83DJZqL531oA4aZCVN1uxne92DJqDn1ttDj7lmwng/ 0hjRDqs4pisq/cOrpsa0hGq/fmouGDrr+k6OFRQ0gRxkQMv3V1351LAKLm12EPEoUbZd 9kcQ== X-Gm-Message-State: AOAM530g5dtHEbVFCCxr+p3jUdeaYzmmnEr7Cs7CL380lzyLmutlGwXz xk7EjSLkbdqhIAZaXDdXBkfsC98n0AU= X-Google-Smtp-Source: ABdhPJyiaxVZkZ386v+PAb71IJ0p3QaQNYqRIi+N+0flJxemc6NEVjRWT4CaSFp6TIq67JmYHR6UPQ== X-Received: by 2002:a1c:9a89:: with SMTP id c131mr4615594wme.80.1637194839356; Wed, 17 Nov 2021 16:20:39 -0800 (PST) Received: from localhost.localdomain ([193.48.40.117]) by smtp.gmail.com with ESMTPSA id y7sm1255927wrw.55.2021.11.17.16.20.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Nov 2021 16:20:39 -0800 (PST) From: zimoun Date: Thu, 18 Nov 2021 01:20:23 +0100 Message-Id: <20211118002023.3323307-4-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211118002023.3323307-1-zimon.toutoune@gmail.com> References: <20211118002023.3323307-1-zimon.toutoune@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * guix/scripts/hash.scm (git-hash): New procedure. (%options): Use it. * tests/guix-hash.sh: Test it. * doc/guix.texi: Update. --- doc/guix.texi | 4 +++- guix/scripts/hash.scm | 15 +++++++++++++++ tests/guix-hash.sh | 6 ++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index 20041c20b7..af2e99903b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11638,7 +11638,7 @@ legacy alias for @var{type} sets to @code{nar}. @itemx -S Compute the hash on @var{file} using @var{type} serialization. -Supported types: @code{none} and @code{nar}. +Supported types: @code{none}, @code{nar} and @code{git}. When using @code{nar}, the hash is computed on an archive containing @var{file}, including its children if it is a directory. Some of the @@ -11649,6 +11649,8 @@ impact on the hash (@pxref{Invoking guix archive}). @c FIXME: Replace xref above with xref to an ``Archive'' section when @c it exists. +Using @code{git} serializes the file or directory as a Git tree. + @item --exclude-vcs @itemx -x When combined with @option{--recursive}, exclude version control system diff --git a/guix/scripts/hash.scm b/guix/scripts/hash.scm index d05ecb80ba..80581f2340 100644 --- a/guix/scripts/hash.scm +++ b/guix/scripts/hash.scm @@ -35,6 +35,8 @@ (define-module (guix scripts hash) #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) #:use-module (srfi srfi-37) + #:use-module ((disarchive git-hash) #:select (git-hash-file + git-hash-directory)) #:export (guix-hash)) @@ -60,6 +62,17 @@ (define* (default-hash file #:optional (call-with-input-file file (cute port-hash algorithm <>))))) +(define* (git-hash file #:optional + (algorithm (assoc-ref %default-options 'hash-algorithm)) + select?) + (define directory? + (case (stat:type (stat file)) + ((directory) #t) + (else #f))) + (if directory? + (git-hash-directory file algorithm) + (git-hash-file file algorithm))) + ;;; ;;; Command-line options. @@ -138,6 +151,8 @@ (define serializer-proc default-hash) ("nar" nar-hash) + ("git" + git-hash) (x (leave (G_ "unsupported serializer type: ~a~%") arg)))) diff --git a/tests/guix-hash.sh b/tests/guix-hash.sh index cdcfac19bc..bb3973771f 100644 --- a/tests/guix-hash.sh +++ b/tests/guix-hash.sh @@ -34,6 +34,9 @@ test `guix hash -f base32 /dev/null` = 4oymiquy7qobjgx36tejs35zeqt24qpemsnzgtfes test `guix hash -H sha512 -f hex /dev/null` = cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e test `guix hash -H sha1 -f base64 /dev/null` = "2jmj7l5rSw0yVb/vlWAYkK/YBwk=" +# idem as `cat /dev/null | git hash-object --stdin` +test `guix hash -S git -H sha1 -f hex /dev/null` = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 + ! guix hash -H abcd1234 /dev/null mkdir "$tmpdir" @@ -44,6 +47,7 @@ mkdir "$tmpdir/subdir" test `guix hash -S nar "$tmpdir"` = 10k1lw41wyrjf9mxydi0is5nkpynlsvgslinics4ppir13g7d74p test `guix hash -S nar "$tmpdir" -H sha512` = 301ra58c2vahczzxiyfin41mpyb0ljh4dh9zn3ijvwviaw1j40sfzw5skh9x945da88n3785ggifzig7acd6k72h0mpsc20m1f66m9n +test `guix hash -S git "$tmpdir" -H sha512` = 158b10d1bsdk4pm8ym9cg9ckfak1b0cgpw7365cl6s341ir380mh2f4ylicyh8khyrfnwq5cn9766d7m8fbfwwl94ndkv456v6a8knr # Deprecated --recursive option test `guix hash -r "$tmpdir" 2>/dev/null` = 10k1lw41wyrjf9mxydi0is5nkpynlsvgslinics4ppir13g7d74p @@ -62,9 +66,11 @@ touch "$tmpdir/.git/foo" # ...changes the hash test `guix hash -S nar $tmpdir` = 0a50z04zyzf7pidwxv0nwbj82pgzbrhdy9562kncnvkcfvb48m59 +test `guix hash -S git $tmpdir` = 0ghlpca9xaswa1ay1g55dknwd9q899mi3ahfr43pq083v8wisjc7 # ...but remains the same when using `-x' test `guix hash -S nar $tmpdir -x` = 10k1lw41wyrjf9mxydi0is5nkpynlsvgslinics4ppir13g7d74p +test `guix hash -S git $tmpdir -x` = 0ghlpca9xaswa1ay1g55dknwd9q899mi3ahfr43pq083v8wisjc7 # Without '-r', this should fail. ! guix hash "$tmpdir" -- 2.33.1 From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] [PATCH v2 2/3] scripts: hash: Add 'serializer' option. Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 18 Nov 2021 00:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51307@debbugs.gnu.org Cc: ludo@gnu.org, zimoun Received: via spool by 51307-submit@debbugs.gnu.org id=B51307.163719485026885 (code B ref 51307); Thu, 18 Nov 2021 00:21:02 +0000 Received: (at 51307) by debbugs.gnu.org; 18 Nov 2021 00:20:50 +0000 Received: from localhost ([127.0.0.1]:34141 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mnVAX-0006zS-KU for submit@debbugs.gnu.org; Wed, 17 Nov 2021 19:20:50 -0500 Received: from mail-wm1-f47.google.com ([209.85.128.47]:40566) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mnVAS-0006yg-Aw for 51307@debbugs.gnu.org; Wed, 17 Nov 2021 19:20:46 -0500 Received: by mail-wm1-f47.google.com with SMTP id az33-20020a05600c602100b00333472fef04so6184721wmb.5 for <51307@debbugs.gnu.org>; Wed, 17 Nov 2021 16:20:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cY2sj5YyVxW04ul2pRGYBDOUoW+p8Rb6I9dQaIubgiU=; b=mtFnMqTC5dLvlS7sLv464bD26ruJGgx+twwB9ufpPDolUi6K8xfUTXeRxOU0+Af0AB Tb30MnAuEO2tx0FmPjcQOn559pjlN+ih+DDplJB2JVYk1iLzzsPpCyYVRIMFVHiA2aIp wQRx/yCoqhzALKMZubHl12YSqOt8UnSCE0VDFHICxlEF0w1LbY9Yu54XD0zW8skXDfT2 OYdPO9GQcuGx8ASXfbBk58k4fXICL+312/HiOnShHkfcEMwdFvpcoc1E70+VBPIZUqtg jM+iRcNTkliop3DCnpXhTsvjDxsvgXonsv70/c5RhmZofRoeD2IMwR4Ki0DSXwp0gTc3 5ipw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cY2sj5YyVxW04ul2pRGYBDOUoW+p8Rb6I9dQaIubgiU=; b=t7P1Br90aDaD6297ArJtSofiCMzvrOKUyFbl7LAIIZT1FdxTlWC8r4SCiAjGhllejE fZG5nSLCFdz2ipU8hsZbfv94/QZ2oFImlkVj4C1WGG5RwWcEnx1Jnnx9p1uYySB4PhHd /SyMVxTcOWTNlgH+LmsKvtteD8P+iHaTL8utAu63BXjuPIDUsC3GnioksPFgdIMR1uHG QEhuvp+ZLbqeBdV4kXshLexHj/PV6NA/+EyytXWlGBcUZdyXiPRdzbC2B4tmiBvuE0kt wqvHwRmeejWssWKi7KWLkuNoHnXTXIGd9CpSFzRXQCUJ+bTZqbTd3BFwWdQaEb2yDFy0 eMqw== X-Gm-Message-State: AOAM5306IwEXUUB2I42ekeJPMfTt3KinFTdsLbR5nDukMczU59zT9Aok hBDgSPlhYUO2uMWMJKt5Lw5zaJ+3KQY= X-Google-Smtp-Source: ABdhPJwmmJck3m8o3lg0Sgmz/VUMJ7lF8Czwi9PjAniJEZtR2AwGLaolwWHIVTmFB2QuRAzRq6aZ7w== X-Received: by 2002:a7b:c2f7:: with SMTP id e23mr4766735wmk.92.1637194838831; Wed, 17 Nov 2021 16:20:38 -0800 (PST) Received: from localhost.localdomain ([193.48.40.117]) by smtp.gmail.com with ESMTPSA id y7sm1255927wrw.55.2021.11.17.16.20.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Nov 2021 16:20:38 -0800 (PST) From: zimoun Date: Thu, 18 Nov 2021 01:20:22 +0100 Message-Id: <20211118002023.3323307-3-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211118002023.3323307-1-zimon.toutoune@gmail.com> References: <20211118002023.3323307-1-zimon.toutoune@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * guix/scripts/hash.scm (%options): Deprecate 'recursive', add 'serializer'. (%default-options): Add 'serializer'. (nar-hash): New procedure. (default-hash): New procedure. (guix-hash)[file-hash]: Use them. (show-help): Adjust. * tests/guix-hash.scm: Adjust. * doc/guix.texi: Update. --- doc/guix.texi | 25 ++++++++----- guix/scripts/hash.scm | 82 +++++++++++++++++++++++++++++-------------- tests/guix-hash.sh | 14 +++++--- 3 files changed, 81 insertions(+), 40 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 89a970908d..20041c20b7 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -71,7 +71,7 @@ Copyright @copyright{} 2019 Kyle Andrews@* Copyright @copyright{} 2019 Alex Griffin@* Copyright @copyright{} 2019, 2020, 2021 Guillaume Le Vaillant@* Copyright @copyright{} 2020 Liliana Marie Prikler@* -Copyright @copyright{} 2019, 2020 Simon Tournier@* +Copyright @copyright{} 2019, 2020, 2021 Simon Tournier@* Copyright @copyright{} 2020 Wiktor Żelazny@* Copyright @copyright{} 2020 Damien Cassou@* Copyright @copyright{} 2020 Jakub Kądziołka@* @@ -11631,14 +11631,21 @@ in the definitions of packages. @item --recursive @itemx -r -Compute the hash on @var{file} recursively. - -In this case, the hash is computed on an archive containing @var{file}, -including its children if it is a directory. Some of the metadata of -@var{file} is part of the archive; for instance, when @var{file} is a -regular file, the hash is different depending on whether @var{file} is -executable or not. Metadata such as time stamps has no impact on the -hash (@pxref{Invoking guix archive}). +This option is deprecated in favor of @option{--serializer}. It is a +legacy alias for @var{type} sets to @code{nar}. + +@item --serializer=@var{type} +@itemx -S +Compute the hash on @var{file} using @var{type} serialization. + +Supported types: @code{none} and @code{nar}. + +When using @code{nar}, the hash is computed on an archive containing +@var{file}, including its children if it is a directory. Some of the +metadata of @var{file} is part of the archive; for instance, when +@var{file} is a regular file, the hash is different depending on whether +@var{file} is executable or not. Metadata such as time stamps has no +impact on the hash (@pxref{Invoking guix archive}). @c FIXME: Replace xref above with xref to an ``Archive'' section when @c it exists. diff --git a/guix/scripts/hash.scm b/guix/scripts/hash.scm index 12f542929b..d05ecb80ba 100644 --- a/guix/scripts/hash.scm +++ b/guix/scripts/hash.scm @@ -37,6 +37,29 @@ (define-module (guix scripts hash) #:use-module (srfi srfi-37) #:export (guix-hash)) + +;;; +;;; Serializers +;;; + +(define* (nar-hash file #:optional + (algorithm (assoc-ref %default-options 'hash-algorithm)) + select?) + (let-values (((port get-hash) + (open-hash-port algorithm))) + (write-file file port #:select? select?) + (force-output port) + (get-hash))) + +(define* (default-hash file #:optional + (algorithm (assoc-ref %default-options 'hash-algorithm)) + select?) + (match file + ("-" (port-hash algorithm (current-input-port))) + (_ + (call-with-input-file file + (cute port-hash algorithm <>))))) + ;;; ;;; Command-line options. @@ -45,7 +68,8 @@ (define-module (guix scripts hash) (define %default-options ;; Alist of default option values. `((format . ,bytevector->nix-base32-string) - (hash-algorithm . ,(hash-algorithm sha256)))) + (hash-algorithm . ,(hash-algorithm sha256)) + (serializer . ,default-hash))) (define (show-help) (display (G_ "Usage: guix hash [OPTION] FILE @@ -61,7 +85,7 @@ (define (show-help) (format #t (G_ " -f, --format=FMT write the hash in the given format")) (format #t (G_ " - -r, --recursive compute the hash on FILE recursively")) + -S, --serializer=TYPE compute the hash on FILE according to TYPE serialization")) (newline) (display (G_ " -h, --help display this help and exit")) @@ -102,7 +126,24 @@ (define fmt-proc (alist-delete 'format result)))) (option '(#\r "recursive") #f #f (lambda (opt name arg result) - (alist-cons 'recursive? #t result))) + (warning (G_ "'--recursive' is deprecated, \ +use '--serializer' instead~%")) + (alist-cons 'serializer nar-hash + (alist-delete 'serializer result)))) + (option '(#\S "serializer") #t #f + (lambda (opt name arg result) + (define serializer-proc + (match arg + ("none" + default-hash) + ("nar" + nar-hash) + (x + (leave (G_ "unsupported serializer type: ~a~%") + arg)))) + + (alist-cons 'serializer serializer-proc + (alist-delete 'serializer result)))) (option '(#\h "help") #f #f (lambda args (show-help) @@ -145,35 +186,24 @@ (define (vcs-file? file stat) (fmt (assq-ref opts 'format)) (select? (if (assq-ref opts 'exclude-vcs?) (negate vcs-file?) - (const #t)))) + (const #t))) + (algorithm (assoc-ref opts 'hash-algorithm)) + (serializer (assoc-ref opts 'serializer))) (define (file-hash file) ;; Compute the hash of FILE. - ;; Catch and gracefully report possible '&nar-error' conditions. - (if (assoc-ref opts 'recursive?) + ;; Catch and gracefully report possible error + (catch 'system-error + (lambda _ (with-error-handling - (let-values (((port get-hash) - (open-hash-port (assoc-ref opts 'hash-algorithm)))) - (write-file file port #:select? select?) - (force-output port) - (get-hash))) - (catch 'system-error - (lambda _ - (call-with-input-file file - (cute port-hash (assoc-ref opts 'hash-algorithm) - <>))) - (lambda args - (leave (G_ "~a ~a~%") - file - (strerror (system-error-errno args))))))) + (serializer file algorithm select?))) + (lambda args + (leave (G_ "~a ~a~%") + file + (strerror (system-error-errno args)))))) (define (formatted-hash thing) - (match thing - ("-" (with-error-handling - (fmt (port-hash (assoc-ref opts 'hash-algorithm) - (current-input-port))))) - (_ - (fmt (file-hash thing))))) + (fmt (file-hash thing))) (for-each (compose (cute format #t "~a~%" <>) formatted-hash) diff --git a/tests/guix-hash.sh b/tests/guix-hash.sh index c4461fa955..cdcfac19bc 100644 --- a/tests/guix-hash.sh +++ b/tests/guix-hash.sh @@ -42,25 +42,29 @@ chmod +x "$tmpdir/exe" ( cd "$tmpdir" ; ln -s exe symlink ) mkdir "$tmpdir/subdir" -test `guix hash -r "$tmpdir"` = 10k1lw41wyrjf9mxydi0is5nkpynlsvgslinics4ppir13g7d74p -test `guix hash -r "$tmpdir" -H sha512` = 301ra58c2vahczzxiyfin41mpyb0ljh4dh9zn3ijvwviaw1j40sfzw5skh9x945da88n3785ggifzig7acd6k72h0mpsc20m1f66m9n +test `guix hash -S nar "$tmpdir"` = 10k1lw41wyrjf9mxydi0is5nkpynlsvgslinics4ppir13g7d74p +test `guix hash -S nar "$tmpdir" -H sha512` = 301ra58c2vahczzxiyfin41mpyb0ljh4dh9zn3ijvwviaw1j40sfzw5skh9x945da88n3785ggifzig7acd6k72h0mpsc20m1f66m9n + +# Deprecated --recursive option +test `guix hash -r "$tmpdir" 2>/dev/null` = 10k1lw41wyrjf9mxydi0is5nkpynlsvgslinics4ppir13g7d74p +test `guix hash -r "$tmpdir" -H sha512 2>/dev/null` = 301ra58c2vahczzxiyfin41mpyb0ljh4dh9zn3ijvwviaw1j40sfzw5skh9x945da88n3785ggifzig7acd6k72h0mpsc20m1f66m9n # Without '-r', this should fail. ! guix hash "$tmpdir" # This should fail because /dev/null is a character device, which # the archive format doesn't support. -! guix hash -r /dev/null +! guix hash -S nar /dev/null # Adding a .git directory mkdir "$tmpdir/.git" touch "$tmpdir/.git/foo" # ...changes the hash -test `guix hash -r $tmpdir` = 0a50z04zyzf7pidwxv0nwbj82pgzbrhdy9562kncnvkcfvb48m59 +test `guix hash -S nar $tmpdir` = 0a50z04zyzf7pidwxv0nwbj82pgzbrhdy9562kncnvkcfvb48m59 # ...but remains the same when using `-x' -test `guix hash -r $tmpdir -x` = 10k1lw41wyrjf9mxydi0is5nkpynlsvgslinics4ppir13g7d74p +test `guix hash -S nar $tmpdir -x` = 10k1lw41wyrjf9mxydi0is5nkpynlsvgslinics4ppir13g7d74p # Without '-r', this should fail. ! guix hash "$tmpdir" -- 2.33.1 From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] [PATCH v2 0/3] scripts: hash: Several files and serializer. References: <20211020165020.3358311-1-zimon.toutoune@gmail.com> In-Reply-To: <20211020165020.3358311-1-zimon.toutoune@gmail.com> Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 18 Nov 2021 00:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51307@debbugs.gnu.org Cc: ludo@gnu.org, zimoun Received: via spool by 51307-submit@debbugs.gnu.org id=B51307.163719485026892 (code B ref 51307); Thu, 18 Nov 2021 00:21:02 +0000 Received: (at 51307) by debbugs.gnu.org; 18 Nov 2021 00:20:50 +0000 Received: from localhost ([127.0.0.1]:34143 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mnVAY-0006za-8F for submit@debbugs.gnu.org; Wed, 17 Nov 2021 19:20:50 -0500 Received: from mail-wm1-f47.google.com ([209.85.128.47]:42664) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mnVAR-0006ye-JB for 51307@debbugs.gnu.org; Wed, 17 Nov 2021 19:20:46 -0500 Received: by mail-wm1-f47.google.com with SMTP id d72-20020a1c1d4b000000b00331140f3dc8so3432093wmd.1 for <51307@debbugs.gnu.org>; Wed, 17 Nov 2021 16:20:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SkLuijJtpBFl/qiMya1Ql+54TgeCVACqYRotMjEpqzs=; b=B0JyTPnNnd9I50ehtlDLLSV/auSjb+LVJqSMG7WOSBySoSP8EZq5a8xt4q17NI8LO+ 4gDJ4K5TPLQCpTCEB56jkzTRUCGnR9X+ipVaAAf7xPFiPZemr3XzHx/51wHPg58qUD7t fp9skwcUOHPHVQbOqVFDHwmmRg/54djYB2z9sX06dW0P5GCMFbGXIQFceitqoT2So5cd 1HPp/lxvnqYexLkbCTsjcoQuVdevJPF3pqc7uElMnl0G8CnK1phnCKoqxyzMrmO9bKdy q9st9uE7txminVOsFM6hO3VMbTGnn74B7VFN0RntELapiXe7D0c9SB0VNuZBN0wzN8hK R6Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SkLuijJtpBFl/qiMya1Ql+54TgeCVACqYRotMjEpqzs=; b=fcylANMKW4T7so/MUyDJoP1qQfjZEiu0EHnOEXAVaCZnojE6I9AWnNR2InX62yCU4N PIsA3es4i5vqi91yKvFDtDwvgAjJ1C2VkznCD0VH1HygUs1fhkF97o+G2eidoyCWq9ts tzd7Z/AKUSYREjpHIwD5q7Zbb+1tIJ4T88S0G2PWMWc0NtYN+4Rl6tzKTR472ReXel81 YwpMro7X/zFnLWj29OP4S0MgSs6NwYd3hf70J5hO/gcCvyXGj4/fLbN9ScjqS8CbnCFD QB3xc0e5vArhdXADwexdF1w983LNiJJvLjC633EUlkMn+z5ePi1AYHmfRhl0WfL2gTQ+ eWcA== X-Gm-Message-State: AOAM531Y6IrUCYGOKtDTGqQJ0h8qFmbgOBtKbMr0/gOUpM5aRGP3mdF3 kdK5pJNfFR+KkNG+paE7mxxn6RnW/Xo= X-Google-Smtp-Source: ABdhPJzGhMVX45mNeaeXI+hPHAYXwQ/WFVETMugM/8xcz2JcCPjDTBt+kDlWjcUrC3fL+HtQ21Gm6w== X-Received: by 2002:a05:600c:a49:: with SMTP id c9mr4761221wmq.172.1637194837791; Wed, 17 Nov 2021 16:20:37 -0800 (PST) Received: from localhost.localdomain ([193.48.40.117]) by smtp.gmail.com with ESMTPSA id y7sm1255927wrw.55.2021.11.17.16.20.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Nov 2021 16:20:37 -0800 (PST) From: zimoun Date: Thu, 18 Nov 2021 01:20:20 +0100 Message-Id: <20211118002023.3323307-1-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi, The first patch is the one which already made consensus. Minor suggestions by [1] has been added. The 2 following ones add UI presented there [2]. Basically, it allows: guix hash foo # similar as -S none guix hash foo -S nar # similar as -r guix hash foo -S git Especially, compare: $ cat /tmp/foo.txt | git hash-object --stdin 557db03de997c86a4a028e1ebd3a1ceb225be238 $ ./pre-inst-env guix hash -S git -H sha1 -f hex /tmp/foo.txt 557db03de997c86a4a028e1ebd3a1ceb225be238 Two remarks: 1. « #:use-module (disarchive) » is added. Elsewhere (guix download), the module is "conditionally" loaded, as if disarchive is an optional dependency. What should be done? 2. The SWH serializer is not added yet. Cheers, simon 1: 2: zimoun (3): scripts: hash: Support several files. scripts: hash: Add 'serializer' option. scripts: hash: Add git serializer. doc/guix.texi | 27 +++++++---- guix/scripts/hash.scm | 108 ++++++++++++++++++++++++++++++------------ tests/guix-hash.sh | 20 ++++++-- 3 files changed, 112 insertions(+), 43 deletions(-) base-commit: 99084abd80d7c81e83263ffc6fd3699aeb8899c5 -- 2.33.1 From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] Content hashes and file tree serialization methods Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 18 Nov 2021 00:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 51307@debbugs.gnu.org Received: via spool by 51307-submit@debbugs.gnu.org id=B51307.163719576128840 (code B ref 51307); Thu, 18 Nov 2021 00:36:01 +0000 Received: (at 51307) by debbugs.gnu.org; 18 Nov 2021 00:36:01 +0000 Received: from localhost ([127.0.0.1]:34151 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mnVPE-0007V6-Ml for submit@debbugs.gnu.org; Wed, 17 Nov 2021 19:36:00 -0500 Received: from mail-wr1-f42.google.com ([209.85.221.42]:34340) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mnVPA-0007Uj-FR for 51307@debbugs.gnu.org; Wed, 17 Nov 2021 19:35:59 -0500 Received: by mail-wr1-f42.google.com with SMTP id d5so8051494wrc.1 for <51307@debbugs.gnu.org>; Wed, 17 Nov 2021 16:35:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-transfer-encoding; bh=XrLikOrOltmKYFTGn2ifLyEUjrljqnpnwHcI6f7B1vs=; b=PIobW36jRgLrCx/qXLb+SRUsgloqZlXcK2YhQuBQIdkNcAUsxq1t0kr+i9EBx5ysDA BWElHgtzFMArmVc1s92IodWRUMcbkOl/9LS+GYDT2weAjVROao35aRxsmK+O+U9pxVPd nyhZJYmvnVFYQRCmWqY07pIc1qR06qCfYxgeUN7bw7tA2sHeuU+XoRBTHZs49D6n1AoL irLFBtOiwP4BgHasJaukDIQ0wVDvAN4ZME8m2inF5xz2Lo8+00GJF6Q9nDN4KdIbEWIC y691yfDMe1vofqnE54qNEUsmIYq/zMe+EgMlSR1zmoMub/EMgl/8b+UtUf09bHRhF+rC I94Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=XrLikOrOltmKYFTGn2ifLyEUjrljqnpnwHcI6f7B1vs=; b=lKoTb8LEXOOwu8OnSkk/9e1S5ELPP7IaFaio0jP8kgwZ3QkPJ2pdanmoO2vaukAa/A 0JJ28HxNThviX/AU27+bg0+A5v7X3qKAKH0jrn9uGmqioGUyNCz+SfWJ7U64ewG6Qzuc qZNK3YYY3X56zwlGotWVazgKutg3JN2/tTnR0mkfFKC9pcugb9wPNq3LL5JL1wjhL4V5 Hcg8xLo45n4wmXaGfLQvZ9MfnkxCBMZQQLQbQjBrr3FkmCqJYhfNfDoNZBb6k1dx08aL +nHI6GiBVslW4H+lKG19X5txh/rJgDeaGrtYpWk7U4+ljjh3YbiNUh06N8Ijo6QmVxBn Yxog== X-Gm-Message-State: AOAM532VYGuvD2VSr58by3vraCnL49u51ybAxlHHc7lkziJgZpDKefWH IZ2VIXn2W7RonBRXf0AcKGmJvVTve+4= X-Google-Smtp-Source: ABdhPJySXezOwBohriM+oM0+QbBEfC/N3jEG7uVvExOwjtDUv/ahWi8xS4VIzYW6PzPcOfw/mqm9Yw== X-Received: by 2002:a05:6000:1289:: with SMTP id f9mr26834296wrx.329.1637195750590; Wed, 17 Nov 2021 16:35:50 -0800 (PST) Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id x4sm6828283wmi.3.2021.11.17.16.35.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Nov 2021 16:35:49 -0800 (PST) From: zimoun In-Reply-To: <87mtmpntcf.fsf_-_@gnu.org> References: <20211020165020.3358311-1-zimon.toutoune@gmail.com> <87wnlusgwy.fsf@gnu.org> <86tugyleub.fsf@gmail.com> <87mtmpntcf.fsf_-_@gnu.org> Date: Thu, 18 Nov 2021 01:29:27 +0100 Message-ID: <86wnl6qpaw.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Ludo, On Sun, 31 Oct 2021 at 15:48, Ludovic Court=C3=A8s wrote: > Thinking more about it, I think confusion stems from the term > =E2=80=9Crecursive=E2=80=9D (inherited from Nix) because, as you write, i= t doesn=E2=80=99t > necessarily have to do with recursion and directory traversal. > > Instead, it has to do with the serialization method. > > Thus, probably, =E2=80=98--recursive=E2=80=99 could be replaced by a =E2= =80=98-S=E2=80=99 flag: > > guix hash -S nar something > > or: > > guix hash -S none something > guix hash -S git something > guix hash -S swh something > > =E2=80=98-S none=E2=80=99 would be like not passing =E2=80=98-r=E2=80=99;= =E2=80=98-S git=E2=80=99 would serialize the > file/directory as a Git tree; =E2=80=98-S swh=E2=80=99 would serialize it= the SWH way, > which is like Git except it preserves empty directories (Disarchive > implements the Git/SWH methods already.) Well, v2 is an attempt for this UI. It does not solve my initial problem but it is a first step in that direction. ;-) Note that SWH serializer is not added. Because I have probably missed to reach the implementation. :-) Well, next step could be to add an option =E2=80=9C--list-serializers=E2=80= =9C. Let as an exercise for the reader. ;-) > As mentioned towards the end of > , > being able to deal with different tree serialization methods would be > useful going forward; for instance, if we had the option to store > SWH-style content hashes for origins, that=E2=80=99d help a lot. Allowin= g =E2=80=98guix > hash=E2=80=99 to deal with that is a first step in that direction. Well, this series does not add SWH-style but it is a tiny step in that direction. Somehow, after v2-patch#2, it is easy to add as many serializers as we want. :-) > (Apologies for slipping a bit off-topic=E2=80=A6) Thanks for slipping off-topic. :-) Cheers, simon *serializer: it is not an English word but I lacked imagination. From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] [PATCH v2 0/3] scripts: hash: Several files and serializer. Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 15 Dec 2021 08:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: ludo@gnu.org Cc: 51307@debbugs.gnu.org Received: via spool by 51307-submit@debbugs.gnu.org id=B51307.163955601221630 (code B ref 51307); Wed, 15 Dec 2021 08:14:01 +0000 Received: (at 51307) by debbugs.gnu.org; 15 Dec 2021 08:13:32 +0000 Received: from localhost ([127.0.0.1]:60173 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mxPPo-0005co-B7 for submit@debbugs.gnu.org; Wed, 15 Dec 2021 03:13:32 -0500 Received: from mail-wr1-f42.google.com ([209.85.221.42]:34625) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mxPPm-0005ca-2Q for 51307@debbugs.gnu.org; Wed, 15 Dec 2021 03:13:30 -0500 Received: by mail-wr1-f42.google.com with SMTP id s1so2554812wrg.1 for <51307@debbugs.gnu.org>; Wed, 15 Dec 2021 00:13:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=2ZxKYZSpfiytwPYcX/RKVoWKatI2c58m/GdjS4nBPAw=; b=Hln3BM8ocZMBK/6bo9jWdEMdPo/HEcx9UZDE731mzRHPea8CcEYJnGUASsfuq63u95 E9aKoHn7p2nTnbGB+xkK1H2rs/u3rrVNNqzT1SiTQTii2FBzvw66fggmCDJy5FDbPgI+ d8LMurnFK2EY8V8Zn/j+wzfaOGmQGefryiwJSSf9Lk1IVZDvf/NB0t4tb40Rp+RI0fPS 0hRNag++P8SxpBr32yGKAjoEmIyMGVHOMHQzIujnBy+P7zjyQo8kvbG/bUGv5al6YRNQ 3v+g9CycdDR8iB+Ri4mpqUQ+odH3Pl82t4Yn2iWyak5W6AVUHwKswCncDNJ63YMg8F9s EeqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=2ZxKYZSpfiytwPYcX/RKVoWKatI2c58m/GdjS4nBPAw=; b=sAzgqcE7Dgyn2K6IR7rRL/oIMCxhn5ex+RcG8FDYGCdywtnxKJS+rComHYKaZEgnDF 0WVPKqANl75yC7IBdgLLBc3ONu5z0scFjskCdoKlqpCFVWoy3YVMtPBVGwZKMrwqHBdS 9JeosvggOUovPxetKmq6z1NiuRx5qYgMY0KS6/HBlpGbM+Ibgiao6QaL43jw9VusDxI1 TAI/PzTcri354SBglPk7Xmuv3Z/jJZlZKF3cvIxoFWyvXcNQR/7Lx98jBy+OxMTR+NXx 88a34Rttn8z6IO916ljv3EucEoEk5g1uhPpad/8Rv4h/jrOCoaLI9pboUkwIJcW2E0y8 KuTA== X-Gm-Message-State: AOAM5333+N0//UpnWyD5pvOJomsl5uHao0F9wor5PP9WRJVNpIGOa62F Hh/saJKPzX8DhgflRf1y6w4gEpeOZfA= X-Google-Smtp-Source: ABdhPJw7DT1kePJVH9awmkWmvOWZU59lBuVfc04/dJwkhkob1zho2xjY1lzW+1TnjzvsgMuMNSYtdw== X-Received: by 2002:a5d:5244:: with SMTP id k4mr3358953wrc.77.1639556004205; Wed, 15 Dec 2021 00:13:24 -0800 (PST) Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id 138sm4399932wma.17.2021.12.15.00.13.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 00:13:23 -0800 (PST) From: zimoun References: <20211020165020.3358311-1-zimon.toutoune@gmail.com> <20211118002023.3323307-1-zimon.toutoune@gmail.com> Date: Wed, 15 Dec 2021 09:06:09 +0100 In-Reply-To: <20211118002023.3323307-1-zimon.toutoune@gmail.com> (zimoun's message of "Thu, 18 Nov 2021 01:20:20 +0100") Message-ID: <86r1ae5m32.fsf@gmail.com> 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-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi, What do you think about patch#51307 [1] for =E2=80=9Cguix hash=E2=80=9D? As explained and discussed earlier in this thread, it renames the option =E2=80=99-r=E2=80=99 to =E2=80=99-S nar=E2=80=99 =E2=80=93 keeping the old = one for backward compatibility* =E2=80=93 and adds =E2=80=99-S git=E2=80=99. 1: *backward compatibility: we can come later with a plan to remove and/or deprecate. On Thu, 18 Nov 2021 at 01:20, zimoun wrote: > The first patch is the one which already made consensus. Minor suggestio= ns by > [1] has been added. > > The 2 following ones add UI presented there [2]. Basically, it allows: > > guix hash foo # similar as -S none > guix hash foo -S nar # similar as -r > guix hash foo -S git > > Especially, compare: > > $ cat /tmp/foo.txt | git hash-object --stdin > 557db03de997c86a4a028e1ebd3a1ceb225be238 > $ ./pre-inst-env guix hash -S git -H sha1 -f hex /tmp/foo.txt > 557db03de997c86a4a028e1ebd3a1ceb225be238 > > > Two remarks: > > 1. =C2=AB #:use-module (disarchive) =C2=BB is added. Elsewhere (guix do= wnload), the > module is "conditionally" loaded, as if disarchive is an optional > dependency. What should be done? > > 2. The SWH serializer is not added yet. > > > Cheers, > simon > > 1: > 2: > > zimoun (3): > scripts: hash: Support several files. > scripts: hash: Add 'serializer' option. > scripts: hash: Add git serializer. > > doc/guix.texi | 27 +++++++---- > guix/scripts/hash.scm | 108 ++++++++++++++++++++++++++++++------------ > tests/guix-hash.sh | 20 ++++++-- > 3 files changed, 112 insertions(+), 43 deletions(-) > > > base-commit: 99084abd80d7c81e83263ffc6fd3699aeb8899c5 Cheers, simon From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] [PATCH v2 0/3] scripts: hash: Several files and serializer. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 15 Dec 2021 10:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: zimoun Cc: 51307@debbugs.gnu.org Received: via spool by 51307-submit@debbugs.gnu.org id=B51307.163956272832105 (code B ref 51307); Wed, 15 Dec 2021 10:06:01 +0000 Received: (at 51307) by debbugs.gnu.org; 15 Dec 2021 10:05:28 +0000 Received: from localhost ([127.0.0.1]:60282 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mxRA7-0008Ll-WE for submit@debbugs.gnu.org; Wed, 15 Dec 2021 05:05:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58910) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mxRA5-0008LV-VN for 51307@debbugs.gnu.org; Wed, 15 Dec 2021 05:05:26 -0500 Received: from [2001:470:142:3::e] (port=43240 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRA0-0006hW-Pc; Wed, 15 Dec 2021 05:05:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=A/XF74Ga/Z2wtM8Cq5zRyNGd+N49e8CdWp5BJ/y8iJs=; b=F2kquiXmBDMbWIvPF6qZ XMxbFlIbW+mG6Aqnk0anuTgrpxG/o8RVxuKELe3MqC8FOGdR7SUwzVOLk7JBkUohMFOiA48pxKSAU AC8lGDmc43PEi+fnviNRBMt2rMZRUrIjSvJoORb7qfADimYyt6PQ8SjRljic3LT+lfhvJMWagoaNT G3OwWuDglKN/4i0Hdqju+OrZrn0VCkoHOU0OQ+pvQpAeUsfe7ZbHdAaSXfOTxfA+MjqoVFvzITtop ywQea9TBX3wE+7PzK0J6z9aYQMi1InTysQjG7ffhLUR8zJAVTKbtGGhkfzhKUb5EuSoo8JERxwUMC WT69SokoUTNIuA==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:57389 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRA0-0001uP-O2; Wed, 15 Dec 2021 05:05:20 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20211020165020.3358311-1-zimon.toutoune@gmail.com> <20211118002023.3323307-1-zimon.toutoune@gmail.com> <86r1ae5m32.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 25 Frimaire an 230 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: Wed, 15 Dec 2021 11:05:17 +0100 In-Reply-To: <86r1ae5m32.fsf@gmail.com> (zimoun's message of "Wed, 15 Dec 2021 09:06:09 +0100") Message-ID: <87k0g6xjxe.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi! zimoun skribis: > What do you think about patch#51307 [1] for =E2=80=9Cguix hash=E2=80=9D? I haven=E2=80=99t forgotten about it but I=E2=80=99m lagging behind. I=E2=80=99m getting there, apologies for the delay! Ludo=E2=80=99. From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] [PATCH v2 1/3] scripts: hash: Support several files. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 17 Dec 2021 16:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: zimoun Cc: 51307@debbugs.gnu.org Received: via spool by 51307-submit@debbugs.gnu.org id=B51307.163975784110473 (code B ref 51307); Fri, 17 Dec 2021 16:18:02 +0000 Received: (at 51307) by debbugs.gnu.org; 17 Dec 2021 16:17:21 +0000 Received: from localhost ([127.0.0.1]:40487 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1myFv7-0002ir-LS for submit@debbugs.gnu.org; Fri, 17 Dec 2021 11:17:21 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39898) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1myFv6-0002ia-4F for 51307@debbugs.gnu.org; Fri, 17 Dec 2021 11:17:20 -0500 Received: from [2001:470:142:3::e] (port=52030 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1myFv0-0005z9-Ut; Fri, 17 Dec 2021 11:17:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=xqJJquIVFLMvMJgTu+W04FmFbP/ePWDqDyxftXrv0G4=; b=aYCZDeBMinwaBgFW3HPg A5i+847/4N7w6wua8WhbCpNuyEVK213VYnQOXHzG+Ftf1qdSYgaLc7clOUh2moj4DaQK6fX83oIh2 rDZ3UyuINDsX8LaLaLXG0euSXRy5csIEPUy8nvSGkjFh1aku8mbmjC1B030jCAkUNPPtFrMZPW+0n pktaEIPwrDvPFa0lmXoaTcaeXK0Gz1WEpCRPQ82ihygOef55Ak1M0SFA4QDBKem6mFUktAFJ9R0Wr rzNMEa+mDYbcAjCEmpDdIjxFZiNpJr5eSfErXOKz8+sjoiZedQPEsWLeZMY1vP6puROQrnRhaHY5A xlEIeGeqoOHWHg==; Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=34550 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1myFv0-0003aG-RC; Fri, 17 Dec 2021 11:17:15 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20211118002023.3323307-1-zimon.toutoune@gmail.com> <20211118002023.3323307-2-zimon.toutoune@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 27 Frimaire an 230 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: Fri, 17 Dec 2021 17:17:12 +0100 In-Reply-To: <20211118002023.3323307-2-zimon.toutoune@gmail.com> (zimoun's message of "Thu, 18 Nov 2021 01:20:21 +0100") Message-ID: <87pmpvp5o7.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi! zimoun skribis: > * guix/scripts/hash.scm (guix-hash): Allow several files. > [file-hash]: Catch system-error. > [formatted-hash]: New procedure. Applied with minor tweaks: =E2=80=A2 doc update; =E2=80=A2 tests in =E2=80=98tests/guix-hash.sh=E2=80=99; =E2=80=A2 error out when passed zero arguments, as was the case before. Thanks, Ludo=E2=80=99. From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] [PATCH v2 2/3] scripts: hash: Add 'serializer' option. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 17 Dec 2021 16:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: zimoun Cc: 51307@debbugs.gnu.org Received: via spool by 51307-submit@debbugs.gnu.org id=B51307.163975786210513 (code B ref 51307); Fri, 17 Dec 2021 16:18:02 +0000 Received: (at 51307) by debbugs.gnu.org; 17 Dec 2021 16:17:42 +0000 Received: from localhost ([127.0.0.1]:40492 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1myFvR-0002jU-UA for submit@debbugs.gnu.org; Fri, 17 Dec 2021 11:17:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39988) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1myFvQ-0002jG-9V for 51307@debbugs.gnu.org; Fri, 17 Dec 2021 11:17:40 -0500 Received: from [2001:470:142:3::e] (port=52040 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1myFvL-00067a-3k; Fri, 17 Dec 2021 11:17:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=RFt972bMb9BYcoI86Yv4Nt7kGCIMPG8DyK6uQL4BXaE=; b=TbQVslu+T6EP+fuRiXAH jNEOBrfOAS/VNKLUqaEE/8z79jVrY8VLUHgGDidy2NQ91MG+uxk6AWXtq0MeiCC3wlOmOIArFrWCr UIuo6atODdyMZfwYE5p71+9I8WdqEQ0xDLNvNUaW7jS1dWgNz3lkHfDUu6wmBZQvxiObhDv6PVhmL 3QRz86vvxjBvcUz3pED/x7gcaXRlai7dygAxHTWRhZ4l6vJlMdiXWfPoJ+jfTV4MVqBGX5bxJH83s HTgNNwtZRWaQQ7jMk7y3wu5B163iWrlxEiXLGZufaemZ6zot59ToW/iJlxC/rVR6beDRPRDEqAB+a XHk6UcC15S2kXA==; Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=34554 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1myFvK-0003c7-7Z; Fri, 17 Dec 2021 11:17:35 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20211118002023.3323307-1-zimon.toutoune@gmail.com> <20211118002023.3323307-3-zimon.toutoune@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 27 Frimaire an 230 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: Fri, 17 Dec 2021 17:17:32 +0100 In-Reply-To: <20211118002023.3323307-3-zimon.toutoune@gmail.com> (zimoun's message of "Thu, 18 Nov 2021 01:20:22 +0100") Message-ID: <87lf0jp5nn.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) zimoun skribis: > * guix/scripts/hash.scm (%options): Deprecate 'recursive', add 'serializer'. > (%default-options): Add 'serializer'. > (nar-hash): New procedure. > (default-hash): New procedure. > (guix-hash)[file-hash]: Use them. > (show-help): Adjust. > * tests/guix-hash.scm: Adjust. > * doc/guix.texi: Update. Applied! From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 17 11:39:45 2021 Received: (at control) by debbugs.gnu.org; 17 Dec 2021 16:39:45 +0000 Received: from localhost ([127.0.0.1]:40517 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1myGGn-0003LY-14 for submit@debbugs.gnu.org; Fri, 17 Dec 2021 11:39:45 -0500 Received: from mail-wr1-f43.google.com ([209.85.221.43]:36385) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1myGGk-0003LL-P3 for control@debbugs.gnu.org; Fri, 17 Dec 2021 11:39:43 -0500 Received: by mail-wr1-f43.google.com with SMTP id r17so4814850wrc.3 for ; Fri, 17 Dec 2021 08:39:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:message-id:to:from:subject; bh=b6XsVXGqRRrZ8fmIdy3WQHGBObUf0U/1jdTQSP4tibI=; b=QS8ET1wCcOwtQzQo+i6J9zSbUdMZcmhOYqyyUF4uBOfKbl+owVDKArUQPQtiCSalC7 mwKMH2qzyhSk5Cbr/9UveKbIEICBNFDulQ1CSZ/six/XIE4HozjxX7kBTbe9yTyySoXA Yk1zlUXTb1i+6wWilOBy2HKN32DicNDQRoecZbhY3h1lWwELzRXdGfQRl9ZU087pUXZL 2mrbwR/IgZ5r1dWiZNEqF5gRcr9o/Z6UTD78IYVykrX1aQbr3q4Swrrz6ZenNh5xvfUz ouuSb2ANBvxmMTOiceAHmJA9Hs5uWaNnV8B/Wmt4sxiEMxSH12eo+JFgmG4FkH+a7Rwi /QEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:to:from:subject; bh=b6XsVXGqRRrZ8fmIdy3WQHGBObUf0U/1jdTQSP4tibI=; b=3Ttag5Yo9004GQb2wMSNNGFEDj0H23Y4YmUyRmkiGbylzDQBc/nqKjFM7c2SsEyrw7 ixLABMRIlZ7z7KHwy0FWKEjtAa3AltaQvfBV35Y3p0Rdtw0DPIawT9vMerhHe6LDKrZu L4thTTe2ixk9Ki3VnIspeeSbmn2+ySMn5LgLOSGSX7vaxYAjrQAgCFedSlHA01SnUM+O 7fp8+gelr4hElhwnlV+jo1v/hOXJh5h7oudmo2LCy00NvNTa0ExA8xlFWi6YLSfwfPno B8b0NzByLTB+sK9aZNrTXVsdbDSn7UBVrJEXE0Uwma9UtKHvatpdiEMVmKcKJ+T2ep79 xLOg== X-Gm-Message-State: AOAM5303SuemcpQmijtukEKiiCHc9rOYDjIWbu+AKOv4qyJnPajtUNxX Q4F04Ne4JxyMm3/nuHAhdqy8ZxxlHMU= X-Google-Smtp-Source: ABdhPJws5ehtLExem8wFMnCsw7Rbbg7vv6AfXZHj8VZ/e2Bh06rNEKwhq5TnQkCJCkx6ZPiIOcrY4Q== X-Received: by 2002:adf:e0c3:: with SMTP id m3mr3252154wri.546.1639759176804; Fri, 17 Dec 2021 08:39:36 -0800 (PST) Received: from pfiuh02 ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id o25sm7758923wms.17.2021.12.17.08.39.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Dec 2021 08:39:36 -0800 (PST) Date: Fri, 17 Dec 2021 17:39:32 +0100 Message-Id: <87wnk3nq2j.fsf@gmail.com> To: control@debbugs.gnu.org From: zimoun Subject: control message for bug #51307 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) close 51307 quit From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51307] [PATCH v2 3/3] scripts: hash: Add git serializer. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 21 Dec 2021 09:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: zimoun Cc: 51307-done@debbugs.gnu.org Received: via spool by 51307-done@debbugs.gnu.org id=D51307.16400777518064 (code D ref 51307); Tue, 21 Dec 2021 09:10:02 +0000 Received: (at 51307-done) by debbugs.gnu.org; 21 Dec 2021 09:09:11 +0000 Received: from localhost ([127.0.0.1]:52340 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mzb8x-000260-DC for submit@debbugs.gnu.org; Tue, 21 Dec 2021 04:09:11 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:58086) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mzb8v-00025m-M1 for 51307-done@debbugs.gnu.org; Tue, 21 Dec 2021 04:09:10 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 2E87C427; Tue, 21 Dec 2021 10:09:04 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id O7ig1_s8_6Td; Tue, 21 Dec 2021 10:09:03 +0100 (CET) Received: from ribbon (unknown [IPv6:2001:660:6102:320:e120:2c8f:8909:cdfe]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 7D7611F7; Tue, 21 Dec 2021 10:09:02 +0100 (CET) From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20211118002023.3323307-1-zimon.toutoune@gmail.com> <20211118002023.3323307-4-zimon.toutoune@gmail.com> <87bl1bjsxf.fsf@gnu.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 1 =?UTF-8?Q?Niv=C3=B4se?= an 230 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: Tue, 21 Dec 2021 10:09:01 +0100 In-Reply-To: (zimoun's message of "Mon, 20 Dec 2021 15:21:18 +0100") Message-ID: <87bl1ab9zm.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: / Authentication-Results: hera.aquilenet.fr; none X-Rspamd-Server: hera X-Rspamd-Queue-Id: 2E87C427 X-Spamd-Result: default: False [-0.10 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Hi, zimoun skribis: > On Mon, 20 Dec 2021 at 14:40, Ludovic Court=C3=A8s wrote: > >> > + #:use-module ((disarchive git-hash) #:select (git-hash-file >> > + git-hash-directory)) >> >> Use #:autoload (that makes Disarchive a soft dependency and also reduces >> start-up time.) > > Thanks. As I asked in the cover-letter, these are confusing for me. > For instance, why not autoloading all the used modules? And is it > better to lazily load with something like: > > (match (and=3D> (resolve-module '(disarchive) #:ensure #f) > (lambda (disarchive) > (cons (module-ref disarchive '%disarchive-log-port) > (module-ref disarchive 'disarchive-assemble)))) > (#f (format #t "could not load Disarchive~%") > #f) > ((%disarchive-log-port . disarchive-assemble) > > ? From guix/build/download.scm, or any other "lazy reference" in the cod= e code. > > What are the differences? I have read the documentation but it is not > clear for me the difference between '#:autoload' and 'module-ref'. There are several reasons for autoloading: one is startup time/memory footprint, and another one is having =E2=80=9Csoft dependencies=E2=80=9D (y= ou can still build and use the thing when the dependency is missing; only that specific feature is unavailable.) Usually we=E2=80=99d use #:autoload, but in cases where we want full control over the process, as in the Disarchive snippet you show above, we=E2=80=99d= use the programmatic interface. There are also cases of =E2=80=9Clazy references=E2=80=9D where we use the = programmatic interface to load things at run time. This is used for instance to keep (guix =E2=80=A6) modules independent of (gnu =E2=80=A6) modules. I hope this sheds some light! >> I was wondering whether we should keep the deprecation warning for =E2= =80=98-r=E2=80=99; >> we might consider it a handy shorthand for =E2=80=98-S nar=E2=80=99? > > Ah, yes. Deprecate '--recursive' but keep '-r' as shorthand for '-S > nar'. LGTM. I=E2=80=99d treat =E2=80=98-r=E2=80=99 and =E2=80=98--recursive=E2=80=99 in= the same way, no? That is, keep them both without a deprecation warning, but document them as aliases for =E2=80=98-S nar=E2=80=99. WDYT? Thanks, Ludo=E2=80=99.