gnu: mcron: Update to 1.1 and deprecate "mcron2".

* gnu/packages/guile.scm (mcron): Update to 1.1.
[native-inputs]: Add TZDATA-FOR-TESTS.
[arguments]: New field.
(mcron2): Define using 'deprecated-package'.
* gnu/services/mcron.scm: Replace 'mcron2' with 'mcron'.
* doc/guix.texi (Scheduled Job Execution): Likewise.
* gnu/tests/base.scm (%mcron-os): Remove comment about mcron2.
This commit is contained in:
Ludovic Courtès 2018-03-19 23:16:48 +01:00
parent f88028c432
commit cfbf6de18c
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
4 changed files with 53 additions and 79 deletions

View File

@ -10479,7 +10479,7 @@ gexps to introduce job definitions that are passed to mcron
for more information on mcron job specifications. Below is the
reference of the mcron service.
@deffn {Scheme Procedure} mcron-service @var{jobs} [#:mcron @var{mcron2}]
@deffn {Scheme Procedure} mcron-service @var{jobs} [#:mcron @var{mcron}]
Return an mcron service running @var{mcron} that schedules @var{jobs}, a
list of gexps denoting mcron job specifications.
@ -10504,7 +10504,7 @@ mcron jobs to run.
Data type representing the configuration of mcron.
@table @asis
@item @code{mcron} (default: @var{mcron2})
@item @code{mcron} (default: @var{mcron})
The mcron package to use.
@item @code{jobs}

View File

@ -662,18 +662,51 @@ library.")
(define-public mcron
(package
(name "mcron")
(version "1.0.8")
(version "1.1")
(source (origin
(method url-fetch)
(uri (string-append "mirror://gnu/mcron/mcron-"
version ".tar.gz"))
(sha256
(base32
"0zparwgf01jgl1x53ik71ghabldq6zz18ha4dscps1i0qrzgap1b"))
(patches (search-patches "mcron-install.patch"))))
(method url-fetch)
(uri (string-append "mirror://gnu/mcron/mcron-"
version ".tar.gz"))
(sha256
(base32
"1f547sqqfbp0k02sqk4ivwx8y9mx8l0rrx1c9rrj033av073h6xq"))))
(build-system gnu-build-system)
(native-inputs `(("pkg-config" ,pkg-config)))
(inputs `(("ed" ,ed) ("which" ,which) ("guile" ,guile-2.0)))
(arguments
'(#:phases (modify-phases %standard-phases
(add-before 'check 'set-timezone
(lambda* (#:key inputs #:allow-other-keys)
;; 'tests/schedule.sh' expects to be running in UTC+1.
(let ((tzdata (assoc-ref inputs "tzdata")))
(setenv "TZDIR"
(string-append tzdata
"/share/zoneinfo"))
(setenv "TZ" "UTC+1")
#t)))
(add-before 'check 'disable-schedule-test
(lambda _
;; But! As it turns out, that test additionally relies
;; on non-deterministic behavior; see
;; <https://lists.gnu.org/archive/html/bug-mcron/2018-03/msg00001.html>.
(substitute* "tests/schedule.sh"
(("mkdir cron") "exit 77\n"))
#t))
(add-after 'install 'wrap-programs
(lambda* (#:key outputs #:allow-other-keys)
;; By default mcron doesn't have its own modules in the
;; search path, so the 'mcron' command fails to start.
(let* ((output (assoc-ref outputs "out"))
(modules (string-append output
"/share/guile/site/2.2"))
(go (string-append output
"/lib/guile/2.2/site-ccache")))
(wrap-program (string-append output "/bin/mcron")
`("GUILE_LOAD_PATH" ":" prefix
(,modules))
`("GUILE_LOAD_COMPILED_PATH" ":" prefix (,go)))
#t))))))
(native-inputs `(("pkg-config" ,pkg-config)
("tzdata" ,tzdata-for-tests)))
(inputs `(("ed" ,ed) ("which" ,which) ("guile" ,guile-2.2)))
(home-page "https://www.gnu.org/software/mcron/")
(synopsis "Run jobs at scheduled times")
(description
@ -684,67 +717,8 @@ format is also supported.")
(license license:gpl3+)))
(define-public mcron2
;; This is mthl's mcron development branch, not yet merged in mcron.
(let ((commit "31baff1a5187d8ddc89324cbe42dbeffc309c962"))
(package
(inherit mcron)
(name "mcron2")
(version (string-append (package-version mcron) "-0."
(string-take commit 7)))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://notabug.org/mthl/mcron/")
(commit commit)))
(sha256
(base32
"1h5wxy997hxi718hpx419c23q09939kbxrjbbq54lv0cgw1bb63z"))
(file-name (string-append name "-" version "-checkout"))))
(native-inputs
`(("autoconf" ,autoconf)
("automake" ,automake)
("pkg-config" ,pkg-config)
("texinfo" ,texinfo)
("help2man" ,help2man)))
(inputs
`(("guile-2.2" ,guile-2.2)
,@(srfi-1:alist-delete "guile" (package-inputs mcron))))
(arguments
`(#:modules ((ice-9 match) (ice-9 ftw)
,@%gnu-build-system-modules)
;; When building the targets in parallel, help2man tries to generate
;; the manpage from ./cron --help before it is built, which fails.
#:parallel-build? #f
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'use-guile-2.2
(lambda _
(substitute* "configure.ac"
(("PKG_CHECK_MODULES\\(\\[GUILE\\],.*$")
"PKG_CHECK_MODULES([GUILE], [guile-2.2])\n")
(("guile/site/2.0")
"guile/site/2.2"))
#t))
(add-after 'use-guile-2.2 'bootstrap
(lambda _
(invoke "autoreconf" "-vfi")))
(add-after 'install 'wrap-mcron
(lambda* (#:key outputs #:allow-other-keys)
;; Wrap the 'mcron' command to refer to the right
;; modules.
(let* ((out (assoc-ref outputs "out"))
(bin (string-append out "/bin"))
(site (string-append
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))))))))))))
;; This was mthl's mcron development branch, and it became mcron 1.1.
(deprecated-package "mcron2" mcron))
(define-public guile-ics
(package

View File

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@ -20,7 +20,7 @@
#:use-module (gnu services)
#:use-module (gnu services base)
#:use-module (gnu services shepherd)
#:autoload (gnu packages guile) (mcron2)
#:autoload (gnu packages guile) (mcron)
#:use-module (guix records)
#:use-module (guix gexp)
#:use-module (srfi srfi-1)
@ -53,7 +53,7 @@
make-mcron-configuration
mcron-configuration?
(mcron mcron-configuration-mcron ;package
(default mcron2))
(default mcron))
(jobs mcron-configuration-jobs ;list of <mcron-job>
(default '())))
@ -100,7 +100,7 @@
jobs)))))
(default-value (mcron-configuration)))) ;empty job list
(define* (mcron-service jobs #:optional (mcron mcron2))
(define* (mcron-service jobs #:optional (mcron mcron))
"Return an mcron service running @var{mcron} that schedules @var{jobs}, a
list of gexps denoting mcron job specifications.

View File

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@ -477,7 +477,7 @@ in a loop. See <http://bugs.gnu.org/26931>.")
(define %mcron-os
;; System with an mcron service, with one mcron job for "root" and one mcron
;; job for an unprivileged user (note: #:user is an 'mcron2' thing.)
;; job for an unprivileged user.
(let ((job1 #~(job next-second-from
(lambda ()
(call-with-output-file "witness"