[PATCH 1/2] gnu: lua-lpeg: Avoid code repetition.

  • Done
  • quality assurance status badge
Details
2 participants
  • Clément Lassieur
  • Ludovic Courtès
Owner
unassigned
Submitted by
Clément Lassieur
Severity
normal
C
C
Clément Lassieur wrote on 25 Nov 2017 16:02
(address . guix-patches@gnu.org)(address . rekado@elephly.net)
20171125150205.26266-1-clement@lassieur.org
* gnu/packages/lua.scm (make-lua-lpeg): New procedure.
(lua-lpeg, lua5.2-lpeg): Call make-lua-lpeg.
---
gnu/packages/lua.scm | 30 ++++++------------------------
1 file changed, 6 insertions(+), 24 deletions(-)

Toggle diff (52 lines)
diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm
index 1667bad8d..d5f55b963 100644
--- a/gnu/packages/lua.scm
+++ b/gnu/packages/lua.scm
@@ -356,9 +356,9 @@ based libraries. It allows using GObject-based libraries directly from Lua.
Notable examples are GTK+, GStreamer and Webkit.")
(license license:expat)))
-(define-public lua-lpeg
+(define (make-lua-lpeg name lua)
(package
- (name "lua-lpeg")
+ (name name)
(version "1.0.1")
(source (origin
(method url-fetch)
@@ -390,29 +390,11 @@ Grammars (PEGs).")
(home-page "http://www.inf.puc-rio.br/~roberto/lpeg")
(license license:expat)))
+(define-public lua-lpeg
+ (make-lua-lpeg "lua-lpeg" lua))
+
(define-public lua5.2-lpeg
- (package (inherit lua-lpeg)
- (name "lua5.2-lpeg")
- ;; XXX: The arguments field is almost an exact copy of the field in
- ;; "lua-lpeg", except for the version string, which was derived from "lua"
- ;; and now is taken from "lua-5.2". See this discussion for context:
- ;; http://lists.gnu.org/archive/html/guix-devel/2017-01/msg02048.html
- (arguments
- `(#:phases
- (modify-phases %standard-phases
- (delete 'configure)
- ;; `make install` isn't available, so we have to do it manually
- (replace 'install
- (lambda* (#:key outputs #:allow-other-keys)
- (let ((out (assoc-ref outputs "out"))
- (lua-version ,(version-major+minor (package-version lua-5.2))))
- (install-file "lpeg.so"
- (string-append out "/lib/lua/" lua-version))
- (install-file "re.lua"
- (string-append out "/share/lua/" lua-version))
- #t))))
- #:test-target "test"))
- (inputs `(("lua", lua-5.2)))))
+ (make-lua-lpeg "lua5.2-lpeg" lua-5.2))
;; Lua 5.3 is not supported.
(define (make-lua-bitop name lua)
--
2.15.0
L
L
Ludovic Courtès wrote on 26 Nov 2017 17:28
(name . Clément Lassieur)(address . clement@lassieur.org)
87indxvway.fsf@gnu.org
Clément Lassieur <clement@lassieur.org> skribis:

Toggle quote (3 lines)
> * gnu/packages/lua.scm (make-lua-lpeg): New procedure.
> (lua-lpeg, lua5.2-lpeg): Call make-lua-lpeg.

LGTM, thanks!

Ludo'.
C
C
Clément Lassieur wrote on 28 Nov 2017 03:55
control message for bug #29437
(address . control@debbugs.gnu.org)
878terf6xj.fsf@lassieur.org
tags 29437 fixed
close 29437
?
Your comment

This issue is archived.

To comment on this conversation send an email to 29437@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 29437
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch