From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id OH91LWz7PmEU9wAAgWs5BA (envelope-from ) for ; Mon, 13 Sep 2021 09:19:08 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id OD0bKWz7PmHxdwAAB5/wlQ (envelope-from ) for ; Mon, 13 Sep 2021 07:19:08 +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 550E913433 for ; Mon, 13 Sep 2021 09:19:07 +0200 (CEST) Received: from localhost ([::1]:44522 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPgF8-0005V7-25 for larch@yhetil.org; Mon, 13 Sep 2021 03:19:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41258) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPgF4-0005Uz-S9 for guix-patches@gnu.org; Mon, 13 Sep 2021 03:19:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60733) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPgF4-00046v-K2 for guix-patches@gnu.org; Mon, 13 Sep 2021 03:19:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mPgF4-0008Bj-Fv for guix-patches@gnu.org; Mon, 13 Sep 2021 03:19:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50515] [PATCH 2/2] website: Add 'computed-origin-method' packages to 'sources.json'. Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 13 Sep 2021 07:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50515 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mark H Weaver Cc: 50515@debbugs.gnu.org Received: via spool by 50515-submit@debbugs.gnu.org id=B50515.163151748831415 (code B ref 50515); Mon, 13 Sep 2021 07:19:02 +0000 Received: (at 50515) by debbugs.gnu.org; 13 Sep 2021 07:18:08 +0000 Received: from localhost ([127.0.0.1]:44046 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPgEC-0008Ac-7I for submit@debbugs.gnu.org; Mon, 13 Sep 2021 03:18:08 -0400 Received: from mail-wr1-f43.google.com ([209.85.221.43]:45036) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPgEA-0008A0-4u for 50515@debbugs.gnu.org; Mon, 13 Sep 2021 03:18:07 -0400 Received: by mail-wr1-f43.google.com with SMTP id d6so12987332wrc.11 for <50515@debbugs.gnu.org>; Mon, 13 Sep 2021 00:18:06 -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=xUrpcfKSMj7qsgl07P2WZGhe3zeTvNKbk9O3k2i0J8E=; b=kD/bys02EEOwuNM2ZxzrddoBTXszSERDXsypfHk3GeuUWHtJi7Y/2h5cYlJxHVpxFz 7MUSS2FpCjl4nRmRmLvGVjaZtK63GEX859vrVLFYwk/AgDahD/IF3ZpsqNXQhIR6ywKm GsEx9l/bjoqfwYcEarBPZ8nqCZ7m/mvOjON1fDMBra93LApXPAHMdGYI5X5FAKeMkXP9 WPv/qgRcE9GVh3e/ohvUIlguyHtu2ygYpk0xPA0PNt/JZIsHhoCWwMVXf690mCACzAIy EMa9vLp7ln1jxANvDZ5ea0RHG/cj4mdh/zMnvFXL3JiiSDiQYij1zCIyANbhPXfFr/lx VBIw== 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=xUrpcfKSMj7qsgl07P2WZGhe3zeTvNKbk9O3k2i0J8E=; b=2kCn/4abz5hRsI6tBRvDuZinpbHx9SaDnGYROu2k3sjUGipZLlilwzIN1lIidiuHE9 1dcmZASoLzkMHUY1wJio1OAhguFcyC1OQOn67aSX0IuY5g5HAlNkPEGy4IkMNC82mdBR TPrKHtumCjcCL7dh9GzINGHA0iEspa2IYJT6G4Ggdgw/Oo1QFMrlpOToROW+d0zj3SCg K2Gtq5YGGnSFtCk2fAYg0xYmhzjtKS3MwinuUy2O8AC1cr8YMzPgnKj4m5IoQShqxW3d zp2/q4l7n1bgTChR+ozeVP9sSBIvk/xM8nyUOtE0opDEY/IkZnUmj5WOuWQfxn0LuyCC L+Sw== X-Gm-Message-State: AOAM531klYXLqgFMvO9RocuEBahHpVM4jqBJ3HvOOy917RRluTcV1Qc0 J0bkeV6BM4ncKYfr3usmjOPG1sbjMEs= X-Google-Smtp-Source: ABdhPJyTojq+8BSO/eUmOD5WeCWeaO3Uj2cJwobm3etWXq6FjPLLaV06CHx63xQ/w5GMAdnY1t7h+Q== X-Received: by 2002:a05:6000:1627:: with SMTP id v7mr11048543wrb.347.1631517480023; Mon, 13 Sep 2021 00:18:00 -0700 (PDT) Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id u13sm6441667wrt.41.2021.09.13.00.17.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 00:17:59 -0700 (PDT) From: zimoun In-Reply-To: <87a6kid34a.fsf@netris.org> References: <20210911002608.14074-2-zimon.toutoune@gmail.com> <20210911002608.14074-1-zimon.toutoune@gmail.com> <87a6kid34a.fsf@netris.org> Date: Mon, 13 Sep 2021 09:01:45 +0200 Message-ID: <865yv5vu06.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=1631517547; 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=xUrpcfKSMj7qsgl07P2WZGhe3zeTvNKbk9O3k2i0J8E=; b=ZofaBF8ZqxRSMxwPJubfJDL5PPpcV5s/dG4fzknzEsmXwFBVhdhg6kFRFytNUhciWlg+EW R2ISE5l6fCe7J+Qcn6j4JJSM2vXw/PqPQU+KwkPBgkHuqIEZoYWvGbKKIlSqoNKpYrZio2 nyqKRso7+MAwuV0xBbh2SGDv2xhs9ZLWEZrUtdXMZrwYJGi7IScOjYKj5t7pRPMqUABZWX dk0c2kpCQwHX95q2zeig6c7fsReb3HvuTINEBSdMa0errrNCjt95NfQ8gUfl0Bf/CB/pW2 0f8QGAnkPRIjTBOWCD+1rsJlUNWFe2XBoCceXb+ZIZ43UtAV3WOSpC8g3okeXA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1631517547; a=rsa-sha256; cv=none; b=JLPO2d8zOdPa3e4g+LxLGanpdsvmZOWGaTLds67FsTeAlBTJYNiHYZWKGytpY+X68L7gPv /ovp3YsAYUFNTyrnuCXB4whQ/yLmiIYnoB8ZDvrobUGL6aNDPWSmrQAZ3WYVIMNJrWNZ9s x12q9ALagdCf4YVIV3hZU4ttyo8WOlvn4vHWh9QMqXC1L6YnXyYAwKSKZ7PKHkNxyuP9up I5J8riGCqvPlPwl+CW4XvtKKm/hLa1yvu2Rm89l0Dfx7hvWF2yq4dXDjU4NdizFz4s5IcL Z7UPU/QMnyCTjsRDiXE7NIvUAxiMCK81+VDRjQIx71MCneTAamajmtHdTHNMcw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b="kD/bys02"; 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: 0.19 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b="kD/bys02"; 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: 550E913433 X-Spam-Score: 0.19 X-Migadu-Scanner: scn0.migadu.com X-TUID: 8mYtdJ4hGv65 Hi Mark, Thanks for looking at the patch and for your inputs. On Sat, 11 Sep 2021 at 20:54, Mark H Weaver wrote: >> @@ -106,53 +109,67 @@ >> (append-map (cut maybe-expand-mirrors <> %mirrors) >> (map string->uri urls)))) >>=20 >> - `((type . ,(cond ((or (eq? url-fetch method) >> - (eq? url-fetch/tarbomb method) >> - (eq? url-fetch/zipbomb method)) 'url) >> - ((eq? git-fetch method) 'git) >> - ((or (eq? svn-fetch method) >> - (eq? svn-multi-fetch method)) 'svn) >> - ((eq? hg-fetch method) 'hg) >> - (else #nil))) >> - ,@(cond ((or (eq? url-fetch method) >> + (match uri >> + ((? promise? promise) ;computed-origin-method >> + (match (force promise) > > Here, you're implicitly assuming that 'computed-origin-method' is the > only origin method that puts a promise in the 'uri' field. That may be > true today, but it will not necessarily be true tomorrow, and therefore > it seems suboptimal to make that assumption in the code. Yes, I agree. My initial draft contained something as your wrote below: (or (eq? method (@@ (gnu packages gnuzilla) computed-origin-method)) (eq? method (@@ (gnu packages linux) computed-origin-method))) but then, I thought it was a redundant test because then the promise check is necessary to unwrap the values of embedded origins. And currently, all the 'computed-origin-method's use a promise. > Instead, I would suggest checking for "computed origins" in the same way > that is done for the other cases: using 'eq?'. It's not ideal, but it's > more future-proof than checking for a promise in the 'url' field, and > anyway it's the way things are currently being done. I cannot predict the future but the check about the method is as suboptimal as mine. :-) If another package uses computed-origin-method, then it should be added here. However, from my understanding, there is an higher probability that this hypothetical packages would use a promise. > However, there's a difficulty, and I suspect you're already aware of it > and that it's why you used the suboptimal approach above: > > At present, 'computed-origin-method' is not exported by any Guix module, > nor is there even a unique definition of it. Instead, there are two > copies of it, one in gnuzilla.scm and one in linux.scm. Yes. :-) > The reason 'computed-origin-method' is not exported is because it never > went through the review process that such a radical new capability in > Guix should go through before becoming part of it's public API. > > At the time that I added 'computed-origin-method', I was under time > pressure to push security updates for IceCat, and my previous method of > cherry picking dozens of upsteam patches and applying them to the most > recent IceCat release suddenly became impractical due to comprehensive > code reformatting done upstream. > > I've always viewed 'computed-origin-method' as a temporary hack to work > around limitations in the 'snippet' mechanism. Most importantly, last I > checked, it was not possible for a 'snippet' to produce a tarball with a > different base name than the original downloaded source. I consider it > a *requirement* for the 'icecat' source tarball and it's unpacked > directory to be named "icecat-=E2=80=A6" and not "firefox-=E2=80=A6", and= similarly for > 'linux-libre'. Thanks for explaining. > Anyway, regarding your proposed patch: for now, I would suggest the > following options: > > (1) In a separate preceding commit, move 'computed-origin-method' to its > own module, export it, use the exported one in gnuzilla.scm and > linux.scm, and use 'eq?' to test for it in the code above. There > should probably also be a comment next to the definition of > 'computed-origin-method' pointing out that it's a temporary hack, > hopefully to be superceded by snippets when they have gained the > required functionality. I think it is the better approach. Move the =E2=80=99computed-origin-metho= d=E2=80=99 procedure to (guix packages) and export it; add a comment about it. However, I would not like that the sources.json situation stays blocked by the computed-origin-method situation when sources.json is produced by the website independently of Guix, somehow. :-) Therefore, there is an option (3). Move the =E2=80=99computed-origin-method= =E2=80=99 procedure to (guix packages) and add a comment about it; use it for icecat and linux with (@@ (guix packages) computed-origin-method). WDYT about this (3)? It simplifies this patch and let the time to discuss the =E2=80=99computed-origin-method=E2=80=99 case without exposing = it to the public API. > (2) Alternatively, for now, use 'eq?' against the two private copies > (accessed using @@, see below), along with a "FIXME" comment. > > ___ (or (eq? method (@@ (gnu packages gnuzilla) computed-origin-method)) > _______ (eq? method (@@ (gnu packages linux) computed-origin-method))) I commented above why I am not convinced that is better than directly check the promise. I do agree with the FIXME comment; the commit message is not enough here. Cheers, simon