From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.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 AMkRAlgreWLpsgAAbAwnHQ (envelope-from ) for ; Mon, 09 May 2022 16:55:20 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id GL8SAlgreWJ9owAA9RJhRA (envelope-from ) for ; Mon, 09 May 2022 16:55:20 +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 1FD667F79 for ; Mon, 9 May 2022 16:55:19 +0200 (CEST) Received: from localhost ([::1]:43210 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no4n8-0005H0-AN for larch@yhetil.org; Mon, 09 May 2022 10:55:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32822) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no4ms-0005Gl-81 for guix-patches@gnu.org; Mon, 09 May 2022 10:55:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37046) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no4mr-0001N1-U2 for guix-patches@gnu.org; Mon, 09 May 2022 10:55:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1no4mr-00036A-Tr for guix-patches@gnu.org; Mon, 09 May 2022 10:55:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55316] [PATCH v2] scripts: package: Transform before creating manifest entries. Resent-From: Josselin Poiret Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 09 May 2022 14:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55316 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: Josselin Poiret , 55316@debbugs.gnu.org Received: via spool by 55316-submit@debbugs.gnu.org id=B55316.165210808111875 (code B ref 55316); Mon, 09 May 2022 14:55:01 +0000 Received: (at 55316) by debbugs.gnu.org; 9 May 2022 14:54:41 +0000 Received: from localhost ([127.0.0.1]:59176 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1no4mW-00035S-Az for submit@debbugs.gnu.org; Mon, 09 May 2022 10:54:41 -0400 Received: from jpoiret.xyz ([206.189.101.64]:34958) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1no4mF-000354-HK for 55316@debbugs.gnu.org; Mon, 09 May 2022 10:54:38 -0400 Received: from authenticated-user (jpoiret.xyz [206.189.101.64]) by jpoiret.xyz (Postfix) with ESMTPA id 71822184BF2; Mon, 9 May 2022 14:54:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1652108060; h=from:from: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; bh=cXRDT04PPHTWUq5I1f09RzyarUFtYd+01K7FsLwRzxw=; b=n+S9QgzRnmhpPrR+KibRv/TWYgEP7PXvHV+ItgvldFGYJwYYnzw9iPKWqBzZ4JnJ5UlKW2 JyQlAXCOEkdv6QFa+HhH/c1PN3KfbXxQFLV5QmRFhcprwDgSPxza3O75lf0uflJsVXCh0V xJhf36d5vSGy7XcTryao0uZljDWN7ZW4QVLXs3o2xAe/g5n4sbbdJ2SdgGvJi79ufdD7fx eeEeo1iPWjmztvUzbm1TMhGl8/5O7xMlwQHPbTLDlInxAgpfdis6OrwpTEXHXoIFGo27tf 7sON17w+hpIKm9Y2bMi1d6wkg0kHgo5WM3QQFIloY+KFifuHHbT4344B8bPDiw== Date: Mon, 9 May 2022 16:54:10 +0200 Message-Id: <20220509145410.11678-1-dev@jpoiret.xyz> In-Reply-To: <874k1zrq2p.fsf@gnu.org> References: <874k1zrq2p.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spamd-Bar: / 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" Reply-to: Josselin Poiret X-ACL-Warn: , Josselin Poiret via Guix-patches From: Josselin Poiret via Guix-patches via X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1652108119; h=from:from:sender:sender:reply-to: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=cXRDT04PPHTWUq5I1f09RzyarUFtYd+01K7FsLwRzxw=; b=ZY2VKvWDNYB++7of7ymVjhJVqJpRLbiYTfsLocq8S+HU4OYUvLKaMqRPyNF5uAgbQx0rcq Px1ZeA0YJFLqYUN1LGtlwfmjf9y7J5hsApBXrYc5E3K2Ei4pu4MKqrlAt/1OyqTf0O6r+v hV+r0Sh/vQ2uGu9WcHuYPxI6jzZkjqU/kbUEJ7MoMJ0QXxIVmGA+a2SCXjRX2CpDEqjqF4 xZaUSAgG7rzvxHdhdDZthv6vUYPfPxNzJqtdjusn6ymh5Z9L66SZydc8EMUtDEipINcrgp KHojO6Eu6qaccX8dzpP3UI2MQeW8EHF2cWk1oi/6ckwUmY0J5E5CKtDqVBV78g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1652108119; a=rsa-sha256; cv=none; b=JDo9JS5PsvFBkO8lHHJhOuRhZb+9vV0aIs56v0Wls/G33OquA6kGnugIFIRW4HnMn734q6 EEGrwkEaGxyx2MElOLzNIQO9UWfN39AggEzc6nsMsofFHSLxkwMQzmRnmmEynd1uMzf3UN QKsIKWe7PuI2AVK2i5DDqKxxMmV+G3GfWT6D56PY+YylF92xxNZGnIlPOWv7bPekejILkY sHUY3Kk3LAkwwIWePctHTvp1VH0KXXHiSMMep8jxhH2sQVHACv7cmA2idBxYVSl5GC+316 1podixl4IuWDk8ZEVMlCXi6RRt6WtJ8DERkssgL+Prg5QEZ6LXvsZUaQOKaUyA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=jpoiret.xyz header.s=dkim header.b=n+S9QgzR; dmarc=pass (policy=none) header.from=gnu.org; 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: -3.50 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=jpoiret.xyz header.s=dkim header.b=n+S9QgzR; dmarc=pass (policy=none) header.from=gnu.org; 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: 1FD667F79 X-Spam-Score: -3.50 X-Migadu-Scanner: scn1.migadu.com X-TUID: ALEivajbxi9L * guix/scripts/package.scm (options->installable): Add TRANSFORM argument, to be able to directly transform the new packages before creating their manifest entries. (process-actions): Remove transform-entry, and step3, transforming directly in step2. * tests/guix-package.sh: Add test. --- Hello Ludo, Thanks for your review. As mentioned on IRC, those tests don't test process-actions, which is where the logic resides. I added a test to guix-package.sh that follows the original issue instead, note although that between yesterday and today, emacs-consult has changed enough to not compile anymore with `--with-branch=emacs-consult=main` (branch rename notwithstanding). Best, Josselin guix/scripts/package.scm | 36 ++++++++++++------------------------ tests/guix-package.sh | 30 ++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 24 deletions(-) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index d007005607..4673cf18b2 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -10,6 +10,7 @@ ;;; Copyright © 2020 Ricardo Wurmus ;;; Copyright © 2020 Simon Tournier ;;; Copyright © 2018 Steve Sprang +;;; Copyright © 2022 Josselin Poiret ;;; ;;; This file is part of GNU Guix. ;;; @@ -694,10 +695,10 @@ (define (package->manifest-entry* package output) (manifest-entry-with-provenance (package->manifest-entry package output))) -(define (options->installable opts manifest transaction) - "Given MANIFEST, the current manifest, and OPTS, the result of 'args-fold', -return an variant of TRANSACTION that accounts for the specified installations -and upgrades." +(define (options->installable opts manifest transform transaction) + "Given MANIFEST, the current manifest, OPTS, and TRANSFORM, the result of +'args-fold', return an variant of TRANSACTION that accounts for the specified +installations, upgrades and transformations." (define upgrade? (options->upgrade-predicate opts)) @@ -714,13 +715,14 @@ (define to-install (('install . (? package? p)) ;; When given a package via `-e', install the first of its ;; outputs (XXX). - (package->manifest-entry* p "out")) + (package->manifest-entry* (transform p) "out")) (('install . (? string? spec)) (if (store-path? spec) (store-item->manifest-entry spec) (let-values (((package output) (specification->package+output spec))) - (package->manifest-entry* package output)))) + (package->manifest-entry* (transform package) + output)))) (('install . obj) (leave (G_ "cannot install non-package object: ~s~%") obj)) @@ -979,16 +981,6 @@ (define allow-collisions? (assoc-ref opts 'allow-collisions?)) (define profile (or (assoc-ref opts 'profile) %current-profile)) (define transform (options->transformation opts)) - (define (transform-entry entry) - (let ((item (transform (manifest-entry-item entry)))) - (manifest-entry-with-transformations - (manifest-entry - (inherit entry) - (item item) - (version (if (package? item) - (package-version item) - (manifest-entry-version entry))))))) - (when (equal? profile %current-profile) ;; Normally the daemon created %CURRENT-PROFILE when we connected, unless ;; it's a version that lacks the fix for @@ -1021,16 +1013,12 @@ (define (transform-entry entry) (map load-manifest files)))))) (step1 (options->removable opts manifest (manifest-transaction))) - (step2 (options->installable opts manifest step1)) - (step3 (manifest-transaction - (inherit step2) - (install (map transform-entry - (manifest-transaction-install step2))))) - (new (manifest-perform-transaction manifest step3)) + (step2 (options->installable opts manifest transform step1)) + (new (manifest-perform-transaction manifest step2)) (trans (if (null? files) - step3 + step2 (fold manifest-transaction-install-entry - step3 + step2 (manifest-entries manifest))))) (warn-about-old-distro) diff --git a/tests/guix-package.sh b/tests/guix-package.sh index d1b383d2ad..c2f5e39de0 100644 --- a/tests/guix-package.sh +++ b/tests/guix-package.sh @@ -1,6 +1,7 @@ # GNU Guix --- Functional package management for GNU # Copyright © 2012-2022 Ludovic Courtès # Copyright © 2013 Nikita Karetnikov +# Copyright © 2022 Josselin Poiret # # This file is part of GNU Guix. # @@ -210,6 +211,35 @@ test "$(readlink -f "$profile/bin/guile")" \ test ! -f "$profile/bin/sed" rm "$profile" "$profile"-[0-9]-link +# Make sure transformations apply to propagated inputs and don't lead to +# conflicts when installing them alongside, see bug +# +mkdir "$module_dir" +cat > "$module_dir/test.scm" <. -- 2.36.0