guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A script to check an edit does not break anything


From: Edouard Klein
Subject: Re: A script to check an edit does not break anything
Date: Mon, 15 Jun 2020 10:50:19 +0200
User-agent: mu4e 1.4.6; emacs 26.3

Hi !

Ludovic Courtès writes:

> 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.

Thank you for pushing profile-collisions, it certainly is helpful for
finding such problems, and it perfectly integrates within guix.

>
>> - 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.

The problem lies when the leafs are OK but the nodes in the middle are
not. See for example in the attached image, the failure of jupyter is
masked by r-irkernel being both buildable and installable.

Now, the new tool you added to guix lint solves the discoverability
problem. It is now indeed reported that jupyter has a problem.

Still, it takes around 10 minutes to run on my (admittedly underpowered)
machine, and one has to rummage to the output (or diff with a previous
run) to see if a specific action caused or solved problems.

gpwc.sh has a real time visual output that is specific to current
modifications (it could even be paired with Ricardo's automatic commit
message writer to automatically guess which root packages to start with)
that allows the developer to start investing a problem quicker, without
having to wait for the end of the run. Also, the visual output makes
seeing who depends on whom easier, the same information in text form
makes my head hurt.

Provided I rewrite it in scheme, do you think gpwc could make it
into guix/etc ? 

Attachment: 2020-06-12T16:51:27+02:00.png
Description: PNG image

Cheers !

Edouard.

>
> 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]