guix-patches
[Top][All Lists]
Advanced

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

[bug#73458] [PATCH 2/2] build-system: mix: Fix decoding of package names


From: Liliana Marie Prikler
Subject: [bug#73458] [PATCH 2/2] build-system: mix: Fix decoding of package names with git versions.
Date: Wed, 25 Sep 2024 21:54:21 +0200
User-agent: Evolution 3.48.4

Am Mittwoch, dem 25.09.2024 um 10:24 +0200 schrieb Giacomo Leidi:
> Fixes <https://issues.guix.gnu.org/73454>
> 
> * guix/build/mix-build-system.scm (%git-version-rx): New variable,
> (package-name->elixir-name): use %git-version-rx to discriminate git
> versions from regular ones.
> 
> Change-Id: Icc6dc56c3db62dfbc17c7c71354a7a7e3d2e5b2a
> ---
>  guix/build/mix-build-system.scm | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/guix/build/mix-build-system.scm b/guix/build/mix-build-
> system.scm
> index 41f6061444..7250785914 100644
> --- a/guix/build/mix-build-system.scm
> +++ b/guix/build/mix-build-system.scm
> @@ -40,6 +40,9 @@ (define-module (guix build mix-build-system)
>  ;; minor version number of the Elixir used in the build.
>  (define %elixir-version (make-parameter "X.Y"))
>  
> +(define %git-version-rx
> +  (make-regexp "^(.*)-[0-9]+(\\.[0-9]+)?(\\.[0-9]+)?-[0-9]+\\..+$"))
> +
This regexp appears unsafe to me.  It matches a numeric component in
the package name as well.

>  (define (elixir-relative-libdir version)
>    "Return the relative path inside a package namespace in the store
> where all
>  libraries for a specified Elixir VERSION are installed."
> @@ -141,10 +144,12 @@ (define* (remove-mix-dirs . _)
>  
>  (define (package-name->elixir-name name+ver)
>    "Convert the Guix package NAME-VER to the corresponding Elixir
> name-version
> -format.  Example: elixir-a-pkg-1.2.3 -> a_pkg"
> +format.  Example: elixir-a-pkg-1.2.3 -> a_pkg or elixir-a-pkg-0.0.0-
> 0.e51e36e
> +-> a_pkg"
> +  (define git-version? (regexp-exec %git-version-rx name+ver))
>    ((compose
>      (cute string-join <> "_")
> -    (cute drop-right <> 1)
> +    (cute drop-right <> (if git-version? 2 1))
>      (cute string-split <> #\-))
I think we might have it easier if we pick the left side from a string-
split with #\.  Ideally, package names should not contain dots.
>     (strip-prefix name+ver)))

Cheers






reply via email to

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