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