unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Edouard Klein <edk@beaver-labs.com>
Cc: guix-devel@gnu.org
Subject: Re: A script to check an edit does not break anything
Date: Sat, 13 Jun 2020 23:15:52 +0200	[thread overview]
Message-ID: <874krewttj.fsf@gnu.org> (raw)
In-Reply-To: <87sgf1r5nk.fsf@alice.lan> (Edouard Klein's message of "Thu, 11 Jun 2020 17:19:59 +0200")

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

Hi Edouard,

Edouard Klein <edk@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’.


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

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

  parent reply	other threads:[~2020-06-13 21:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11 15:19 A script to check an edit does not break anything Edouard Klein
2020-06-11 15:41 ` Edouard Klein
2020-06-11 17:55   ` Vincent Legoll
2020-06-12 16:41     ` Edouard Klein
2020-06-13 21:15 ` Ludovic Courtès [this message]
2020-06-14 15:27   ` Checking for profile collisions with ‘guix lint’ Ludovic Courtès
2020-06-15  8:50   ` A script to check an edit does not break anything Edouard Klein
2020-06-16 10:01     ` Ludovic Courtès

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=874krewttj.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=edk@beaver-labs.com \
    --cc=guix-devel@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 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).