From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id cMn/FgJJcGFwuwAAgWs5BA (envelope-from ) for ; Wed, 20 Oct 2021 18:51:14 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id KOyrEgJJcGEDdAAAB5/wlQ (envelope-from ) for ; Wed, 20 Oct 2021 16:51:14 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3B47EABFC for ; Wed, 20 Oct 2021 18:51:12 +0200 (CEST) Received: from localhost ([::1]:46102 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdEo2-0000Dp-Nc for larch@yhetil.org; Wed, 20 Oct 2021 12:51:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdEnu-0000De-P4 for guix-patches@gnu.org; Wed, 20 Oct 2021 12:51:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:43801) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mdEnu-0003mT-GV for guix-patches@gnu.org; Wed, 20 Oct 2021 12:51:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mdEnu-0007MM-2l for guix-patches@gnu.org; Wed, 20 Oct 2021 12:51:02 -0400 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1634748672; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=hl4YRx3tRT2y77Hxao98lVhlM9QWSE6hlk1KGV/G+vg=; b=ssiNSU5CXxZorDV7f5HzfZ9rl6jOtmOTRgXdpegkkU6/cETM3phQ/uPGlXD8LTcfDKPqsJ o0IxZ3oMqs93FBgcTpVeXCmBN9AiG0CQxz1oCTtWRuQCknDJcIfYKC+8TzoinBlRVuUYhQ hGjk5DkGgLvHZQ6qV+rric0f+ZmSbGMxaYbR5a2SFuMG88x/7i0/VtwlPliUEGarNZolRf t9E+/T8v4TEMbfBgpfseDnIBkB34uQe9f4YdVYfeYBQLYoY6Wm/RM0Pgioni5QLVkEMAAM /4fAKEAuDevQ9xSnLfnjz7MeoUOcnii4VmiCJY6FHs2uiJL/jvvonn0Mli+3OQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1634748672; a=rsa-sha256; cv=none; b=hUy2Mh13egF8TB0m+Dlu0bChjAWcFVP10DK7h+IbiUNrWwsJl37fdH7U0RL8Xx8G+dmtye hEP4Xn/dFS7GnNFFXPsfbceh7uH1wxW4lQfRapcH9Kzh6mVUT0pxOsjlM25mx9KZtUhSnM S7fFRhCRglAhDU9lJd4xTAMapPZKmcNxjX5KbKZnQ6NgXf8Wby8Y5RoZeiWvx4UF0h2s5G Bp73kTnNfu4ac2M8QaZeo+n1yAzvhXUQS0A3wdtw/CxMDc0rirOUBB3yvgrAzHcO0ysE/+ 085nM9sEGZkkb+lQhJYRgJpIA4uFTPthli0FfYrl/FqruLJqQIcBIhYgmpqI7A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=qY6lSHs+; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -1.93 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=qY6lSHs+; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 3B47EABFC X-Spam-Score: -1.93 X-Migadu-Scanner: scn1.migadu.com X-TUID: S229GsHcLSCV 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