GNU bug report logs - #60286
[PATCHES] Add guile's implementation for scheme-lsp-server

Previous Next

Package: guix-patches;

Reported by: goodoldpaul <at> autistici.org

Date: Fri, 23 Dec 2022 20:28:01 UTC

Severity: normal

Tags: patch

Done: Simon Tournier <zimon.toutoune <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #47 received at 60286 <at> debbugs.gnu.org (full text, mbox):

From: "Ricardo G. Herdt" <r.herdt <at> posteo.de>
To: 60286 <at> debbugs.gnu.org
Subject: Re: [bug#60286] [PATCHES] Add guile's implementation for
 scheme-lsp-server
Date: Sun, 17 Sep 2023 08:29:50 +0000
Hi Andrew,

Thanks for the feedback. Could you please show the error you get when 
running guile-lsp-server? I'm using Guix on top of Debian, and running 
`guile-lsp-server` with the prefixes set works:

GUILE_LOAD_PATH=...:${HOME}/.guix-profile/share/guile/site/3.0/ 
GUILE_LOAD_COMPILED_PATH=...:${HOME}/.guix-profile/lib/guile/3.0/site-ccache 
./guile-lsp-server --version

Regards,

Ricardo


Am 07.08.2023 11:44 schrieb Andrew Tropin:
> On 2023-06-21 19:27, Ricardo G. Herdt wrote:
> 
> Hi Ricardo, thank you very much for the patches and working on
> guile-lsp-server.
> 
>> * gnu/packages/guile-xyz.scm: add guile-lsp-server;
>>    (guile-scheme-json-rpc): update to 0.4.0, change dependencies
>> 
>> Original package author Giacomo Leidi. Adapted to use
>> guile-scheme-json-rpc.
>> ---
>>   gnu/packages/guile-xyz.scm | 97 
>> +++++++++++++++++++++++++++++++++++---
>>   1 file changed, 91 insertions(+), 6 deletions(-)
>> 
>> diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
>> index db7be432cc..1195e0e328 100644
>> --- a/gnu/packages/guile-xyz.scm
>> +++ b/gnu/packages/guile-xyz.scm
>> @@ -1054,9 +1054,9 @@ (define-public guile2.2-sjson
>>       (inputs (list guile-2.2))))
>> 
>>   (define-public guile-scheme-json-rpc
>> -  (let ((commit "45ae6890f6619286f5679f88c094c88127b54c4a")
>> +  (let ((commit "50acef7b824e2d23140e48242020f5fdc85cc67d")
> 
> For tagged release there is no need for commit and revision, I'll 
> remove
> them and apply the part of the patch related to guile-scheme-json-rpc
> version update as separate commit.
> 
>>           (revision "0")
>> -        (version "0.2.11"))
>> +        (version "0.4.0"))
>>       (package
>>         (name "guile-scheme-json-rpc")
>>         (version (git-version version revision commit))
>> @@ -1068,16 +1068,20 @@ (define-public guile-scheme-json-rpc
>>                   (file-name (git-file-name name version))
>>                   (sha256
>>                    (base32
>> -
>> "0w4m8xx8yyj0rv0q57mjr8ja87l7yikscj33i3ck26wg7230ppa5"))))
>> +
>> "0jsampz2ahs18z6yh9b5l3lkj8ycnavs0vg9sjngdj3w3zvrdcvm"))))
>>         (build-system gnu-build-system)
>>         (arguments
>>          `(#:phases (modify-phases %standard-phases
>>                       (add-after 'unpack 'change-to-guile-dir
>>                         (lambda _
>>                           (chdir "guile"))))))
>> -      (inputs (list guile-3.0 guile-json-3))
>> -      (native-inputs (list pkg-config))
>> -      (synopsis "Library providing JSON-RPC capability in Scheme")
>> +      (inputs (list guile-3.0 guile-srfi-145 guile-srfi-180))
>> +      (native-inputs (list autoconf
>> +                           automake
>> +                           pkg-config
>> +                           texinfo
>> +                           guile-3.0))
> 
> auto tools is already provided by gnu-build-system, no need to provide
> them one more time.  I don't see any texi docs, so probably texinfo is
> not needed.  Also guile-3.0 in native (build host side) inputs also not
> needed.  Removed.
> 
>> +      (synopsis "Library providing JSON-RPC capability for Guile
>> Scheme")
>>         (description
>>          "This library implements parts of the
>>   @uref{https://www.jsonrpc.org/specification,JSON-RPC specification},
>> allowing
>> @@ -1085,6 +1089,87 @@ (define-public guile-scheme-json-rpc
>>         (home-page "https://codeberg.org/rgherdt/scheme-json-rpc/")
>>         (license license:expat))))
>> 
>> +(define-public guile-lsp-server
>> +  (package
>> +    (name "guile-lsp-server")
>> +    (version "0.4.0")
>> +    (source
>> +     (origin
>> +      (method git-fetch)
>> +      (uri (git-reference
>> +            (url 
>> "https://codeberg.org/rgherdt/scheme-lsp-server.git")
>> +            (commit version)))
>> +      (file-name (git-file-name name version))
>> +      (sha256
>> +       (base32
>> +        "04fc76pnl8mrwrjw49xhzs4r0dx2vh4gy2y151p33hahylf5z1xs"))))
>> +    (build-system gnu-build-system)
>> +    (arguments
>> +     (list #:modules `((ice-9 match)
>> +                       (ice-9 ftw)
>> +                       ,@%gnu-build-system-modules)
>> +           #:phases
>> +           #~(modify-phases %standard-phases
>> +               (add-after 'unpack 'move-to-guile-directory
>> +                 (lambda _
>> +                   (chdir "./guile")))
>> +               (add-after 'install 'wrap-entrypoint
>> +                 (lambda _
>> +                   (let* ((bin (string-append #$output "/bin"))
>> +                          (site (string-append #$output
>> +                                               "/share/guile/site"))
>> +                          (deps (list #$guile-scheme-json-rpc)))
> 
> It's better to use (assoc-ref inputs ...) here, because
> #$guile-scheme-json-rpc will hardcode the exact package and if someone
> will try to inherit from guile-lsp-server and override
> guile-scheme-json-rpc input, it won't make a desired effect and
> hardcoded version of guile-scheme-json-rpc will be used.
> 
> Also, guile-lsp-server executable doesn't run, it's very likely that
> other required dependencies are missing here in the deps variable.
> 
>> +                     (match (scandir site)
>> +                       (("." ".." version)
>> +                        (let ((modules (string-append site "/"
>> +                                                      version))
>> +                              (compiled-modules (string-append 
>> #$output
>> +                                                 "/lib/guile/"
>> +                                                 version
>> +                                                 "/site-ccache")))
>> +                          (wrap-program (string-append bin
>> +                                         "/guile-lsp-server")
>> +                                        `("GUILE_LOAD_PATH" ":"
>> +                                          prefix
>> +                                          (,modules
>> +                                           ,@(map (lambda (dep)
>> +                                                    (string-append
>> +                                                     dep
>> +
>> "/share/guile/site/"
>> +                                                     version))
>> +                                                  deps)))
>> +                                        `("GUILE_LOAD_COMPILED_PATH"
>> +                                          ":" prefix
>> +                                          (,compiled-modules
>> +                                           ,@(map (lambda (dep)
>> +                                                    (string-append
>> +                                                     dep
>> +                                                     "/lib/guile/"
>> +                                                     version
>> +                                                     "/site-ccache"))
>> +                                              deps))))
>> +                          #t)))))))))
>> +    (native-inputs (list pkg-config))
>> +    (inputs
>> +     ;; Depend on the latest Guile to avoid bytecode compatibility
>> issues when
>> +     ;; using modules built against the latest version.
>> +     (list bash-minimal
>> +           guile-3.0-latest))
>> +    (propagated-inputs (list guile-irregex
>> +                             guile-scheme-json-rpc
>> +                             guile-srfi-145
>> +                             guile-srfi-180))
> 
> For standalone programs like guile-lsp-server, where we manually
> construct GUILE_LOAD_PATH it's not needed to propagate dependencies in
> the profile, where package is installed.  It should be just inputs.
> 
>> +    (synopsis "LSP (Language Server Protocol) server for Scheme")
>> +    (description
>> +     "@code{guile-lsp-server} is an implementation for Guile of the 
>> LSP
>> +specification.  This software aims to support several Scheme
>> implementations.
>> +To achieve this, the code is designed to contain as much logic as
>> possible in
>> +R7RS Scheme, separating implementation-specific code in different
>> modules.
>> +
>> +This package delivers Guile's implementation for
>> @code{scheme-lsp-server}.")
>> +    (home-page "https://codeberg.org/rgherdt/scheme-lsp-server")
>> +    (license license:expat)))
>> +
>>   (define-public guile-squee
>>     (let ((commit "fab9d9590792f3ededd4abd8cfa6be5e56659678")
>>           (revision "4"))
>> 
>> base-commit: 392f9db97687bfb6195e65a28e1710f22b6cb972
> 
> Applied first part of the patch, pushed as
> https://git.savannah.gnu.org/cgit/guix.git/commit/?id=56667ee55c
> 
> Please update the guile-lsp-server package definition to make it work
> (right now package builds, but executable fails to run).
> 
> P.S. Thanks to Giacomo for spinning up this thread!




This bug report was last modified today.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.