summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-04-19 00:04:41 +0200
committerLudovic Courtès <ludo@gnu.org>2018-04-19 00:14:50 +0200
commit67a51b675538065a4ec3eb06428d8a4021fdbb87 (patch)
tree50940f78e011f91bb8d64245eb1b0c3f78a0905d
parent4f04e271e3d99d624450cb22987b79359d2d88b1 (diff)
downloadguix-67a51b675538065a4ec3eb06428d8a4021fdbb87.tar.gz
gnu: mcron: Update to 1.1.1.
Fixes <https://bugs.gnu.org/31113>.
Reported by George myglc2 Clemmer <myglc2@gmail.com>.

* gnu/packages/guile.scm (mcron): Update to 1.1.1.
[arguments]: Change timezone in 'set-timezone' phase.  Remove
'disable-schedule-test' and 'wrap-programs' phases.  Add 'adjust-tests'
phase.
* gnu/tests/base.scm (%mcron-os): Change JOB1 to use the 'next-seconds'
form.
-rw-r--r--gnu/packages/guile.scm48
-rw-r--r--gnu/tests/base.scm9
2 files changed, 28 insertions, 29 deletions
diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 03a551a1f2..b954988712 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -661,48 +661,46 @@ library.")
 (define-public mcron
   (package
     (name "mcron")
-    (version "1.1")
+    (version "1.1.1")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://gnu/mcron/mcron-"
                                   version ".tar.gz"))
               (sha256
                (base32
-                "1f547sqqfbp0k02sqk4ivwx8y9mx8l0rrx1c9rrj033av073h6xq"))))
+                "1i9mcp6r6my61zfiydsm3n6my41mwvl7dfala4q29qx0zn1ynlm4"))))
     (build-system gnu-build-system)
     (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.
+                      ;; 'tests/job-specifier.scm' expects to be running in
+                      ;; UTC-2 or something.
+                      ;; FIXME: This issue is being investigated upstream, for
+                      ;; now we'll just skip the tests (see below):
+                      ;; <https://lists.gnu.org/archive/html/bug-mcron/2018-04/msg00005.html>.
                       (let ((tzdata (assoc-ref inputs "tzdata")))
                         (setenv "TZDIR"
                                 (string-append tzdata
                                                "/share/zoneinfo"))
-                        (setenv "TZ" "UTC+1")
+                        (setenv "TZ" "UTC-2")
                         #t)))
-                  (add-before 'check 'disable-schedule-test
+                  (add-before 'check 'adjust-tests
                     (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))))))
+                      (substitute* "tests/job-specifier.scm"
+                        ;; (getpw) fails with "entry not found" in the build
+                        ;; environment, so pass an argument.
+                        (("\\(getpw\\)")
+                         "(getpwnam (getuid))")
+                        ;; The build environment lacks an entry for root in
+                        ;; /etc/passwd.
+                        (("\\(getpw 0\\)")
+                         "(getpwnam \"nobody\")")
+
+                        ;; FIXME: Skip the 4 faulty tests (see above).
+                        (("\\(test-equal \"next-year\"" all)
+                         (string-append "(test-skip 4)\n" all)))
+                      #t)))))
     (native-inputs `(("pkg-config" ,pkg-config)
                      ("tzdata" ,tzdata-for-tests)))
     (inputs `(("ed" ,ed) ("which" ,which) ("guile" ,guile-2.2)))
diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm
index 63d2789cc5..3faeddef6c 100644
--- a/gnu/tests/base.scm
+++ b/gnu/tests/base.scm
@@ -478,11 +478,12 @@ 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.
-  (let ((job1 #~(job next-second-from
+  (let ((job1 #~(job '(next-second '(0 5 10 15 20 25 30 35 40 45 50 55))
                      (lambda ()
-                       (call-with-output-file "witness"
-                         (lambda (port)
-                           (display (list (getuid) (getgid)) port))))))
+                       (unless (file-exists? "witness")
+                        (call-with-output-file "witness"
+                          (lambda (port)
+                            (display (list (getuid) (getgid)) port)))))))
         (job2 #~(job next-second-from
                      (lambda ()
                        (call-with-output-file "witness"