From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id aB8UD4lkfWFoMgEAgWs5BA (envelope-from ) for ; Sat, 30 Oct 2021 17:28:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 0DihColkfWFdfQAAbx9fmQ (envelope-from ) for ; Sat, 30 Oct 2021 15:28: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 DB6391BA8F for ; Sat, 30 Oct 2021 17:28:08 +0200 (CEST) Received: from localhost ([::1]:46530 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mgqH9-00032w-Dk for larch@yhetil.org; Sat, 30 Oct 2021 11:28:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgqH4-00032n-1T for guix-patches@gnu.org; Sat, 30 Oct 2021 11:28:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46621) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mgqH3-0004EK-PJ for guix-patches@gnu.org; Sat, 30 Oct 2021 11:28:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mgqH3-00051C-M8 for guix-patches@gnu.org; Sat, 30 Oct 2021 11:28:01 -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: 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-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=1635607689; 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=v+Ibs/l/f+XV1/PwBR1Z0B0FiXxQDSMX9HEqpW8qAgc=; b=g1gGEeJcdMzQVpqri6TUpk89cH0rcjrpapV2rQPJYNmwsE0WQhPPquIvW2DvRBmcFgemfA tcCdprgjW2W8+yVFQlmkLWpMlYuoz/xrYUerxaupooaGDrar+oPf9Ev1CppvlTNi5u3Zki DWHuAQ2v/iDIDxFkjvtfe9snW4g+oNSCxLzMDjtmKRgKKtlTSrYsdW10YTzQG/fmISVFQN YqfSvf97iCu+D513RKAe9rGpa/uTsFUDgoFLLn0oHIXivcAfJPOHq8DbG06MqmSIUXdAW0 orEvS+wn/iFOwBdHLEgrybuoCQFvxdZ7zae5D61QJl4EdlY3my8n/iBeVdzfbA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1635607689; a=rsa-sha256; cv=none; b=pCj1AU9zwg34LkTqVgCrYdrUQ8nACl3+5r6evdkZDftAKNk8k+BQ+YOiCeLemgG35F0SEH gtSxdkpszB2k/DhAe5r61KTea6ABx41ofOFGgPE4l0YcpluzrfChbiWpKfnTAjAePFwYb1 jW/Bhv3SJu0i3yahV3qa34zvlqzq4oxKahtDK93N5KnDdknzkbxUNBhWEa17HD10+yTvmx oGOOnsXx/cgzBwDhQRMIp60Rd/cZ1GWG1vtMfCo0FbHuCV0F7umNf6rYfHH+A3ci+wKhPm e8ML+CrvgBK6LfdRXowG+wOtccrqapKXTSBVcdLnc0FhW76vH9+Gvs610TqoHw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=CY6C5gki; 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.32 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=CY6C5gki; 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: DB6391BA8F X-Spam-Score: -1.32 X-Migadu-Scanner: scn0.migadu.com X-TUID: 7KLSiu+/BNw7 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