Hi Edouard, Edouard Klein <e...@beaver-labs.com> skribis:
> Because of the subtle consequences of editing a package are hard to keep > track of, I wrote the attached script (you need sharness to run it, but > with slight modification it can become a standalone script). > > This script goes beyond the instructions of the manual on two fronts: > - First, it not only tries to build the packages, but also to install > them, I think this is probably the first time we have this problem (that I remember of), probably because the Jupyter dependency graph has so many propagated inputs. However, this is definitely something ‘guix lint’ could check with something along the lines of the patch below. > - Secondly, it does not limit itself to the dependents (as listed by > guix refresh --list-dependents) of the packages one is meddling with, > but to the whole reverse bags (as listed by guix graph > --type=reverse-bag). I think it’s equivalent: ‘guix refresh -l’ simply shows the contour of the graph whereas ‘guix graph’ lists every node. Thanks for your feedback! Ludo’.
diff --git a/guix/lint.scm b/guix/lint.scm index 82861b8a27..84ddfd6b73 100644 --- a/guix/lint.scm +++ b/guix/lint.scm @@ -41,6 +41,7 @@ #:use-module (guix upstream) #:use-module (guix utils) #:use-module (guix memoization) + #:use-module (guix profiles) #:use-module (guix scripts) #:use-module ((guix ui) #:select (texi->plain-text fill-paragraph)) #:use-module (guix gnu-maintenance) @@ -84,6 +85,7 @@ check-for-updates check-formatting check-archival + check-profile-collisions lint-warning lint-warning? @@ -970,6 +972,20 @@ descriptions maintained upstream." (with-store store (check-with-store store)))) +(define* (check-profile-collisions package #:key store) + (guard (c ((profile-collision-error? c) + (let ((first (profile-collision-error-entry c)) + (second (profile-collision-error-conflict c))) + (list (make-warning package + (G_ "collision between ~a@~a and ~a@~a") + (list (manifest-entry-name first) + (manifest-entry-version first) + (manifest-entry-name second) + (manifest-entry-version second))))))) + (check-for-collisions (packages->manifest (list package)) + (%current-system)) + '())) + (define (check-license package) "Warn about type errors of the 'license' field of PACKAGE." (match (package-license package) @@ -1349,6 +1365,11 @@ or a list thereof") (description "Report failure to compile a package to a derivation") (check check-derivation) (requires-store? #t)) + (lint-checker + (name 'profile-collisions) + (description "Report collisions that would occur due to propagated inputs") + (check check-profile-collisions) + (requires-store? #t)) (lint-checker (name 'patch-file-names) (description "Validate file names and availability of patches") diff --git a/guix/profiles.scm b/guix/profiles.scm index 25ff146bdf..56ef4c0b91 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -105,6 +105,7 @@ manifest-installed? manifest-matching-entries manifest-search-paths + check-for-collisions manifest-transaction manifest-transaction? diff --git a/guix/ui.scm b/guix/ui.scm index 98b30445c8..2595e44062 100644