From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id MDaINE57NWMugAAAbAwnHQ (envelope-from ) for ; Thu, 29 Sep 2022 13:02:38 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 4KRVNE57NWP7agAAauVa8A (envelope-from ) for ; Thu, 29 Sep 2022 13:02:38 +0200 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 75159B3C3 for ; Thu, 29 Sep 2022 13:02:38 +0200 (CEST) Received: from localhost ([::1]:58896 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odrJ2-0008Cz-91 for larch@yhetil.org; Thu, 29 Sep 2022 07:02:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58022) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odrHs-0008Bo-MJ for guix-patches@gnu.org; Thu, 29 Sep 2022 07:01:13 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37213) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1odrHq-00014a-KG for guix-patches@gnu.org; Thu, 29 Sep 2022 07:01:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1odrHq-0002k1-Fl for guix-patches@gnu.org; Thu, 29 Sep 2022 07:01:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58032] [PATCH] transformations: '--with-source' now operates in depth. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 29 Sep 2022 11:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58032 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxim Cournoyer Cc: 58032@debbugs.gnu.org, 43193@debbugs.gnu.org, philippe.swartvagher@inria.fr Received: via spool by 58032-submit@debbugs.gnu.org id=B58032.166444921810410 (code B ref 58032); Thu, 29 Sep 2022 11:01:02 +0000 Received: (at 58032) by debbugs.gnu.org; 29 Sep 2022 11:00:18 +0000 Received: from localhost ([127.0.0.1]:36274 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odrH7-0002hl-Jt for submit@debbugs.gnu.org; Thu, 29 Sep 2022 07:00:18 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:18661) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odrH2-0002g3-9p; Thu, 29 Sep 2022 07:00:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version:content-transfer-encoding; bh=U1y4OIKBNp79oujF4G7lvLRBltc7lICmdQqbh0gIJtI=; b=W6gZjpNJdxsprarKK0Maajhd2U5jC9eK6mVsdkslLKlEA7okGdT92CTc ELKZxHMKU1OY1MrAafFj+3IGzcY490Lcpfa/+mbcsntV1PCW5E/bwfeCG VfJzXyq1v0VdPu1cmw1tU4eTAuBE285h1nn/Bqqzi6u461NsBT7h9l7UC Q=; X-IronPort-AV: E=Sophos;i="5.93,354,1654552800"; d="scan'208";a="25006377" Received: from 91-160-117-201.subs.proxad.net (HELO ribbon) ([91.160.117.201]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2022 13:00:04 +0200 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20220923204208.31957-1-ludo@gnu.org> <87fsgbwiog.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Octidi 8 =?UTF-8?Q?Vend=C3=A9miaire?= an 231 de la =?UTF-8?Q?R=C3=A9volution,?= jour de l'Amarante 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: Thu, 29 Sep 2022 13:00:04 +0200 In-Reply-To: <87fsgbwiog.fsf@gmail.com> (Maxim Cournoyer's message of "Wed, 28 Sep 2022 12:46:39 -0400") Message-ID: <87h70qcuob.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (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 X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1664449358; 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=U1y4OIKBNp79oujF4G7lvLRBltc7lICmdQqbh0gIJtI=; b=dPMDNV303yUZ1m/daMuKCeJkiP+R6tFjjRVChjtAe9gBS8Ux1OIr+qF+iBQsEeuYtbX0LQ DqhUAZIgyin6DtOUayOdVOGawof0b+S9hWny1BYXS1TiAPzRIsPCrqDK6ZVtPPFSLYTMiy Z7Ic35YDyaDbJ+OkIloTMYf76CPNPQGaRaieGRR/6n8OS6qekFyvaI+vS3PfGJQKFqONL4 0Z2PVKUjRjC2Y8LtkirkaMre6avFLOTr/6ik0Bn+SR1Rq1EAMWNgj5hHUO4lXhBODVoQqX toa9C2im6Lf4lKbmj5x1MgrxypEbV7YhIQx2J+XFt0ibrBlterRrGdNE2OkI4A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1664449358; a=rsa-sha256; cv=none; b=D9IE8ikCzcNHrVE3Vl6eorOanLRP1EXLwmJBYM0amvSawAfWrTG1O1ZGZCmIX8RzUCud9y rJaTvx7dMhQag/jxhc/3Dfs2SAkyZ5LCNfBNcokLuw98qHOgKjM9ZmztOCXeY6s/nJFIOu JURgDqn5KA/2ysZ2vEGeNd+tVS0H9Eok2lKo09/VGE2psVtnKWWK4OXejg18TAPPznaSDw 5pM1ZZAbpx1wc5d1v6U/hUWCwe3P4g8TMO1m1AD87wh1rELn1lqn0jad2YMwow45GGrHF0 8mj7Q+4kVG8nZhv5YJZoqer5wECpCXT+lY8MfWBiijO5HaFW7s0A/LzlAtQo4w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=inria.fr header.s=dc header.b=W6gZjpNJ; dmarc=fail reason="SPF not aligned (relaxed)" header.from=inria.fr (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 8.36 X-Spam: Yes Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=inria.fr header.s=dc header.b=W6gZjpNJ; dmarc=fail reason="SPF not aligned (relaxed)" header.from=inria.fr (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 75159B3C3 X-Spam-Score: 8.36 X-Migadu-Spam: Yes X-Migadu-Scanner: scn0.migadu.com X-TUID: FjKL0CT7gdL2 Hi Maxim, Maxim Cournoyer skribis: >> + (name (hyphen-package-name->name+version base))) >> + (cons name >> + (lambda (old) >> + (package-with-source old uri))))) >> + ((spec uri) >> + (let-values (((name version) >> + (package-name->name+version spec))) > > You usually recommend (srfi srfi-71) when using multiple values; why not > use it here? I don't have a preference myself (I find srfi-71 > surprising for the non-initiated (I was), although I like its simple > interface! :-)). This file is still on SRFI-11 so I followed that, but now that you mention it, I=E2=80=99ll switch it to SRFI-71 in a subsequent commit. :-) >> (test-assert "options->transformation, with-source, no matches" >> - ;; When a transformation in not applicable, a warning must be raised. >> (let* ((p (dummy-package "foobar")) >> (s (search-path %load-path "guix.scm")) >> (t (options->transformation `((with-source . ,s))))) >> - (let* ((port (open-output-string)) >> - (new (parameterize ((guix-warning-port port)) >> - (t p)))) >> - (and (eq? new p) >> - (string-contains (get-output-string port) >> - "had no effect"))))) >> + (eq? (package-source (t p)) >> + (package-source p)))) > > I'd personally find it a better interface if it failed noisily when > --with-source doesn't have any effect. The warning was of little use > because it got lost in the other outputs; now it would be totally > silent, right? Yes, it=E2=80=99ll be silent now, as with the other options. That=E2=80=99s not great; the problem is that it=E2=80=99s impossible to te= ll whether a package variant differs from the original one until they=E2=80=99ve been lo= wered to a bag (or a derivation). >> +(test-assert "options->transformation, with-source, in depth" >> + (let* ((p0 (dummy-package "foo" (version "0.0"))) >> + (s (search-path %load-path "guix.scm")) >> + (f (string-append "foo@42.0=3D" s)) >> + (t (options->transformation `((with-source . ,f)))) >> + (p1 (dummy-package "bar" (inputs (list p0)))) >> + (p2 (dummy-package "baz" (inputs (list p1))))) >> + (with-store store >> + (let ((new (t p2))) >> + (and (not (eq? new p2)) >> + (match (package-inputs new) >> + ((("bar" p1*)) >> + (match (package-inputs p1*) >> + ((("foo" p0*)) >> + (and (not (eq? p0* p0)) >> + (string=3D? (package-name p0*) (package-name p0= )) >> + (string=3D? (package-version p0*) "42.0") >> + (string=3D? (add-to-store store (basename s) #t >> + "sha256" s) >> + (run-with-store store >> + (lower-object >> + (package-source p0*)))))))))))))) >> + > > The recursive? option should probably be #f in the add-store above, > since the "dummy" source is a single file. No, it must be #t because that=E2=80=99s also how the transformation intern= s the file (the option is called =E2=80=9Crecursive?=E2=80=9D but it has little t= o do with recursive directory traversal and more to do with the serialization format.) > It may be better to create the dummy file ourselves instead of relying > on the existence of a 'guix.scm' one (it'd help clarify the test too, > that bit was a bit mysterious at first). Right, we could do that but that=E2=80=99s a tiny bit more verbose. Here I followed what existing tests do; perhaps we should plan for a face lift of some of these tests. Thanks for your feedback! Ludo=E2=80=99.