all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ulf Herrman <striness@tilde.club>
To: 63319@debbugs.gnu.org
Subject: bug#63319: [PATCH 2/3] ui: derive parents of profile collision entries from manifest.
Date: Mon,  8 May 2023 15:33:34 -0500	[thread overview]
Message-ID: <20230508203335.30659-3-striness@tilde.club> (raw)
In-Reply-To: <20230508203335.30659-1-striness@tilde.club>

This fixes <https://issues.guix.gnu.org/63319>.

* 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





  parent reply	other threads:[~2023-05-09  7:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-05 20:32 bug#63319: Incorrect propagation chain reporting on profile collision Ulf Herrman
2023-05-08 20:33 ` bug#63319: [PATCH 0/3] Ulf Herrman
2023-05-08 20:33   ` bug#63319: [PATCH 1/3] profiles: include non-lowered entries and manifest in collision error Ulf Herrman
2023-05-08 20:33   ` Ulf Herrman [this message]
2023-05-08 20:33   ` bug#63319: [PATCH 3/3] profiles: remove `parent' field Ulf Herrman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230508203335.30659-3-striness@tilde.club \
    --to=striness@tilde.club \
    --cc=63319@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.