From patchwork Sun May 8 14:16:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Josselin Poiret X-Patchwork-Id: 39156 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 0CBB527BBEA; Sun, 8 May 2022 15:17:16 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 63F0E27BBE9 for ; Sun, 8 May 2022 15:17:15 +0100 (BST) Received: from localhost ([::1]:54736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnhik-0000IX-Jd for patchwork@mira.cbaines.net; Sun, 08 May 2022 10:17:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38882) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnhiY-0000IL-Rn for guix-patches@gnu.org; Sun, 08 May 2022 10:17:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:32846) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnhiY-0001rU-JA for guix-patches@gnu.org; Sun, 08 May 2022 10:17:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nnhiY-0005H1-Er for guix-patches@gnu.org; Sun, 08 May 2022 10:17:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55316] [PATCH] scripts: package: Transform before creating manifest entries. Resent-From: Josselin Poiret Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 08 May 2022 14:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 55316 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55316@debbugs.gnu.org Cc: Josselin Poiret X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.165201939919056 (code B ref -1); Sun, 08 May 2022 14:17:02 +0000 Received: (at submit) by debbugs.gnu.org; 8 May 2022 14:16:39 +0000 Received: from localhost ([127.0.0.1]:54976 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnhiA-0004wl-O4 for submit@debbugs.gnu.org; Sun, 08 May 2022 10:16:39 -0400 Received: from lists.gnu.org ([209.51.188.17]:35582) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnhi8-0004uh-ET for submit@debbugs.gnu.org; Sun, 08 May 2022 10:16:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38830) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnhi8-0000G9-7G for guix-patches@gnu.org; Sun, 08 May 2022 10:16:36 -0400 Received: from jpoiret.xyz ([206.189.101.64]:38898) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnhi6-0001kU-68 for guix-patches@gnu.org; Sun, 08 May 2022 10:16:35 -0400 Received: from authenticated-user (jpoiret.xyz [206.189.101.64]) by jpoiret.xyz (Postfix) with ESMTPA id C8898184D6A; Sun, 8 May 2022 14:16:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1652019390; 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; bh=A67dAy3wWxjOorffQG3HZsQVeQhnwWJewn4fF5gbDpc=; b=oswEZ+urVi5zakk/ilCsXngeDmPaEFXbiSqbHOXuNUr/wyixG5Q3B0WJp9Ze1MMuamOGfr Ev7PRM6H8jkj0Rp0rigw+WRQXJKRzFPbRkvzRkJGNNeQs/Af9JYp3CYtuBgRtbYd++t6UP pP6YKat48TAOcR092LUuUfYIby0XCYPMn8sWsp9bD96UWF9S89pWS1alcVXZEk8CqL4XFY WOjdPEZIE3Yw8DhaueOC36TFAP9ICrnSgtDjQw/68vYocLHNxLFcN82uZ5kFzuuMdo0Yi2 U2AkWnZDP0hSfSirM+GITfvR8yertTaHGsH9q/zlS3fRqlWUhwV2JLAiWqMwCw== Date: Sun, 8 May 2022 16:16:06 +0200 Message-Id: <20220508141606.14085-1-dev@jpoiret.xyz> MIME-Version: 1.0 Authentication-Results: jpoiret.xyz; auth=pass smtp.auth=jpoiret@jpoiret.xyz smtp.mailfrom=dev@jpoiret.xyz X-Spamd-Bar: / Received-SPF: pass client-ip=206.189.101.64; envelope-from=dev@jpoiret.xyz; helo=jpoiret.xyz X-Spam_score_int: 24 X-Spam_score: 2.4 X-Spam_bar: ++ X-Spam_report: (2.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, FROM_SUSPICIOUS_NTLD_FP=1.997, PDS_OTHER_BAD_TLD=1.997, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: Josselin Poiret X-ACL-Warn: , Josselin Poiret via Guix-patches X-Patchwork-Original-From: Josselin Poiret via Guix-patches via From: Josselin Poiret X-getmail-retrieved-from-mailbox: Patches * 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. --- Hello everyone, Someone on IRC [1] reported that they couldn't run guix install emacs-avy emacs-embark --with-branch=emacs-avy=master --with-branch=emacs-embark=master without guix complaining about conflicting entries of emacs-avy and the propagated one from emacs-embark, even in a profile without either of them. The issue was that package transformations were applied to the contents of the generated manifest entries, but weren't applied to any of their dependencies. To solve this, I figured it would be simpler to just apply the transformation from the start, only creating the manifest entries after they have been applied. Also, the default `package->manifest-entry` preserves transformations properties by default, so this doesn't lose any info either. With this patch applied, the above command works as expected for me. Best, Josselin Poiret [1] https://logs.guix.gnu.org/guix/2022-05-08.log#134728 guix/scripts/package.scm | 36 ++++++++++++------------------------ 1 file changed, 12 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)