Subject: Re: bug#57460: [PATCH 00/19] Refresh to specific version

From: Ludovic Courtès <[email-masked]>
Date: Sat, 24 Sep 2022 11:45:37 +0200

Hartmut Goebel <[email-masked]> skribis:

> * guix/scripts/refresh.scm(options->packages)[args-packages]: Handle version
>   specification in package name arguments.
>   (update-package): Add keyword-argument 'version' and pass it on to called
>   functions.
>   (guix-refresh): When updating, pass the specified version (if any) to
>   update-package.
>   [package-list-without-versions, package-list-with-versions]: New functions.

[...]

>                           (('argument . spec)
>                            ;; Take either the specified version or the
>                            ;; latest one.
> -                          (specification->package spec))
> +                          (let* ((name version (package-name->name+version spec)))
> +                            (list (specification->package name) version)))

That changes the semantics of ‘guix refresh’.  Until now, “guix refresh
[email-masked]” or “guix refresh -l [email-masked]” would look specifically at
Guile 2.0.  Now, “guix refresh -l [email-masked]” would report dependents of
Guile 3.0.

So instead of reusing the version string that shows up here, I’d suggest
adding a new command-line option, say -T/--target-version.  The downside
is that it wouldn’t work when multiple packages are specified on the
command line.

Another option would be to introduce special syntax, like an equal sign:

  guix refresh guile=3.0.4
  guix refresh [email-masked]=2.0.8

For that we’d introduce a new ‘specification->package-update’ that would
return a <package-update> record with two fields: the package to
upgrade, and the target version.

WDYT?

> +  (define (package-list-without-versions packages)
> +    (map (match-lambda
> +               ((package version) package)
> +               (package package))
> +              packages))
> +
> +  (define (package-list-with-versions packages)
> +    (map (match-lambda
> +               ((package version) (list package version))
> +               (package (list package #f)))
> +              packages))

I always find it a bad sign when one has to write specific list-fiddling
procedures; usually it indicates we’re missing a record type or
something.

Ludo’.