From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#29255: "Profile contains conflicting entries" could be more helpful Date: Thu, 30 Nov 2017 13:13:14 +0100 Message-ID: <87r2sg3qxx.fsf@gnu.org> References: <87bmk98yeq.fsf@sturm.com.au> <87bmk8hq6v.fsf@gnu.org> <87609zcyp1.fsf@elephly.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKNjC-0004vl-3j for bug-guix@gnu.org; Thu, 30 Nov 2017 07:14:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKNj8-0001uS-2j for bug-guix@gnu.org; Thu, 30 Nov 2017 07:14:06 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:57166) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eKNj7-0001sq-UC for bug-guix@gnu.org; Thu, 30 Nov 2017 07:14:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eKNj7-0004nd-Kw for bug-guix@gnu.org; Thu, 30 Nov 2017 07:14:01 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87609zcyp1.fsf@elephly.net> (Ricardo Wurmus's message of "Fri, 24 Nov 2017 19:35:06 +0100") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Ricardo Wurmus Cc: 29255@debbugs.gnu.org, Ben Sturmfels --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Ricardo Wurmus skribis: > In this case it is not entirely clear that the existing python-requests > package in the profile is =E2=80=9Cold=E2=80=9D. The version looks the s= ame 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 =E2=80=9Cfoo-bar=E2=80=9D) and conflicts with = a newer variant > (propagated from package =E2=80=9Cpython-twine=E2=80=9D). When the version numbers are the same, we cannot tell whether a variant is =E2=80=9Colder=E2=80=9D, we can just tell that it=E2=80=99s 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/vysfxizaddh1q8= s5qjgbdkzxx0585dzi-python-2.7.13 guix package: error: second entry: python@3.5.3 /gnu/store/m4rdgmvdqcxs2z= hv42idnz1s1w391i8j-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-cair= o-1.4.1 guix package: error: profile contains conflicting entries for cairo:out guix package: error: first entry: cairo@1.14.10 /gnu/store/c4vl4hw5jccg0b= 23sfvs0kdnfdbxdlgm-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/nwxv9s2q8pi0m= 6gn6fyidpj8442dwp6f-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 =E2=80=98guix package -m= =E2=80=99, though I=E2=80=99m not sure if it=E2=80=99d be a useful hint (it=E2=80=99s = a useful recommendation, but not necessarily good as a =E2=80=9Cfix hint.=E2=80=9D) Thoughts? Thanks, Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline 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)) --=-=-=--