From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id KBAcKXJQPWGZVAAAgWs5BA (envelope-from ) for ; Sun, 12 Sep 2021 02:57:22 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 0IfdJHJQPWEkPgAA1q6Kng (envelope-from ) for ; Sun, 12 Sep 2021 00:57:22 +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 DEBD12F039 for ; Sun, 12 Sep 2021 02:57:21 +0200 (CEST) Received: from localhost ([::1]:49556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPDo8-0005mV-V8 for larch@yhetil.org; Sat, 11 Sep 2021 20:57:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPDnq-0005mM-L1 for guix-patches@gnu.org; Sat, 11 Sep 2021 20:57:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58337) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPDnq-0002Nd-EM for guix-patches@gnu.org; Sat, 11 Sep 2021 20:57:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mPDnq-0002Se-Dc for guix-patches@gnu.org; Sat, 11 Sep 2021 20:57: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: Mark H Weaver Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 12 Sep 2021 00:57: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: zimoun Cc: 50515@debbugs.gnu.org Received: via spool by 50515-submit@debbugs.gnu.org id=B50515.16314081989430 (code B ref 50515); Sun, 12 Sep 2021 00:57:02 +0000 Received: (at 50515) by debbugs.gnu.org; 12 Sep 2021 00:56:38 +0000 Received: from localhost ([127.0.0.1]:41650 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPDnS-0002S1-6A for submit@debbugs.gnu.org; Sat, 11 Sep 2021 20:56:38 -0400 Received: from world.peace.net ([64.112.178.59]:49096) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPDnQ-0002Ro-BR for 50515@debbugs.gnu.org; Sat, 11 Sep 2021 20:56:36 -0400 Received: from mhw by world.peace.net with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mPDnJ-0002QN-Ko; Sat, 11 Sep 2021 20:56:29 -0400 From: Mark H Weaver In-Reply-To: <20210911002608.14074-2-zimon.toutoune@gmail.com> References: <20210911002608.14074-2-zimon.toutoune@gmail.com> <20210911002608.14074-1-zimon.toutoune@gmail.com> Date: Sat, 11 Sep 2021 20:54:50 -0400 Message-ID: <87a6kid34a.fsf@netris.org> 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=1631408241; 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; bh=Ay79W8ttfqx90XIXgFiB92iQqX8uobva4D+NJ6OppJ8=; b=fNw/NUj+WbkzEj4nlx2d5BYKayoXtKTwtRqMst9v/xJdTaoRAr0ApLISL8/ynZq4vPiBwF vaodxeZi/0YlljPkhJ3BtgewOV+S+uqnxp4brNIQhsBRf0/McEqn/n206x/g0WB/N0DBQQ J+oIptcd02Y16NwLfH75a8bDeZzCECOU/02sDFTcPuwwHQcOq09YEBEayewbn0s+yBAxWP 1EOown6qZgpqCjjQd51s/gRx1M6djBZZvPqAw5fzRnbSlBcvMgCiQym/+vPHJZsC7xFjoU d9KG4ZJeRB5OC6s9OURImd3mWmLek8MX3wbuxzB6ZsOUoGjwk7aImsj1i2d+Ug== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1631408241; a=rsa-sha256; cv=none; b=DLrzbdlHhcz0Q5eFTY7tcCYQJGPCgwCGEodyf68gDvaeiCS+c+kFbrUeXretep5VonzgVJ 9jRtwPyIDxWD32eA1eQf5q3ViuX3ABoLPo+3XQmE/U9VwF+lWlDOY09uYoN541SM8EzZBA bEvSur209D7lR/uLgq5FUc00QFYLlkF0A4JEbDk4+pc7ovHcRoId+TTEwWxZuOi8RdzQcC scz+li4I3YN8ZUr24OEaCie2GGqsgxXVviVl69zf40UPpr7cmE8YpTe70kqWgxyS9QGyAf gqXQfZgiplsZAveY4yZ38c8Iv5e/VIQAK07ntFq8zssd8kf8UcVWfrjbsV3SXg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=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: -2.41 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=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: DEBD12F039 X-Spam-Score: -2.41 X-Migadu-Scanner: scn0.migadu.com X-TUID: vg6KzoOSQfRh Hi Simon, > With Guix 9875f9bca3976bf3576eab9be42164fde454597e, the packages consider= ed > are IceCat and the Linux kernel; see: gnu/packages/gnuzilla.scm and > gnu/packages/linux.scm. > > * website/apps/packages/builder.scm (gexp-references): Unexported variable > from the module '(guix gexp)'. > (origin->json): Add 'computed-origin-method' case. Thanks for working on this. > diff --git a/website/apps/packages/builder.scm b/website/apps/packages/bu= ilder.scm > index fb53215..ecf958a 100644 > --- a/website/apps/packages/builder.scm > +++ b/website/apps/packages/builder.scm [...] > @@ -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. 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. 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. 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 s= imilarly for 'linux-libre'. I'm sorry that I never found the energy to clean this up properly. 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. (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))) What do you think? I'm not on the guix-patches list, so please CC me on replies that you'd like me to see. Thanks, Mark --=20 Disinformation flourishes because many people care deeply about injustice but very few check the facts. Ask me about .