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

From: Leo Prikler <[email-masked]>
Date: Tue, 04 May 2021 21:39:24 +0200

Am Dienstag, den 04.05.2021, 13:35 +0000 schrieb Guillaume Le Vaillant:
> Hi,
> 
> 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:
> 
> --8<---------------cut here---------------start------------->8---
> (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"
> --8<---------------cut here---------------end--------------->8---
> 
> It should be:
> 
> --8<---------------cut here---------------start------------->8---
> $1 = "sbcl-3d-vectors"
> $2 = "3.1.0-1.29bb968"
> --8<---------------cut here---------------end--------------->8---
> 
> 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")?
> 
> This is related to issue #48208, and also probably to issue #41437.
I don't think there's any way to cleverly match this.  For all we know,
3d could be a version, we have 2019c, 2021a, 1a, 9d, 9100h and 063a
already.  Perhaps we should forward name and version as keyword
arguments, so that we don't have to reconstruct them, or alternatively
use a different delimiter (e.g. @)

I'm honestly surprised, that many other stuff "works fine" despite the
fact, that they'd probably also suffer from this bug.  Can anyone tell
me why emacs-2048-game builds?