bug-guix
[Top][All Lists]
Advanced

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

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


From: Guillaume Le Vaillant
Subject: bug#48225: Wrong result of package-name->name+version
Date: Thu, 06 May 2021 09:10:13 +0000

Ludovic Courtès <ludo@gnu.org> skribis:

> [...]
> 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?

Sharlatan Hellseher <sharlatanus@gmail.com> skribis:

> If chaining  `package-name->name+version` function  may affect a large
> layer of infrastructure here is could a quick adhoc workaround:
>
> sbcl-3d-vectors -> sbcl-cl3d-vectors
> sbcl-3d-vectors -> sbcl-three-d-vectors
> sbcl-3d-vectors -> sbcl-iiid-vectors
>
> Or use any predictable common prefix which could be use and replaced
> after the function is reviewed.

I agree that having '#:name' and '#:version' available in the build
phases would be ideal.
Meanwhile I found a workaround for the asdf-build-system that fixes
bug#41437 and allows building the 'sbcl-3d-vectors' and
'sbcl-3d-matrices' packages of bug#48208 without having to mangle the
package names. It rebuilds all the Common Lisp packages, but that
doesn't take too much time.
WDYT?

From 1e37a89b943a818b5274c1d5f31143ca48bad40a Mon Sep 17 00:00:00 2001
From: Guillaume Le Vaillant <glv@posteo.net>
Date: Thu, 6 May 2021 10:32:56 +0200
Subject: [PATCH] build-system: asdf: Work around package-name->name+version
 bug.

This patch modifies how the name of the main Common Lisp system is extracted
from the full Guix package name to work around bug#48225 concerning the
'package-name->name+version' function.

Fixes <https://issues.guix.gnu.org/41437>.

* guix/build-system/asdf.scm (asdf-build): Fix 'systems' function.
* guix/build/asdf-build-system.scm (main-system-name): Fix it.
---
 guix/build-system/asdf.scm       | 15 +++++++--------
 guix/build/asdf-build-system.scm | 12 ++++++------
 2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/guix/build-system/asdf.scm b/guix/build-system/asdf.scm
index 28403a1960..8f9d63337f 100644
--- a/guix/build-system/asdf.scm
+++ b/guix/build-system/asdf.scm
@@ -291,16 +291,15 @@ set up using CL source package conventions."
                   (imported-modules %asdf-build-system-modules)
                   (modules %asdf-build-modules))
 
-    ;; FIXME: The definition of 'systems' is pretty hacky.
-    ;; Is there a more elegant way to do it?
     (define systems
       (if (null? (cadr asd-systems))
-          `(quote
-            ,(list
-              (string-drop
-               ;; NAME is the value returned from `package-full-name'.
-               (hyphen-separated-name->name+version name)
-               (1+ (string-length lisp-type))))) ; drop the "<lisp>-" prefix.
+          (let* ((lisp-prefix (string-append lisp-type "-"))
+                 (package-name (hyphen-separated-name->name+version
+                                (if (string-prefix? lisp-prefix name)
+                                    (string-drop name
+                                                 (string-length lisp-prefix))
+                                    name))))
+            `(quote ,(list package-name)))
           asd-systems))
 
     (define builder
diff --git a/guix/build/asdf-build-system.scm b/guix/build/asdf-build-system.scm
index 6ad855cab2..5a4fc44aef 100644
--- a/guix/build/asdf-build-system.scm
+++ b/guix/build/asdf-build-system.scm
@@ -52,12 +52,12 @@
   (string-append %source-install-prefix "/systems"))
 
 (define (main-system-name output)
-  (let ((package-name (package-name->name+version
-                       (strip-store-file-name output)))
-        (lisp-prefix (string-append (%lisp-type) "-")))
-    (if (string-prefix? lisp-prefix package-name)
-        (string-drop package-name (string-length lisp-prefix))
-        package-name)))
+  (let* ((full-name (strip-store-file-name output))
+         (lisp-prefix (string-append (%lisp-type) "-"))
+         (package-name (if (string-prefix? lisp-prefix full-name)
+                           (string-drop full-name (string-length lisp-prefix))
+                           full-name)))
+    (package-name->name+version package-name)))
 
 (define (lisp-source-directory output name)
   (string-append output (%lisp-source-install-prefix) "/" name))
-- 
2.31.1

Attachment: signature.asc
Description: PGP signature


reply via email to

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