Subject: Re: bug#48225: Wrong result of package-name->name+version

From: Ludovic Courtès <[email-masked]>
Date: Tue, 04 May 2021 22:08:17 +0200

Hi Guillaume,

Guillaume Le Vaillant <[email-masked]> skribis:

> The 'package-name->name+version' function defined in
> "guix/build/utils.scm" returns a wrong result if there is a '-'
> followed by a number in the package name:
>
> (use-modules ((guix build utils)))
> (package-name->name+version "sbcl-3d-vectors-3.1.0-1.29bb968")
>
> $1 = "sbcl"
> $2 = "3d-vectors-3.1.0-1.29bb968"
>
>
> It should be:
>
> $1 = "sbcl-3d-vectors"
> $2 = "3.1.0-1.29bb968"
>
> Can someone think of an elegant modification for
> 'package-name->name+version' so that it finds where the version is
> even if there are several hyphens before of after it (as in
> "sbcl-3d-vectors-3.1.0-1.29bb968" or "nyxt-2-pre-release-6")?

It’s implements a heuristic meant to work for most packages.  It’s hard
to tweak that without breaking something else instead.  (Plus,
“nyxt-2-pre-release-6” looks really bogus to me.)

A better fix would be to not guess and instead pass #:name and #:version
to all the build phases, with the value taken from the <package> object.
(That’s a world-rebuild fix though.)

WDYT?

> This is related to issue #48208, and also probably to issue #41437.

Perhaps we can find a workaround for these?

Thanks,
Ludo’.