GNU bug report logs - #61774
[PATCH] gnu: Add luarocks.

Previous Next

Package: guix-patches;

Reported by: Timo Wilken <guix <at> twilken.net>

Date: Fri, 24 Feb 2023 22:47:02 UTC

Severity: normal

Tags: moreinfo, patch

Done: Andrew Tropin <andrew <at> trop.in>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 61774 in the body.
You can then email your comments to 61774 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#61774; Package guix-patches. (Fri, 24 Feb 2023 22:47:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Timo Wilken <guix <at> twilken.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 24 Feb 2023 22:47:02 GMT) Full text and rfc822 format available.

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

From: Timo Wilken <guix <at> twilken.net>
To: guix-patches <at> gnu.org
Cc: Timo Wilken <guix <at> twilken.net>
Subject: [PATCH] gnu: Add luarocks.
Date: Fri, 24 Feb 2023 23:46:13 +0100
Luarocks is a package manager for Lua modules.

It is used by the Prosody XMPP server (already packaged in Guix) to
install extensions.

* gnu/packages/lua.scm (luarocks): Add variable.
---
 gnu/packages/lua.scm | 50 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm
index d50890bf1e..3d18e18ca9 100644
--- a/gnu/packages/lua.scm
+++ b/gnu/packages/lua.scm
@@ -18,6 +18,7 @@
 ;;; Copyright © 2022 Brandon Lucas <br <at> ndon.dk>
 ;;; Copyright © 2022 Luis Henrique Gomes Higino <luishenriquegh2701 <at> gmail.com>
 ;;; Copyright © 2022 Leo Nikkilä <hello <at> lnikki.la>
+;;; Copyright © 2023 Timo Wilken <guix <at> twilken.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -49,6 +50,7 @@ (define-module (gnu packages lua)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages build-tools)
+  #:use-module (gnu packages compression)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages libevent)
@@ -1126,6 +1128,54 @@ (define-public lua-resty-shell
 shell command executions.")
     (license license:bsd-3)))
 
+(define-public luarocks
+  (package
+    (name "luarocks")
+    (version "3.9.2")
+    (home-page "https://luarocks.org/")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://luarocks.org/releases/luarocks-"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "1nsfp7cwqcxa8vmkcqkgi5wc0iax0j3gbdfd183kw81cq3nf99mw"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:tests? #f ;upstream has no tests
+       #:phases (modify-phases %standard-phases
+                  (add-before 'build 'patch-bin-sh
+                    (lambda* (#:key inputs #:allow-other-keys)
+                      (substitute* '("GNUmakefile" "src/luarocks/fs/unix.lua"
+                                     "src/luarocks/core/sysdetect.lua")
+                        (("/bin/sh")
+                         (string-append (assoc-ref inputs "bash-minimal")
+                                        "/bin/sh")))))
+                  (replace 'configure
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let ((out (assoc-ref outputs "out")))
+                        (invoke "./configure"
+                                (string-append "--prefix=" out))))))))
+    (inputs (list lua bash-minimal))
+    (native-inputs (list unzip))
+    (synopsis "A package manager for Lua modules")
+    (description
+     "LuaRocks is the package manager for the Lua programming
+language.
+
+It allows you to install Lua modules as self-contained packages called
+@url{https://luarocks.org/en/Types_of_rocks, @emph{rocks}}, which also contain
+version @url{https://luarocks.org/en/Dependencies, dependency} information.
+This information can be used both during installation, so that when one rock
+is requested all rocks it depends on are installed as well, and also
+optionally at run time, so that when a module is required, the correct version
+is loaded.  LuaRocks supports both local and
+@url{http://luarocks.org/en/Rocks_repositories, remote} repositories, and
+multiple local rocks trees.")
+    ;; The home page says:
+    ;; "LuaRocks is free software and uses the same license as Lua."
+    (license license:x11)))
+
 (define-public emilua
   (package
    (name "emilua")
-- 
2.39.1





Information forwarded to guix-patches <at> gnu.org:
bug#61774; Package guix-patches. (Sun, 26 Feb 2023 16:10:02 GMT) Full text and rfc822 format available.

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

From: Timo Wilken <guix <at> twilken.net>
To: 61774 <at> debbugs.gnu.org
Cc: Timo Wilken <guix <at> twilken.net>
Subject: [PATCH] gnu: luarocks: Add for Lua 5.2 and fix dependencies.
Date: Sun, 26 Feb 2023 17:08:19 +0100
Luarocks requires some external binaries, which should be set in its
config file instead of relying on the calling user's PATH containing
them.

Also, for use with Prosody, luarocks needs to be built against Lua
5.2, so provide multiple versions of the package, like for other Lua
packages.

* gnu/packages/lua.scm (make-luarocks): New function.
* gnu/packages/lua.scm (lua5.2-luarocks): New variable.
---
 gnu/packages/lua.scm | 94 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 78 insertions(+), 16 deletions(-)

diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm
index 3d18e18ca9..4771fa1d42 100644
--- a/gnu/packages/lua.scm
+++ b/gnu/packages/lua.scm
@@ -47,11 +47,15 @@ (define-module (gnu packages lua)
   #:use-module (guix build-system meson)
   #:use-module (guix build-system trivial)
   #:use-module (gnu packages)
+  #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages boost)
+  #:use-module (gnu packages curl)
   #:use-module (gnu packages build-tools)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages glib)
+  #:use-module (gnu packages gnupg)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages libevent)
   #:use-module (gnu packages libffi)
@@ -61,11 +65,15 @@ (define-module (gnu packages lua)
   #:use-module (gnu packages pretty-print)
   #:use-module (gnu packages re2c)
   #:use-module (gnu packages readline)
+  #:use-module (gnu packages rsync)
+  #:use-module (gnu packages ssh)
   #:use-module (gnu packages tls)
+  #:use-module (gnu packages version-control)
   #:use-module (gnu packages vim)
+  #:use-module (gnu packages wget)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
-  #:use-module (srfi srfi-1))
+  #:use-module ((srfi srfi-1) #:hide (zip)))
 
 (define-public lua
   (package
@@ -1142,21 +1150,69 @@ (define-public luarocks
                 "1nsfp7cwqcxa8vmkcqkgi5wc0iax0j3gbdfd183kw81cq3nf99mw"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:tests? #f ;upstream has no tests
-       #:phases (modify-phases %standard-phases
-                  (add-before 'build 'patch-bin-sh
-                    (lambda* (#:key inputs #:allow-other-keys)
-                      (substitute* '("GNUmakefile" "src/luarocks/fs/unix.lua"
-                                     "src/luarocks/core/sysdetect.lua")
-                        (("/bin/sh")
-                         (string-append (assoc-ref inputs "bash-minimal")
-                                        "/bin/sh")))))
-                  (replace 'configure
-                    (lambda* (#:key outputs #:allow-other-keys)
-                      (let ((out (assoc-ref outputs "out")))
-                        (invoke "./configure"
-                                (string-append "--prefix=" out))))))))
-    (inputs (list lua bash-minimal))
+     `(#:tests? #f ;upstream has no tests
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'patch-bin-sh
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* '("GNUmakefile" "src/luarocks/fs/unix.lua"
+                            "src/luarocks/core/sysdetect.lua")
+               (("/bin/sh")
+                (string-append (assoc-ref inputs "bash-minimal")
+                               "/bin/sh")))))
+         (replace 'configure
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (invoke "./configure"
+                       (string-append "--prefix=" out)))))
+         (add-after 'install 'patch-unzip
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (substitute*
+                 (string-append
+                  (assoc-ref outputs "out") "/etc/luarocks/config-"
+                  ,(substring (package-version lua) 0 3) ".lua") ;e.g. "5.2"
+               (("variables = \\{")
+                (string-append
+                 "variables = {\n"
+                 "   AR = \"" (assoc-ref inputs "binutils") "/bin/ar\";\n"
+                 "   BUNZIP2 = \"" (assoc-ref inputs "bzip2") "/bin/bunzip2\";\n"
+                 "   CC = \"" (assoc-ref inputs "gcc") "/bin/gcc\";\n"
+                 "   CHMOD = \"" (assoc-ref inputs "coreutils") "/bin/chmod\";\n"
+                 "   CMAKE = \"" (assoc-ref inputs "coreutils") "/bin/cmake\";\n"
+                 "   CP = \"" (assoc-ref inputs "coreutils") "/bin/cp\";\n"
+                 "   CURL = \"" (assoc-ref inputs "curl") "/bin/curl\";\n"
+                 "   CVS = \"" (assoc-ref inputs "cvs") "/bin/cvs\";\n"
+                 "   FIND = \"" (assoc-ref inputs "findutils") "/bin/find\";\n"
+                 "   GIT = \"" (assoc-ref inputs "git") "/bin/git\";\n"
+                 "   GPG = \"" (assoc-ref inputs "gnupg") "/bin/gpg\";\n"
+                 "   GUNZIP = \"" (assoc-ref inputs "gzip") "/bin/gunzip\";\n"
+                 "   HG = \"" (assoc-ref inputs "mercurial") "/bin/hg\";\n"
+                 "   LD = \"" (assoc-ref inputs "binutils") "/bin/ld\";\n"
+                 "   LS = \"" (assoc-ref inputs "coreutils") "/bin/ls\";\n"
+                 "   MAKE = \"" (assoc-ref inputs "make") "/bin/make\";\n"
+                 "   MD5SUM = \"" (assoc-ref inputs "coreutils") "/bin/md5sum\";\n"
+                 "   MKDIR = \"" (assoc-ref inputs "coreutils") "/bin/mkdir\";\n"
+                 "   MKTEMP = \"" (assoc-ref inputs "coreutils") "/bin/mktemp\";\n"
+                 "   OPENSSL = \"" (assoc-ref inputs "openssl") "/bin/openssl\";\n"
+                 "   PWD = \"" (assoc-ref inputs "coreutils") "/bin/pwd\";\n"
+                 "   RANLIB = \"" (assoc-ref inputs "binutils") "/bin/ranlib\";\n"
+                 "   RM = \"" (assoc-ref inputs "coreutils") "/bin/rm\";\n"
+                 "   RMDIR = \"" (assoc-ref inputs "coreutils") "/bin/rmdir\";\n"
+                 "   RSYNC = \"" (assoc-ref inputs "rsync") "/bin/rsync\";\n"
+                 "   SCP = \"" (assoc-ref inputs "openssh") "/bin/scp\";\n"
+                 "   SEVENZ = \"" (assoc-ref inputs "p7zip") "/bin/7z\";\n"
+                 "   SVN = \"" (assoc-ref inputs "subversion") "/bin/svn\";\n"
+                 "   TAR = \"" (assoc-ref inputs "tar") "/bin/tar\";\n"
+                 "   TEST = \"" (assoc-ref inputs "coreutils") "/bin/test\";\n"
+                 "   TOUCH = \"" (assoc-ref inputs "coreutils") "/bin/touch\";\n"
+                 "   UNZIP = \"" (assoc-ref inputs "unzip") "/bin/unzip -n\";\n"
+                 "   WGET = \"" (assoc-ref inputs "wget") "/bin/wget\";\n"
+                 "   ZIP = \"" (assoc-ref inputs "zip") "/bin/zip\";"))))))))
+    (inputs (list lua bash-minimal
+                  ;; Executables required by luarocks.
+                  binutils bzip2 coreutils curl cvs findutils gcc git gnupg
+                  gzip gnu-make mercurial openssh openssl p7zip rsync
+                  subversion tar unzip wget zip))
     (native-inputs (list unzip))
     (synopsis "A package manager for Lua modules")
     (description
@@ -1176,6 +1232,12 @@ (define-public luarocks
     ;; "LuaRocks is free software and uses the same license as Lua."
     (license license:x11)))
 
+(define-public lua5.2-luarocks
+  (make-luarocks "lua5.2-luarocks" lua-5.2))
+
+(define-public luarocks
+  (make-luarocks "luarocks" lua))
+
 (define-public emilua
   (package
    (name "emilua")
-- 
2.39.1





Information forwarded to guix-patches <at> gnu.org:
bug#61774; Package guix-patches. (Thu, 30 Mar 2023 21:15:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Timo Wilken <guix <at> twilken.net>
Cc: 61774 <at> debbugs.gnu.org
Subject: Re: bug#61774: [PATCH] gnu: Add luarocks.
Date: Thu, 30 Mar 2023 23:14:49 +0200
Hi,

Timo Wilken <guix <at> twilken.net> skribis:

> Luarocks is a package manager for Lua modules.
>
> It is used by the Prosody XMPP server (already packaged in Guix) to
> install extensions.
>
> * gnu/packages/lua.scm (luarocks): Add variable.

Could resend the two patches merged as one?

Some comments:

> +                      (substitute* '("GNUmakefile" "src/luarocks/fs/unix.lua"
> +                                     "src/luarocks/core/sysdetect.lua")
> +                        (("/bin/sh")
> +                         (string-append (assoc-ref inputs "bash-minimal")
> +                                        "/bin/sh")))))

Rather (search-input-file inputs "/bin/sh").

> +    (synopsis "A package manager for Lua modules")

I believe ‘guix lint’ will tel you to remove “A”.  :-)

> +    ;; The home page says:
> +    ;; "LuaRocks is free software and uses the same license as Lua."
> +    (license license:x11)))

Please double-check the license in the source (and remove the comment).

> +         (add-after 'install 'patch-unzip
> +           (lambda* (#:key inputs outputs #:allow-other-keys)
> +             (substitute*
> +                 (string-append
> +                  (assoc-ref outputs "out") "/etc/luarocks/config-"
> +                  ,(substring (package-version lua) 0 3) ".lua") ;e.g. "5.2"
> +               (("variables = \\{")
> +                (string-append
> +                 "variables = {\n"
> +                 "   AR = \"" (assoc-ref inputs "binutils") "/bin/ar\";\n"
> +                 "   BUNZIP2 = \"" (assoc-ref inputs "bzip2") "/bin/bunzip2\";\n"
> +                 "   CC = \"" (assoc-ref inputs "gcc") "/bin/gcc\";\n"
> +                 "   CHMOD = \"" (assoc-ref inputs "coreutils") "/bin/chmod\";\n"
> +                 "   CMAKE = \"" (assoc-ref inputs "coreutils") "/bin/cmake\";\n"

These should all use ‘search-input-file’.  However…

> +                 "   CP = \"" (assoc-ref inputs "coreutils") "/bin/cp\";\n"
> +                 "   CURL = \"" (assoc-ref inputs "curl") "/bin/curl\";\n"
> +                 "   CVS = \"" (assoc-ref inputs "cvs") "/bin/cvs\";\n"
> +                 "   FIND = \"" (assoc-ref inputs "findutils") "/bin/find\";\n"
> +                 "   GIT = \"" (assoc-ref inputs "git") "/bin/git\";\n"
> +                 "   GPG = \"" (assoc-ref inputs "gnupg") "/bin/gpg\";\n"

[...]

> +                 "   RSYNC = \"" (assoc-ref inputs "rsync") "/bin/rsync\";\n"
> +                 "   SCP = \"" (assoc-ref inputs "openssh") "/bin/scp\";\n"
> +                 "   SEVENZ = \"" (assoc-ref inputs "p7zip") "/bin/7z\";\n"
> +                 "   SVN = \"" (assoc-ref inputs "subversion") "/bin/svn\";\n"
> +                 "   TAR = \"" (assoc-ref inputs "tar") "/bin/tar\";\n"

Does it really need all these things?  What does ‘guix size luarocks’
say now?

Maybe it’s OK to assume that some of the rarely-used dependencies (say,
CVS, SVN, 7zip) will be picked from $PATH and that it will fail
otherwise?  That would help keep the closure size under control.

> +    (inputs (list lua bash-minimal
> +                  ;; Executables required by luarocks.
> +                  binutils bzip2 coreutils curl cvs findutils gcc git gnupg
> +                  gzip gnu-make mercurial openssh openssl p7zip rsync
> +                  subversion tar unzip wget zip))

Please one per line since there are many of them (you can run ‘guix
style luarocks’).

Could you send an updated patch?

Thanks!

Ludo’.




Added tag(s) moreinfo. Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 08 Aug 2023 15:34:03 GMT) Full text and rfc822 format available.

Reply sent to Andrew Tropin <andrew <at> trop.in>:
You have taken responsibility. (Sun, 26 May 2024 11:28:02 GMT) Full text and rfc822 format available.

Notification sent to Timo Wilken <guix <at> twilken.net>:
bug acknowledged by developer. (Sun, 26 May 2024 11:28:02 GMT) Full text and rfc822 format available.

Message #18 received at 61774-done <at> debbugs.gnu.org (full text, mbox):

From: Andrew Tropin <andrew <at> trop.in>
To: Ludovic Courtès <ludo <at> gnu.org>, Timo Wilken
 <guix <at> twilken.net>
Cc: 61774-done <at> debbugs.gnu.org
Subject: Re: [bug#61774] [PATCH] gnu: Add luarocks.
Date: Sun, 26 May 2024 15:26:43 +0400
[Message part 1 (text/plain, inline)]
On 2023-03-30 23:14, Ludovic Courtès wrote:

> Hi,
>
> Timo Wilken <guix <at> twilken.net> skribis:
>
>> Luarocks is a package manager for Lua modules.
>>
>> It is used by the Prosody XMPP server (already packaged in Guix) to
>> install extensions.
>>
>> * gnu/packages/lua.scm (luarocks): Add variable.
>
> Could resend the two patches merged as one?
>
> Some comments:
>
>> +                      (substitute* '("GNUmakefile" "src/luarocks/fs/unix.lua"
>> +                                     "src/luarocks/core/sysdetect.lua")
>> +                        (("/bin/sh")
>> +                         (string-append (assoc-ref inputs "bash-minimal")
>> +                                        "/bin/sh")))))
>
> Rather (search-input-file inputs "/bin/sh").
>
>> +    (synopsis "A package manager for Lua modules")
>
> I believe ‘guix lint’ will tel you to remove “A”.  :-)
>
>> +    ;; The home page says:
>> +    ;; "LuaRocks is free software and uses the same license as Lua."
>> +    (license license:x11)))
>
> Please double-check the license in the source (and remove the comment).
>
>> +         (add-after 'install 'patch-unzip
>> +           (lambda* (#:key inputs outputs #:allow-other-keys)
>> +             (substitute*
>> +                 (string-append
>> +                  (assoc-ref outputs "out") "/etc/luarocks/config-"
>> +                  ,(substring (package-version lua) 0 3) ".lua") ;e.g. "5.2"
>> +               (("variables = \\{")
>> +                (string-append
>> +                 "variables = {\n"
>> +                 "   AR = \"" (assoc-ref inputs "binutils") "/bin/ar\";\n"
>> +                 "   BUNZIP2 = \"" (assoc-ref inputs "bzip2") "/bin/bunzip2\";\n"
>> +                 "   CC = \"" (assoc-ref inputs "gcc") "/bin/gcc\";\n"
>> +                 "   CHMOD = \"" (assoc-ref inputs "coreutils") "/bin/chmod\";\n"
>> +                 "   CMAKE = \"" (assoc-ref inputs "coreutils") "/bin/cmake\";\n"
>
> These should all use ‘search-input-file’.  However…
>
>> +                 "   CP = \"" (assoc-ref inputs "coreutils") "/bin/cp\";\n"
>> +                 "   CURL = \"" (assoc-ref inputs "curl") "/bin/curl\";\n"
>> +                 "   CVS = \"" (assoc-ref inputs "cvs") "/bin/cvs\";\n"
>> +                 "   FIND = \"" (assoc-ref inputs "findutils") "/bin/find\";\n"
>> +                 "   GIT = \"" (assoc-ref inputs "git") "/bin/git\";\n"
>> +                 "   GPG = \"" (assoc-ref inputs "gnupg") "/bin/gpg\";\n"
>
> [...]
>
>> +                 "   RSYNC = \"" (assoc-ref inputs "rsync") "/bin/rsync\";\n"
>> +                 "   SCP = \"" (assoc-ref inputs "openssh") "/bin/scp\";\n"
>> +                 "   SEVENZ = \"" (assoc-ref inputs "p7zip") "/bin/7z\";\n"
>> +                 "   SVN = \"" (assoc-ref inputs "subversion") "/bin/svn\";\n"
>> +                 "   TAR = \"" (assoc-ref inputs "tar") "/bin/tar\";\n"
>
> Does it really need all these things?  What does ‘guix size luarocks’
> say now?
>
> Maybe it’s OK to assume that some of the rarely-used dependencies (say,
> CVS, SVN, 7zip) will be picked from $PATH and that it will fail
> otherwise?  That would help keep the closure size under control.
>
>> +    (inputs (list lua bash-minimal
>> +                  ;; Executables required by luarocks.
>> +                  binutils bzip2 coreutils curl cvs findutils gcc git gnupg
>> +                  gzip gnu-make mercurial openssh openssl p7zip rsync
>> +                  subversion tar unzip wget zip))
>
> Please one per line since there are many of them (you can run ‘guix
> style luarocks’).
>
> Could you send an updated patch?
>
> Thanks!

Addressed all the comments, pushed as
https://git.savannah.gnu.org/cgit/guix.git/commit/?id=dc8fb56724

-- 
Best regards,
Andrew Tropin
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 24 Jun 2024 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 32 days ago.

Previous Next


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