gnu: mcron2: Use Guile 2.2 instead of 2.0.

Motivation: Using Guile 2.2 instead of Guile 2.0 gives us the scripting
abilities of Guile 2.2 when writing mcron jobs, such as HTTPS support.

* gnu/packages/guile.scm (gnu): Use the srfi-1 module for the alist-delete
function.
(mcron2)[inputs]: Replace guile-2.0 with guile-2.2.
[parallel-build?]: Disable to fix manual page generation.
[phases]: Add a "use-guile-2.2" phase so the build system uses Guile 2.2.
Replace `system*' with `invoke' in the "bootstrap" phase.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Maxim Cournoyer 2018-01-30 22:38:10 -05:00 committed by Ludovic Courtès
parent 31bd4175c9
commit d4660a5440
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 37 additions and 23 deletions

View File

@ -16,6 +16,7 @@
;;; Copyright © 2017 Theodoros Foradis <theodoros@foradis.org> ;;; Copyright © 2017 Theodoros Foradis <theodoros@foradis.org>
;;; Copyright © 2017 ng0 <ng0@infotropique.org> ;;; Copyright © 2017 ng0 <ng0@infotropique.org>
;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr> ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -72,7 +73,8 @@
#:use-module (guix build-system gnu) #:use-module (guix build-system gnu)
#:use-module (guix build-system trivial) #:use-module (guix build-system trivial)
#:use-module (guix utils) #:use-module (guix utils)
#:use-module (ice-9 match)) #:use-module (ice-9 match)
#:use-module ((srfi srfi-1) #:prefix srfi-1:))
;;; Commentary: ;;; Commentary:
;;; ;;;
@ -629,31 +631,43 @@ format is also supported.")
("pkg-config" ,pkg-config) ("pkg-config" ,pkg-config)
("texinfo" ,texinfo) ("texinfo" ,texinfo)
("help2man" ,help2man))) ("help2man" ,help2man)))
(inputs
`(("guile-2.2" ,guile-2.2)
,@(srfi-1:alist-delete "guile" (package-inputs mcron))))
(arguments (arguments
`(#:modules ((ice-9 match) (ice-9 ftw) `(#:modules ((ice-9 match) (ice-9 ftw)
,@%gnu-build-system-modules) ,@%gnu-build-system-modules)
;; When building the targets in parallel, help2man tries to generate
#:phases (modify-phases %standard-phases ;; the manpage from ./cron --help before it is built, which fails.
(add-after 'unpack 'bootstrap #:parallel-build? #f
(lambda _ #:phases
(zero? (system* "autoreconf" "-vfi")))) (modify-phases %standard-phases
(add-after 'install 'wrap-mcron (add-after 'unpack 'use-guile-2.2
(lambda* (#:key outputs #:allow-other-keys) (lambda _
;; Wrap the 'mcron' command to refer to the right (substitute* "configure.ac"
;; modules. (("PKG_CHECK_MODULES\\(\\[GUILE\\],.*$")
(let* ((out (assoc-ref outputs "out")) "PKG_CHECK_MODULES([GUILE], [guile-2.2])\n"))
(bin (string-append out "/bin")) #t))
(site (string-append (add-after 'use-guile-2.2 'bootstrap
out "/share/guile/site"))) (lambda _
(match (scandir site) (invoke "autoreconf" "-vfi")))
(("." ".." version) (add-after 'install 'wrap-mcron
(let ((modules (string-append site "/" version))) (lambda* (#:key outputs #:allow-other-keys)
(wrap-program (string-append bin "/mcron") ;; Wrap the 'mcron' command to refer to the right
`("GUILE_LOAD_PATH" ":" prefix ;; modules.
(,modules)) (let* ((out (assoc-ref outputs "out"))
`("GUILE_LOAD_COMPILED_PATH" ":" prefix (bin (string-append out "/bin"))
(,modules))) (site (string-append
#t)))))))))))) out "/share/guile/site")))
(match (scandir site)
(("." ".." version)
(let ((modules (string-append site "/" version)))
(wrap-program (string-append bin "/mcron")
`("GUILE_LOAD_PATH" ":" prefix
(,modules))
`("GUILE_LOAD_COMPILED_PATH" ":" prefix
(,modules)))
#t))))))))))))
(define-public guile-ics (define-public guile-ics
(package (package