guix-patches
[Top][All Lists]
Advanced

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

[bug#70499] [PATCH] utils: Add find-unordered-packages procedure.


From: Ludovic Courtès
Subject: [bug#70499] [PATCH] utils: Add find-unordered-packages procedure.
Date: Wed, 01 May 2024 12:30:20 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Hi Herman,

Herman Rimm <herman@rimm.ee> skribis:

> * guix/utils.scm (find-unordered-packages): Add and export procedure.
> * tests/utils.scm ("find-unordered-packages"): Add test.
>
> Change-Id: I26ea0fca7d428b192711f75ff3cf5e5a4416b1b6
> ---
> Hello,
>
> I added a procedure which returns the line numbers where packages break
> from alphabetical order, e.g.:
>
>   scheme@(guix-user)> (lset-xor eqv? (find-unordered-packages
>   "gnu/packages/crates-io.scm"))
>   $1 = (626 1153 2693 2715 2840 4074 4139 4187 6099 6243 6382 6896 7677
>   9465 10346 11424 12089 12552 12676 12887 16147 16364 16897 18195 18260
>   19912 21335 22489 22792 23898 24344 24801 25443 25492 26591 27832
>   27944 31206 32365 32502 32609 32770 34281 34913 36192 36320 36621
>   36718 36828 37511 38169 39000 39360 39684 40921 41153 41459 41501
>   42121 42803 42910 44318 44585 46435 47350 47456 47709 48043 49624
>   49905 51084 51216 51560 53586 54473 57062 58925 59048 59134 59584
>   59664 59702 59914 62399 66006 66266 66391 68003 68200 68244 70292
>   70321 71660 71686 71761 72643 73746 73880 74434 74459 77309 77646
>   78136 79569 81722 81896 83802 85617 87167 89037 92212)
>
> It could be extended to also expect package versions in decreasing
> order. Maybe I can use it to sort packages automatically later. 

Nice.  Do you plan to use this procedure in a command-line tool?

> +(define (find-unordered-packages file)
> +  "Return the line numbers of top-level package definitions whose name
> +alphabetically preceeds the previous name."

My first thought when seeing the name is that this was returning a list
of packages, and then I wondered how it differed from ‘fold-packages’
and the likes.

Maybe call it ‘package-definition-alphabetical-sort-breakage’ or
something like that?

Thanks,
Ludo’.





reply via email to

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