From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: Giacomo Leidi <goodoldpaul@autistici.org>, 73458@debbugs.gnu.org
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 [thread overview]
Message-ID: <8264dde7b19aa96fb004f0aeb7908c43db6ad926.camel@gmail.com> (raw)
In-Reply-To: <573318832af8089d4b974598cc284d1a2b5b3cd9.1727252673.git.goodoldpaul@autistici.org>
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
next prev parent reply other threads:[~2024-09-25 20:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-24 17:03 [bug#73458] Fix mix-build-system bugs (73453 , 73454) paul via Guix-patches via
2024-09-25 8:24 ` [bug#73458] [PATCH 1/2] build-system: mix: Allow loading Erlang dependencies in Mix driven builds Giacomo Leidi via Guix-patches via
2024-09-25 8:24 ` [bug#73458] [PATCH 2/2] build-system: mix: Fix decoding of package names with git versions Giacomo Leidi via Guix-patches via
2024-09-25 19:54 ` Liliana Marie Prikler [this message]
2024-09-25 21:30 ` paul via Guix-patches via
2024-09-25 18:42 ` [bug#73458] [PATCH 1/2] build-system: mix: Allow loading Erlang dependencies in Mix driven builds Liliana Marie Prikler
2024-09-25 21:39 ` [bug#73458] [PATCH v2 " Giacomo Leidi via Guix-patches via
2024-09-25 21:39 ` [bug#73458] [PATCH v2 2/2] build-system: mix: Fix decoding of package names with git versions Giacomo Leidi via Guix-patches via
2024-10-12 17:51 ` bug#73458: Fix mix-build-system bugs (73453 , 73454) Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8264dde7b19aa96fb004f0aeb7908c43db6ad926.camel@gmail.com \
--to=liliana.prikler@gmail.com \
--cc=73458@debbugs.gnu.org \
--cc=goodoldpaul@autistici.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.