From debbugs-submit-bounces@debbugs.gnu.org Fri May 05 16:33:59 2023 Received: (at submit) by debbugs.gnu.org; 5 May 2023 20:33:59 +0000 Received: from localhost ([127.0.0.1]:57636 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pv27q-0006rv-N3 for submit@debbugs.gnu.org; Fri, 05 May 2023 16:33:59 -0400 Received: from lists.gnu.org ([209.51.188.17]:60812) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pv27m-0006rk-3s for submit@debbugs.gnu.org; Fri, 05 May 2023 16:33:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pv27l-00065H-OA for bug-guix@gnu.org; Fri, 05 May 2023 16:33:53 -0400 Received: from tilde.club ([142.44.150.184]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pv27f-00069i-Eh for bug-guix@gnu.org; Fri, 05 May 2023 16:33:53 -0400 Received: by tilde.club (Postfix, from userid 5378) id B91BD2238FF42; Fri, 5 May 2023 20:33:43 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 tilde.club B91BD2238FF42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tilde.club; s=mail; t=1683318823; bh=CkH4ma9HSAv7U9eChhlOSp+JNIOImdHRyDR+Dqp/Rrs=; h=From:To:Subject:Date:From; b=Eu7v7RSfEccmRXFppOxyAQ7i3X4/V6U6OGg8gu0AoIhdhi0/eahLrBddAcF+hphad JRCkY4QuQ8+YA69jHw4R5luBsxVWqpTfYwaqd2kQnVajPFuApZhfDiX2HNwaNZhnis CWqqqxsU2dDewrmsJe2kNpR0S7L/I5LEJBpg6oVY= From: Ulf Herrman To: bug-guix@gnu.org Subject: Incorrect propagation chain reporting on profile collision Date: Fri, 05 May 2023 15:32:51 -0500 Message-ID: <87v8h6r024.fsf@tilde.club> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Received-SPF: pass client-ip=142.44.150.184; envelope-from=striness@tilde.club; helo=tilde.club X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable A has a `parent' field that contains a promise that returns either #f or another . This is somewhat incomplete information - a given entry can be a propagated-input to multiple entries, so there can actually be multiple parents. Given that this is only used for tracing a propagation chain to display to the user, though, that shouldn't be a problem. What is a problem, though, is that this field is determined when the manifest is read in and remains static thereafter. To demonstrate this, consider the following example: User installs package A1, which propagates B1. User also installs package C, which also propagates B1. Later the package definition for A is updated with a newer version, A2, and this propagates a newer version of B, B2. User runs 'guix pull', and subsequently runs 'guix package =2Du'. Note that C is unchanged and still propagates B1. Guix sees that the proposed new manifest contains A2, C, B1, and B2, and properly detects that B1 and B2 represent a collision. It traces B2 back to A2 correctly, and then goes to hunt down what propagated B1. What happens next depends somewhat on the arbitrary ordering of entries in the manifest, but it is entirely possible that the parent recorded for B1 is not C, but A1, even though the proposed new manifest doesn't even contain A1. So you end up with bizarre error messages like this: =2D---------------------------------------- $ guix package -u certbot The following package will be upgraded: certbot 1.28.0 =E2=86=92 2.3.0 guix package: error: profile contains conflicting entries for python-crypto= graphy guix package: error: first entry: python-cryptography@40.0.1 /gnu/store/b= cixgv8vg9bz6gyvijavqiha77h17icv-python-cryptography-40.0.1 guix package: error: ... propagated from python-josepy@1.13.0 guix package: error: ... propagated from python-acme@2.3.0 guix package: error: ... propagated from certbot@2.3.0 guix package: error: second entry: python-cryptography@3.4.8 /gnu/store/2= kz701xhwvcswdp4dj3fd7v86v2ra70x-python-cryptography-3.4.8 guix package: error: ... propagated from python-josepy@1.13.0 guix package: error: ... propagated from python-acme@1.28.0 guix package: error: ... propagated from certbot@1.28.0 hint: You cannot have two different versions or variants of `certbot' in th= e same profile. =2D---------------------------------------- This happens because the collision check is performed on the new manifest, and the parent fields are leftover from the old manifest. Ultimately, the parent field is just an optimization - it can always be re-derived from a manifest, and indeed, when a is shared across multiple manifests, *must* be re-derived with respect to a given manifest in order for it to make sense. I propose that we remove the 'parent' field entirely and modify &profile-collision-error so that it also reports the manifest the collision occurred in. (guix ui) can then use this to provide more complete (and also accurate) error messages. Note that at present check-for-collisions actually can report manifest entries that aren't "part of" *any* manifest, since they're freshly created by lower-manifest-entry. Tangentially related: it's worth noting that only showing two propagation chains tends to lead to frustrating "whack-a-mole"-style package transactions, since a decision about which package to keep, remove, or upgrade has to be made before the next collision source can be found. We should probably add a profile mode to 'guix graph' that shows the propagation graph for a proposed new profile manifest, or at least let 'guix package' show all collisions when invoked with higher verbosity. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQHIBAEBCAAyFiEEn6BUn0yca1D9JsMa1lV76sJM9mgFAmRVaAkUHHN0cmluZXNz QHRpbGRlLmNsdWIACgkQ1lV76sJM9mi53wv/bGzoi5Ro1ifiG0xtSn2Ej24FVZyv XAQMHnLp7N15wb2e8Gbf+JpWp+bO0Iwhi17FaNCyaCcwrhcNl5uWkGczyvYsk0DV OX4BrisqAc/5OFOo5KmrRqCZycAXr0uzd9o9o/XafSoaWjFymIkebLJGVsaEZcxG MZbQ0EyORSsTlLO+m1BqzDWznDEN04zaoyIBA3tNO3hkFf5M0Smzp5vS+DolCuVE YPqSH8JpS4Zl6hMKluuN65mkAM8s2QmvhWs3lujnNdLu61LdvXPZHTFBXJ5qcWOP 0w12K0CM4arj5AXX1S3PaRqnmfJWDW9PukKolVhtUOo/N9Apc/Z2msx9LrtHBGQG RqH+5dPtxUpqqbagh9cz9vA3kbRapAqC/ba/dvcrNm1zwqu+CqjMZdmvKtaY4Bax bfZF1/m5ubL9GiGHb54dsVejsaM7bpFC5JllJlpA6YVc6i2KkQzE39JMIDFoIlo1 sxNDKXSur1ef+C8t0TdCgddYmWBKUM9wjvaG =E6NE -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon May 08 16:33:51 2023 Received: (at 63319) by debbugs.gnu.org; 8 May 2023 20:33:51 +0000 Received: from localhost ([127.0.0.1]:41783 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pw7YN-0006T5-HE for submit@debbugs.gnu.org; Mon, 08 May 2023 16:33:51 -0400 Received: from tilde.club ([142.44.150.184]:42434 ident=postfix) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pw7YL-0006Sk-1O for 63319@debbugs.gnu.org; Mon, 08 May 2023 16:33:50 -0400 Received: by tilde.club (Postfix, from userid 5378) id E63AA22301A5E; Mon, 8 May 2023 20:33:43 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 tilde.club E63AA22301A5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tilde.club; s=mail; t=1683578023; bh=ILlIb1rpxymEunJt3JVPh5olt+IwoEMmkwvnlEMcDdM=; h=From:To:Subject:Date:From; b=Geq1ezFVQ07f3IKLvg/2n1vFPYWcRxeymOi8foPc8ohJS8STJFd9NnlYP51gRMObO IUAguoS56/bJkWfxdvnDvpWgpe/YAAIN5hqR4OmtQpXI0fc/pipOmS7CQJFTY7qQO4 SaPB9TJ+tBLcTB7+3JxIbNb9me4IlBJYwM+QjhR4= From: Ulf Herrman To: 63319@debbugs.gnu.org Subject: [PATCH 0/3] Date: Mon, 8 May 2023 15:33:32 -0500 Message-Id: <20230508203335.30659-1-striness@tilde.club> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 63319 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) This patch series fixes issue #63319, making propagation chains leading to profile collisions be reported properly. It does this by having 'check-for-collisions' fill in the &profile-collision-error with the manifest and the lowered versions of the entries in question, and (guix ui) derive parent information from the manifest. It then removes the now-unused 'parent' field of . Ulf Herrman (3): profiles: include non-lowered entries and manifest in collision error. ui: derive parents of profile collision entries from manifest. profiles: remove `parent' field. guix/inferior.scm | 36 ++++----- guix/profiles.scm | 183 +++++++++++++++++++++++++--------------------- guix/ui.scm | 32 ++++++-- 3 files changed, 142 insertions(+), 109 deletions(-) -- 2.39.1 From debbugs-submit-bounces@debbugs.gnu.org Mon May 08 16:33:52 2023 Received: (at 63319) by debbugs.gnu.org; 8 May 2023 20:33:52 +0000 Received: from localhost ([127.0.0.1]:41785 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pw7YN-0006T7-RZ for submit@debbugs.gnu.org; Mon, 08 May 2023 16:33:52 -0400 Received: from tilde.club ([142.44.150.184]:42442 ident=postfix) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pw7YL-0006Ss-Ub for 63319@debbugs.gnu.org; Mon, 08 May 2023 16:33:50 -0400 Received: by tilde.club (Postfix, from userid 5378) id AC0E62230502B; Mon, 8 May 2023 20:33:49 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 tilde.club AC0E62230502B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tilde.club; s=mail; t=1683578029; bh=GkUKPHduALi/MAUdQEZQX/5l1CQ4P6zqwJw2OtPKVdI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=KHT7ZBS8aeCoaJ97aquQ3nJPWYSzKX0BKy/isH9ubSrRyR7HbRcKRI7W1i5kT3xF6 Ocw7OjCPMbj6gE13IyVT7UDcFAjOGzguzc05tIMtVfUEclHZtjvm9vuYCusGn7BkR7 c58yQGoihnuUEJuP+Rya6JJ7EU4YN/DPecGrO/Jc= From: Ulf Herrman To: 63319@debbugs.gnu.org Subject: [PATCH 1/3] profiles: include non-lowered entries and manifest in collision error. Date: Mon, 8 May 2023 15:33:33 -0500 Message-Id: <20230508203335.30659-2-striness@tilde.club> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230508203335.30659-1-striness@tilde.club> References: <20230508203335.30659-1-striness@tilde.club> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 63319 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This provides the necessary information for (guix ui) to accurately determine the actual entries causing the collision. The entries alone aren't enough, since they inherit their parent (singular!) field from whatever it happened to be before any manifest transaction was applied. The lowered variants are included because (guix ui) needs them for reporting store paths, and the non-lowered variants are included so that the proper parents can be derived from the included manifest, which must contain them. We also add and export a convenience procedure for finding the parents of menu entries in a particular manifest. * guix/profiles.scm (profile-collision-error-entry-lowered, profile-collision-error-conflict-lowered, profile-collision-error-manifest): new fields. (check-for-collisions): populate them. (manifest-entry->parents): new procedure. * guix/ui.scm (call-with-error-handling): use lowered entries. --- guix/profiles.scm | 60 ++++++++++++++++++++++++++++++++++++++--------- guix/ui.scm | 4 ++-- 2 files changed, 51 insertions(+), 13 deletions(-) diff --git a/guix/profiles.scm b/guix/profiles.scm index 03333785f9..b812a6f7d9 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -64,7 +64,10 @@ (define-module (guix profiles) &profile-collision-error profile-collision-error? profile-collision-error-entry + profile-collision-error-entry-lowered profile-collision-error-conflict + profile-collision-error-conflict-lowered + profile-collision-error-manifest &missing-generation-error missing-generation-error? missing-generation-error-generation @@ -107,6 +110,7 @@ (define-module (guix profiles) manifest-installed? manifest-matching-entries manifest-search-paths + manifest-entry->parents check-for-collisions manifest->code @@ -186,7 +190,10 @@ (define-condition-type &profile-not-found-error &profile-error (define-condition-type &profile-collision-error &error profile-collision-error? (entry profile-collision-error-entry) ; - (conflict profile-collision-error-conflict)) ; + (conflict profile-collision-error-conflict) ; + (entry-lowered profile-collision-error-entry-lowered) ; + (conflict-lowered profile-collision-error-conflict-lowered) ; + (manifest profile-collision-error-manifest)) ; (define-condition-type &unmatched-pattern-error &error unmatched-pattern-error? @@ -329,6 +336,34 @@ (define (recurse entry) (item (derivation->output-path drv output)) (dependencies dependencies))))))) +(define (manifest-entry->parents manifest) + "Return a procedure that maps each in MANIFEST to the list +of s in MANIFEST or their dependencies, recursively, that +have the entry in question as a direct dependency." + (define (visit-entries entries mapping visited?) + (match entries + (((and entry ($ _ _ _ _ dependencies)) . rest) + (if (vhash-assq entry visited?) + (visit-entries rest mapping visited?) + (call-with-values + (lambda () + (visit-entries dependencies + (fold (lambda (dependency mapping) + (vhash-consq dependency entry mapping)) + mapping + dependencies) + (vhash-consq entry #t visited?))) + (lambda (mapping visited?) + (visit-entries rest mapping visited?))))) + (() + (values mapping visited?)))) + + (define mapping + (visit-entries (manifest-entries manifest) vlist-null vlist-null)) + + (lambda (entry) + (vhash-foldq* cons '() entry mapping))) + (define* (check-for-collisions manifest system #:key target) "Check whether the entries of MANIFEST conflict with one another; raise a '&profile-collision-error' when a conflict is encountered." @@ -348,25 +383,28 @@ (define candidates (define lower-pair (match-lambda ((first second) - (mlet %store-monad ((first (lower-manifest-entry first system - #:target target)) - (second (lower-manifest-entry second system - #:target target))) - (return (list first second)))))) + (mlet %store-monad ((first-low (lower-manifest-entry first system + #:target target)) + (second-low (lower-manifest-entry second system + #:target target))) + (return (list first first-low second second-low)))))) ;; Start by lowering CANDIDATES "in parallel". - (mlet %store-monad ((lst (mapm/accumulate-builds lower-pair candidates))) + (mlet* %store-monad ((lst (mapm/accumulate-builds lower-pair candidates))) (foldm %store-monad (lambda (entries result) (match entries - ((first second) - (if (string=? (manifest-entry-item first) - (manifest-entry-item second)) + ((first first-low second second-low) + (if (string=? (manifest-entry-item first-low) + (manifest-entry-item second-low)) (return result) (raise (condition (&profile-collision-error (entry first) - (conflict second)))))))) + (entry-lowered first-low) + (conflict second) + (conflict-lowered second-low) + (manifest manifest)))))))) #t lst))) diff --git a/guix/ui.scm b/guix/ui.scm index d75243458d..5d2ae23c25 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -750,8 +750,8 @@ (define (port-filename* port) ("out" #f) (output output))))) ((profile-collision-error? c) - (let ((entry (profile-collision-error-entry c)) - (conflict (profile-collision-error-conflict c))) + (let ((entry (profile-collision-error-entry-lowered c)) + (conflict (profile-collision-error-conflict-lowered c))) (define (report-parent-entries entry) (let ((parent (force (manifest-entry-parent entry)))) (when (manifest-entry? parent) -- 2.39.1 From debbugs-submit-bounces@debbugs.gnu.org Mon May 08 16:33:57 2023 Received: (at 63319) by debbugs.gnu.org; 8 May 2023 20:33:57 +0000 Received: from localhost ([127.0.0.1]:41788 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pw7YT-0006TV-CL for submit@debbugs.gnu.org; Mon, 08 May 2023 16:33:57 -0400 Received: from tilde.club ([142.44.150.184]:33636 ident=postfix) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pw7YR-0006TM-4d for 63319@debbugs.gnu.org; Mon, 08 May 2023 16:33:55 -0400 Received: by tilde.club (Postfix, from userid 5378) id DFCF722301A5E; Mon, 8 May 2023 20:33:54 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 tilde.club DFCF722301A5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tilde.club; s=mail; t=1683578034; bh=YsF47HvIH4E2XgzMYRiv7/lmv4qDh81weotKNfsaLdk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=wDLHr/8lBFUpbvnTLqGJqhICTnWx6UhvK9U2IamElGMcyJvMFC+FkxvEeJGjAsIGq gZF4heIuVm8dfUniUhft7bhWRQMie8VIZgtHb95dxfkdGO5fq9zFsreOymRBMeUu30 BO9Vn1Av052nMzyB8W7BFJCqdiIm+EAdO53XrRG8= From: Ulf Herrman To: 63319@debbugs.gnu.org Subject: [PATCH 2/3] ui: derive parents of profile collision entries from manifest. Date: Mon, 8 May 2023 15:33:34 -0500 Message-Id: <20230508203335.30659-3-striness@tilde.club> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230508203335.30659-1-striness@tilde.club> References: <20230508203335.30659-1-striness@tilde.club> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 63319 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This fixes . * guix/ui.scm (display-collision-resolution-hint, call-with-error-handling): use manifest-entry->parents and the manifest included with the collision to get the parents. --- guix/ui.scm | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/guix/ui.scm b/guix/ui.scm index 5d2ae23c25..71fe5caa72 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -674,9 +674,19 @@ (define unit (define (display-collision-resolution-hint collision) "Display hints on how to resolve COLLISION, a &profile-collistion-error." + (define manifest (profile-collision-error-manifest collision)) + + (define entry->parents + (manifest-entry->parents manifest)) + + (define (manifest-entry-parent entry) + (match (entry->parents entry) + (() #f) + ((x . _) x))) + (define (top-most-entry entry) (let loop ((entry entry)) - (match (force (manifest-entry-parent entry)) + (match (manifest-entry-parent entry) (#f entry) (parent (loop parent))))) @@ -751,9 +761,19 @@ (define (port-filename* port) (output output))))) ((profile-collision-error? c) (let ((entry (profile-collision-error-entry-lowered c)) - (conflict (profile-collision-error-conflict-lowered c))) + (conflict (profile-collision-error-conflict-lowered c)) + (manifest (profile-collision-error-manifest c))) + + (define entry->parents + (manifest-entry->parents manifest)) + + (define (manifest-entry-parent entry) + (match (entry->parents entry) + (() #f) + ((x . rest) x))) + (define (report-parent-entries entry) - (let ((parent (force (manifest-entry-parent entry)))) + (let ((parent (manifest-entry-parent entry))) (when (manifest-entry? parent) (report-error (G_ " ... propagated from ~a@~a~%") (manifest-entry-name parent) @@ -773,13 +793,13 @@ (define (manifest-entry-output* entry) (manifest-entry-version entry) (manifest-entry-output* entry) (manifest-entry-item entry)) - (report-parent-entries entry) + (report-parent-entries (profile-collision-error-entry c)) (report-error (G_ " second entry: ~a@~a~a ~a~%") (manifest-entry-name conflict) (manifest-entry-version conflict) (manifest-entry-output* conflict) (manifest-entry-item conflict)) - (report-parent-entries conflict) + (report-parent-entries (profile-collision-error-conflict c)) (display-collision-resolution-hint c) (exit 1))) ((nar-error? c) -- 2.39.1 From debbugs-submit-bounces@debbugs.gnu.org Mon May 08 16:34:02 2023 Received: (at 63319) by debbugs.gnu.org; 8 May 2023 20:34:02 +0000 Received: from localhost ([127.0.0.1]:41791 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pw7YX-0006Tp-PN for submit@debbugs.gnu.org; Mon, 08 May 2023 16:34:02 -0400 Received: from tilde.club ([142.44.150.184]:33638 ident=postfix) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pw7YW-0006Te-9t for 63319@debbugs.gnu.org; Mon, 08 May 2023 16:34:00 -0400 Received: by tilde.club (Postfix, from userid 5378) id 15D7A22301A5E; Mon, 8 May 2023 20:34:00 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 tilde.club 15D7A22301A5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tilde.club; s=mail; t=1683578040; bh=qaviHf7stZS8jHlXgeXk0KQbjb+9eIREa2b31+Mh0PU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=zkFqo8ZuMlO6cxR57D+2VWDa/fCCnVZxMcHe7YR/j06PYIeP2dkXz2ucpGjn7u/Ic BPyD1Gr23fot/JKKtONlJarTbD++CGYz3z6XU2HZqbIfzyLc3oySB093N+QBgLVqOq XTpS/skyBMvwppCEVfp70o1mg7oVkqi5KRR1Odqc= From: Ulf Herrman To: 63319@debbugs.gnu.org Subject: [PATCH 3/3] profiles: remove `parent' field. Date: Mon, 8 May 2023 15:33:35 -0500 Message-Id: <20230508203335.30659-4-striness@tilde.club> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230508203335.30659-1-striness@tilde.club> References: <20230508203335.30659-1-striness@tilde.club> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 63319 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This field was only present for consumption by (guix ui) when reporting propagation chains that lead to profile collision errors, but it is only valid in general with respect to a single manifest. (guix ui) now derives parent information by itself with respect to an explicit manifest, so this field is no longer needed. * guix/profiles.scm (manifest-entry-parent): remove field. (package->manifest-entry, sexp->manifest): do not populate it. (manifest->gexp): adjust match specifications to account for its absence. * guix/inferior.scm (inferior-package->manifest-entry): do not populate nonexistent parent field. --- guix/inferior.scm | 36 ++++++-------- guix/profiles.scm | 123 +++++++++++++++++++--------------------------- 2 files changed, 67 insertions(+), 92 deletions(-) diff --git a/guix/inferior.scm b/guix/inferior.scm index 5dfd30a6c8..4030640f6d 100644 --- a/guix/inferior.scm +++ b/guix/inferior.scm @@ -819,27 +819,23 @@ (define-syntax-rule (memoized package output exp) result)))) (let loop ((package package) - (output output) - (parent (delay #f))) + (output output)) (memoized package output - ;; For each dependency, keep a promise pointing to its "parent" entry. - (letrec* ((deps (map (match-lambda - ((label package) - (loop package "out" (delay entry))) - ((label package output) - (loop package output (delay entry)))) - (inferior-package-propagated-inputs package))) - (entry (manifest-entry - (name (inferior-package-name package)) - (version (inferior-package-version package)) - (output output) - (item package) - (dependencies (delete-duplicates deps)) - (search-paths - (inferior-package-transitive-native-search-paths package)) - (parent parent) - (properties properties)))) - entry)))) + (let ((deps (map (match-lambda + ((label package) + (loop package "out")) + ((label package output) + (loop package output))) + (inferior-package-propagated-inputs package)))) + (manifest-entry + (name (inferior-package-name package)) + (version (inferior-package-version package)) + (output output) + (item package) + (dependencies (delete-duplicates deps)) + (search-paths + (inferior-package-transitive-native-search-paths package)) + (properties properties)))))) ;;; diff --git a/guix/profiles.scm b/guix/profiles.scm index b812a6f7d9..0d22667362 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -90,7 +90,6 @@ (define-module (guix profiles) manifest-entry-item manifest-entry-dependencies manifest-entry-search-paths - manifest-entry-parent manifest-entry-properties lower-manifest-entry @@ -229,8 +228,6 @@ (define-record-type* manifest-entry (default '())) (search-paths manifest-entry-search-paths ; search-path-specification* (default '())) - (parent manifest-entry-parent ; promise (#f | ) - (default (delay #f))) (properties manifest-entry-properties ; list of symbol/value pairs (default '()))) @@ -416,29 +413,23 @@ (define (default-properties package) (transformations `((transformations . ,transformations))))) (define* (package->manifest-entry package #:optional (output "out") - #:key (parent (delay #f)) (properties (default-properties package))) "Return a manifest entry for the OUTPUT of package PACKAGE." - ;; For each dependency, keep a promise pointing to its "parent" entry. - (letrec* ((deps (map (match-lambda - ((label package) - (package->manifest-entry package - #:parent (delay entry))) - ((label package output) - (package->manifest-entry package output - #:parent (delay entry)))) - (package-propagated-inputs package))) - (entry (manifest-entry - (name (package-name package)) - (version (package-version package)) - (output output) - (item package) - (dependencies (delete-duplicates deps)) - (search-paths - (package-transitive-native-search-paths package)) - (parent parent) - (properties properties)))) - entry)) + (let ((deps (map (match-lambda + ((label package) + (package->manifest-entry package)) + ((label package output) + (package->manifest-entry package output))) + (package-propagated-inputs package)))) + (manifest-entry + (name (package-name package)) + (version (package-version package)) + (output output) + (item package) + (dependencies (delete-duplicates deps)) + (search-paths + (package-transitive-native-search-paths package)) + (properties properties)))) (define* (package->development-manifest package #:optional @@ -534,7 +525,7 @@ (define (entry->gexp entry) (return (match entry (($ name version output (? string? path) - (_ ...) (search-paths ...) _ (properties ...)) + (_ ...) (search-paths ...) (properties ...)) #~(#$name #$version #$output #$path #$@(optional 'propagated-inputs deps) #$@(optional 'search-paths @@ -542,7 +533,7 @@ (define (entry->gexp entry) search-paths)) #$@(optional 'properties properties))) (($ name version output package - (_deps ...) (search-paths ...) _ (properties ...)) + (_deps ...) (search-paths ...) (properties ...)) #~(#$name #$version #$output (ungexp package (or output "out")) #$@(optional 'propagated-inputs deps) @@ -565,7 +556,7 @@ (define (entry->gexp entry) (define (sexp->manifest sexp) "Parse SEXP as a manifest." - (define (infer-dependency item parent) + (define (infer-dependency item) ;; Return a for ITEM. (let-values (((name version) (package-name->name+version @@ -573,31 +564,25 @@ (define (infer-dependency item parent) (manifest-entry (name name) (version version) - (item item) - (parent parent)))) + (item item)))) - (define* (sexp->manifest-entry/v3 sexp #:optional (parent (delay #f))) + (define* (sexp->manifest-entry/v3 sexp) ;; Read SEXP as a version 3 manifest entry. (match sexp ((name version output path ('propagated-inputs deps) ('search-paths search-paths) extra-stuff ...) - ;; For each of DEPS, keep a promise pointing to ENTRY. - (letrec* ((deps* (map (cut sexp->manifest-entry/v3 <> (delay entry)) - deps)) - (entry (manifest-entry - (name name) - (version version) - (output output) - (item path) - (dependencies deps*) - (search-paths (map sexp->search-path-specification - search-paths)) - (parent parent) - (properties (or (assoc-ref extra-stuff 'properties) - '()))))) - entry)))) + (manifest-entry + (name name) + (version version) + (output output) + (item path) + (dependencies (map sexp->manifest-entry/v3 deps)) + (search-paths (map sexp->search-path-specification + search-paths)) + (properties (or (assoc-ref extra-stuff 'properties) + '())))))) (define-syntax let-fields (syntax-rules () @@ -611,7 +596,7 @@ (define-syntax let-fields ((_ lst () body ...) (begin body ...)))) - (define* (sexp->manifest-entry sexp #:optional (parent (delay #f))) + (define* (sexp->manifest-entry sexp) (match sexp (('repeated name version path) ;; This entry is the same as another one encountered earlier; look it @@ -628,23 +613,20 @@ (define* (sexp->manifest-entry sexp #:optional (parent (delay #f))) ((name version output path fields ...) (let-fields fields (propagated-inputs search-paths properties) (mlet* %state-monad - ((entry -> #f) - (deps (mapm %state-monad - (cut sexp->manifest-entry <> (delay entry)) + ((deps (mapm %state-monad + sexp->manifest-entry propagated-inputs)) + (entry -> (manifest-entry + (name name) + (version version) + (output output) + (item path) + (dependencies deps) + (search-paths (map sexp->search-path-specification + search-paths)) + (properties properties))) (visited (current-state)) (key -> (list name version path))) - (set! entry ;XXX: emulate 'letrec*' - (manifest-entry - (name name) - (version version) - (output output) - (item path) - (dependencies deps) - (search-paths (map sexp->search-path-specification - search-paths)) - (parent parent) - (properties properties))) (mbegin %state-monad (set-current-state (vhash-cons key entry visited)) (return entry))))))) @@ -661,18 +643,15 @@ (define* (sexp->manifest-entry sexp #:optional (parent (delay #f))) ...))) (manifest (map (lambda (name version output path deps search-paths) - (letrec* ((deps* (map (cute infer-dependency <> (delay entry)) - deps)) - (entry (manifest-entry - (name name) - (version version) - (output output) - (item path) - (dependencies deps*) - (search-paths - (map sexp->search-path-specification - search-paths))))) - entry)) + (manifest-entry + (name name) + (version version) + (output output) + (item path) + (dependencies (map infer-dependency deps)) + (search-paths + (map sexp->search-path-specification + search-paths)))) name version output path deps search-paths))) ;; Version 3 represents DEPS as full-blown manifest entries. -- 2.39.1