From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id oPMaH1mifmEOiQAAgWs5BA (envelope-from ) for ; Sun, 31 Oct 2021 15:04:09 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id YJ3TGlmifmGYEwAA1q6Kng (envelope-from ) for ; Sun, 31 Oct 2021 14:04:09 +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 E919529668 for ; Sun, 31 Oct 2021 15:04:08 +0100 (CET) Received: from localhost ([::1]:36818 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhBRP-0000Wn-JD for larch@yhetil.org; Sun, 31 Oct 2021 10:04:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59360) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhBRK-0000Wc-GC for guix-patches@gnu.org; Sun, 31 Oct 2021 10:04:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49416) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhBRK-0003eE-7U for guix-patches@gnu.org; Sun, 31 Oct 2021 10:04:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mhBRK-0001WZ-3Y for guix-patches@gnu.org; Sun, 31 Oct 2021 10:04:02 -0400 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-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=1635689049; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=7dEW5Ustj2akb5TApah1PlVOPFtyPu+oRCVzbgjkoa4=; b=SR+4LFJQO5qgOKO0XD9Y2lQNjx5hHZwnw3aVsaF2j7aIG76F7r1JAUyUir8+cPywAjRP1o hQNqzRhjjkx1zBqC3BIbkQRK5YEqRdcdn7C/GurAmUrx88sRA6+E2ARj6N6b7WsAswFYMs G7Et8j6ud0mmbAs3a1HoUhb210kWzUrQg2+uIsoUB7ZOiw8MxsSeAGxmCbO9tB4d922QWY Xp9h2sll1yZNUdlQm7QnP+2RIa3q2gjs/OqSSMFJK+1WdH86/gCPboMbyuyeUCYfgrYzxO 8qRN6YItU6yCFPX1nZmejoQply3Amn2g/nipRAgZguwJmZdDeTK8lvdRvD4myA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1635689049; a=rsa-sha256; cv=none; b=Bnqk6cRJez1yDcJobMwwQDytx3o6qDcq0CCd2rrqEdj+MBlxoPb73/L2vz5B0XZm6URabn ahIOgR4n8nyXenMDa1M+C9FgyhUzlUZw0u55ruhN8UqPpBMJbFisdpwt/RFNFyNy+OKVlt SsjBJPnqe/IhjFz2JuuL03ussnh22jcRpwVlYx4X8n7PdHx44l+eT+0IcjBGzlr9iiOZIa OUDFonIE5TcsxcjCNqITzplydKvG3XdcrUyq0wRZzrR5GNnUQCanbL3C9hHRFNieBz5w9k 98vLg2fsFdxfk8MbAbaoNL9wOXZ6VsvMPJDiUa71awK6uONYURMXYiuSnZc+0Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=n9OoVMxy; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -1.42 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=n9OoVMxy; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: E919529668 X-Spam-Score: -1.42 X-Migadu-Scanner: scn0.migadu.com X-TUID: RhKvxaUrqbv2 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.