aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiacomo Leidi <goodoldpaul@autistici.org>2024-09-25 23:39:18 +0200
committerLudovic Courtès <ludo@gnu.org>2024-10-12 19:48:42 +0200
commit9a966bace1ce6a038ab580fe9103afa588101449 (patch)
tree03dac2e9291d715903fbf18a8212a2903bb94042
parentb6ea4f82986af507d787c1271077f61d504730ad (diff)
downloadguix-9a966bace1ce6a038ab580fe9103afa588101449.tar
guix-9a966bace1ce6a038ab580fe9103afa588101449.tar.gz
build-system: mix: Fix decoding of package names with git versions.
* 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. Fixes <https://issues.guix.gnu.org/73454> Change-Id: Icc6dc56c3db62dfbc17c7c71354a7a7e3d2e5b2a Signed-off-by: Ludovic Courtès <ludo@gnu.org> Change-Id: I978ddaf8667500d0d490c62561ab1267c3940dea
-rw-r--r--guix/build/mix-build-system.scm9
1 files changed, 7 insertions, 2 deletions
diff --git a/guix/build/mix-build-system.scm b/guix/build/mix-build-system.scm
index 73af575b10..6b7541cf56 100644
--- a/guix/build/mix-build-system.scm
+++ b/guix/build/mix-build-system.scm
@@ -40,6 +40,9 @@
;; 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]+\\..+$"))
+
(define* (elixir-libdir path #:optional (version (%elixir-version)))
"Return the path where all libraries under PATH for a specified Elixir
VERSION are installed."
@@ -133,10 +136,12 @@ We do not want to copy them to the installation directory."
(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 <> #\-))
(strip-prefix name+ver)))