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 gKi9I18jOWG8JgAAgWs5BA (envelope-from ) for ; Wed, 08 Sep 2021 22:55:59 +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 EP3DH18jOWEAewAAB5/wlQ (envelope-from ) for ; Wed, 08 Sep 2021 20:55:59 +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 E41F7CAA for ; Wed, 8 Sep 2021 22:55:58 +0200 (CEST) Received: from localhost ([::1]:42350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mO4bt-0008QJ-WA for larch@yhetil.org; Wed, 08 Sep 2021 16:55:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43352) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mO4be-0008Q7-T5 for guix-devel@gnu.org; Wed, 08 Sep 2021 16:55:43 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:33524) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mO4bd-0007aQ-O7; Wed, 08 Sep 2021 16:55:41 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=35422 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mO4bU-0001cB-HO; Wed, 08 Sep 2021 16:55:39 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: zimoun Subject: Re: Transform options should error on nonexistant targets References: <86pmu1qz2f.fsf@gmail.com> <87a6kv5m1q.fsf@gnu.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 22 Fructidor an 229 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: Wed, 08 Sep 2021 22:55:30 +0200 In-Reply-To: (zimoun's message of "Thu, 2 Sep 2021 12:50:02 +0200") Message-ID: <8735qe23el.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: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "guix-devel@gnu.org" Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1631134559; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=epynzhDJ2AX/ScvOb0wIGosegsr5lo+ku6xxxImKyCg=; b=P1JWNhXU9YALPJ80wTfQP5wasjJXcKPl2CT+eAD+RgiRSNYpVNnf2Okhv3LUZfsJ0abHYZ 06Z2/PxBe5S67pcWhdw6jQcCyt6e9pEZ49pKfm3IGtnPAvi1rQW6veWISWtXPERFk2GWgY r3G9hfqeTtXjuBLsbkTBU7TJCijPHZTZG2cmQUqjkw2K3XmYy8pvnhq2+iWd2Ohz+jaW6c IuprsKTzgExPOcsOWa0w7evLx3z3PpmJMG304HzVtCzyM3DobuCex6Syy0FLtzHwoc9Ua3 8SgZj078M4urRlE9dcbJF2kB42+2NuZLJaLyJY7aX9uGonlI9IvmKxOHiLTJxA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1631134559; a=rsa-sha256; cv=none; b=nnYQXpg0+1dU9Mqe93oLk7diZgDtKEV7+Kd0fLuLrZMHJEwmcLV77KUdgfOL9IvkR//wUe 6cHMSbL9zOKihQ7j1aFoOhnnv34q8obo9aLAF0x+ViDhIFwTOK5FhAgrquFsL4KezBgVs9 YJ9x4xlgYMciUvMcB2cleK/2fAt+hAWgDePcQKr7ScGHybMXM7LlK0E0w0x+0kSFrfCwc1 ZqO4ll2r6SCIRdBdEwj5l2IdCRhthsow6/m7W7iXblu9JZ1gAlPxk1QVbQ64ITvMOybJmV F88HeM+4k5hy3JCRNVxn9TQMbzGVHW7+1uyvVNI2HpMrfLdedVPGcefq/SMtEA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Spam-Score: -2.91 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Queue-Id: E41F7CAA X-Spam-Score: -2.91 X-Migadu-Scanner: scn1.migadu.com X-TUID: XlJTHfUGFoCH Hello! zimoun skribis: > However, from my opinion, it is easy to check if the package-target is > a package or not, i.e. > > $ guix build foo --=3Dpackage-target=3Dnew > guix build: error: package-target: unknown package > > For instance by using 'specification->package'; see attached patch. > But then, the test suite fails; I guess because 'dummy-package' and I > have not found the time to investigate. From my point of view, this > kind of patch will fix one part of the initial issue reported by Ryan. Right. > The other issue is to list if the transformation is applied or not. I > think it is possible by traversing again the graph and check if a > property appears at least once; well it should be better to warn if > the 'mapping-property' is not found at least once. I had some > headaches to implement it... and I moved to other "urgent" stuff. :-) Hmm the =E2=80=98mapping-property=E2=80=99 is not enough. I think you pret= ty much have to compute the derivations of the new and old packages and compare them. > Last, speaking about transformations, the graph is walked too much > when several transformations is applied: > > guix build hello --with-latest=3Dfoo --with-input=3Dbar=3Dbaz --with-l= atest=3Dchouib > > then the graph is walked 3 times, IIUC. The options needs a rewrite > to pass a list of specs to 'package-with-latest-upstream' and not > twice a list with only one element. This would reduce to 2 walks. > Then it could be nice to compose the transformation and then walk only > once (apply 'package-mapping' only once). > Well, maybe I miss something. Right, I guess it could work. It=E2=80=99s the same complexity anyway, but= at least it would lower the constant costs. > From c0fa86d316c91044630b85c9e789f9a455fd29f4 Mon Sep 17 00:00:00 2001 > From: zimoun > Date: Fri, 27 Aug 2021 18:15:16 +0200 > Subject: [PATCH] transformations: Error when incorrect specifications. > > * guix/transformations.scm (transform-package-with-debug-info, > transform-package-latest, transform-package-tests)[rewrite]: Raise when > incorrect specification. > (options->transformation)[package-name?]: New procedure. > [applicable]: Use it. [...] > - (package-input-rewriting/spec (map (lambda (spec) > - (cons spec package-with-debug-i= nfo)) > - specs))) > + (package-input-rewriting/spec > + (map (lambda (spec) > + (match (string-tokenize spec %not-equal) > + ((spec) > + (cons spec package-with-debug-info)) > + (_ > + (raise > + (formatted-message (G_ "~a: invalid specification") spec= ))))) > + specs))) >=20=20 > (lambda (obj) > (if (package? obj) > @@ -451,9 +458,15 @@ to the same package but with #:strip-binaries? #f in= its 'arguments' field." > ((#:tests? _ #f) #f))))) >=20=20 > (define rewrite > - (package-input-rewriting/spec (map (lambda (spec) > - (cons spec package-without-test= s)) > - specs))) > + (package-input-rewriting/spec > + (map (lambda (spec) > + (match (string-tokenize spec %not-equal) > + ((spec) > + (cons spec package-without-tests)) > + (_ > + (raise > + (formatted-message (G_ "~a: invalid specification") spec= ))))) The goal here is to catch mistakes like =E2=80=98--with-debug-info=3Dfoo=3D= bar=E2=80=99, right? Is that a plausible typo? :-) > Each symbol names a transformation and the corresponding string is an ar= gument > to that transformation." > + (define (package-name? value) Rather =E2=80=98assert-package-specification=E2=80=99, since it=E2=80=99s u= sed for control effects (exception raised by =E2=80=98specification->package=E2=80=99). > + ;; Return an error if value does not correspond to a package. > + (match (string-tokenize value %not-equal) > + ((name _ ...) > + (specification->package name)))) The problem I see is that it prevents rewrites where the package to be rewritten is not public. Maybe that=E2=80=99s an acceptable tradeoff thoug= h, I=E2=80=99m not sure. Thoughts? Thanks, Ludo=E2=80=99.