unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Ricardo Wurmus <rekado@elephly.net>
Cc: 29255@debbugs.gnu.org, Ben Sturmfels <ben@sturm.com.au>
Subject: bug#29255: "Profile contains conflicting entries" could be more helpful
Date: Thu, 30 Nov 2017 13:13:14 +0100	[thread overview]
Message-ID: <87r2sg3qxx.fsf@gnu.org> (raw)
In-Reply-To: <87609zcyp1.fsf@elephly.net> (Ricardo Wurmus's message of "Fri, 24 Nov 2017 19:35:06 +0100")

[-- Attachment #1: Type: text/plain, Size: 2686 bytes --]

Hi,

Ricardo Wurmus <rekado@elephly.net> skribis:

> In this case it is not entirely clear that the existing python-requests
> package in the profile is “old”.  The version looks the same and the
> hash is opaque.
>
> Would it be possible to record something about the Guix version that was
> used to install a package?  Then we could say:
>
>   An older variant of python-requests is installed in this profile
>   (propagated from package “foo-bar”) and conflicts with a newer variant
>   (propagated from package “python-twine”).

When the version numbers are the same, we cannot tell whether a variant
is “older”, we can just tell that it’s different.  Also, I find it
useful to see the propagation stack as is currently the case.

With the patch below, I get:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix package -p foo -i python@2 python
The following packages will be installed:
   python	2.7.13	/gnu/store/vysfxizaddh1q8s5qjgbdkzxx0585dzi-python-2.7.13
   python	3.5.3	/gnu/store/m4rdgmvdqcxs2zhv42idnz1s1w391i8j-python-3.5.3

guix package: error: profile contains conflicting entries for python:out
guix package: error:   first entry: python@2.7.13 /gnu/store/vysfxizaddh1q8s5qjgbdkzxx0585dzi-python-2.7.13
guix package: error:   second entry: python@3.5.3 /gnu/store/m4rdgmvdqcxs2zhv42idnz1s1w391i8j-python-3.5.3
hint: You cannot have two different versions or variants of `python' in the same profile.
--8<---------------cut here---------------end--------------->8---

and:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix package -i guile-cairo -p foo --no-grafts
The following package will be installed:
   guile-cairo	1.4.1	/gnu/store/dsdbp9sqla6zz2skljlcr5zfjyzvargf-guile-cairo-1.4.1

guix package: error: profile contains conflicting entries for cairo:out
guix package: error:   first entry: cairo@1.14.10 /gnu/store/c4vl4hw5jccg0b23sfvs0kdnfdbxdlgm-cairo-1.14.10
guix package: error:    ... propagated from guile-cairo@1.4.1
guix package: error:   second entry: cairo@1.14.10 /gnu/store/nwxv9s2q8pi0m6gn6fyidpj8442dwp6f-cairo-1.14.10
guix package: error:    ... propagated from cairomm@1.12.2
hint: Try upgrading both `guile-cairo' and `cairomm', or remove one of them from the profile.
--8<---------------cut here---------------end--------------->8---

How does that sound?

We could further refine the hint to suggest using ‘guix package -m’,
though I’m not sure if it’d be a useful hint (it’s a useful
recommendation, but not necessarily good as a “fix hint.”)

Thoughts?

Thanks,
Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1569 bytes --]

diff --git a/guix/ui.scm b/guix/ui.scm
index 13cbe3a0f..660f6ea5c 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -502,6 +502,25 @@ interpreted."
           (x
            (leave (G_ "unknown unit: ~a~%") unit)))))))
 
+(define (display-collision-resolution-hint collision)
+  (define (top-most-entry entry)
+    (let loop ((entry entry))
+      (match (force (manifest-entry-parent entry))
+        (#f entry)
+        (parent (loop parent)))))
+
+  (let* ((first  (profile-collision-error-entry collision))
+         (second (profile-collision-error-conflict collision))
+         (name1  (manifest-entry-name (top-most-entry first)))
+         (name2  (manifest-entry-name (top-most-entry second))))
+    (if (string=? name1 name2)
+        (display-hint (format #f (G_ "You cannot have two different versions
+or variants of @code{~a} in the same profile.")
+                              name1))
+        (display-hint (format #f (G_ "Try upgrading both @code{~a} and @code{~a},
+or remove one of them from the profile.")
+                              name1 name2)))))
+
 (define (call-with-error-handling thunk)
   "Call THUNK within a user-friendly error handler."
   (define (port-filename* port)
@@ -570,6 +589,7 @@ interpreted."
                              (manifest-entry-output* conflict)
                              (manifest-entry-item conflict))
                (report-parent-entries conflict)
+               (display-collision-resolution-hint c)
                (exit 1)))
             ((nar-error? c)
              (let ((file (nar-error-file c))

  reply	other threads:[~2017-11-30 12:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-11  0:14 bug#29255: "Profile contains conflicting entries" could be more helpful Ben Sturmfels
2017-11-11 13:59 ` Ludovic Courtès
2017-11-24 18:35   ` Ricardo Wurmus
2017-11-30 12:13     ` Ludovic Courtès [this message]
2017-12-10 22:47       ` Ludovic Courtès
2017-12-10 22:53         ` Ben Sturmfels

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=87r2sg3qxx.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=29255@debbugs.gnu.org \
    --cc=ben@sturm.com.au \
    --cc=rekado@elephly.net \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).