GNU bug report logs - #36875
[PATCH] doc: Document the use of `program-file' for mcron jobs.

Previous Next

Package: guix-patches;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Wed, 31 Jul 2019 15:29:01 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#36875: closed ([PATCH] doc: Document the use of
 `program-file' for mcron jobs.)
Date: Sun, 25 Aug 2019 13:57:05 +0000
[Message part 1 (text/plain, inline)]
Your message dated Mon, 26 Aug 2019 07:54:58 +0900
with message-id <8736hog8jh.fsf <at> gmail.com>
and subject line Re: [bug#36875] [PATCH] doc: Document the use of `program-file' for mcron jobs.
has caused the debbugs.gnu.org bug report #36875,
regarding [PATCH] doc: Document the use of `program-file' for mcron jobs.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
36875: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=36875
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: guix-patches <guix-patches <at> gnu.org>
Subject: [PATCH] doc: Document the use of `program-file' for mcron jobs.
Date: Thu, 01 Aug 2019 09:27:45 +0900
[Message part 3 (text/plain, inline)]
Hello!

This follows up to my second post under the thread at
(https://lists.gnu.org/archive/html/help-guix/2019-07/msg00180.html).

It aims to shed some light on (more) complex mcron job Guile scripting
with the aid of Guix features (such as program-file).

[0001-doc-Document-the-use-of-program-file-for-mcron-jobs.patch (text/x-patch, attachment)]
[Message part 5 (text/plain, inline)]
Thanks,

Maxim
[signature.asc (application/pgp-signature, inline)]
[Message part 7 (message/rfc822, inline)]
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Ricardo Wurmus <rekado <at> elephly.net>, 36875-done <at> debbugs.gnu.org
Subject: Re: [bug#36875] [PATCH] doc: Document the use of `program-file' for
 mcron jobs.
Date: Mon, 26 Aug 2019 07:54:58 +0900
Hello Ludovic!

Ludovic Courtès <ludo <at> gnu.org> writes:

> Hello!
>
> Maxim Cournoyer <maxim.cournoyer <at> gmail.com> skribis:
>
>> From 0fffed46b4899bf0485926399d3971a4b5e94408 Mon Sep 17 00:00:00 2001
>> From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
>> Date: Thu, 1 Aug 2019 07:34:17 +0900
>> Subject: [PATCH] doc: Document the use of `program-file' for mcron jobs.
>>
>> * doc/guix.texi (Scheduled Job Execution): Explain why using `program-file'
>> for an mcron job can be necessary.  Add an example.
>
> [...]
>
>> +For more complex jobs defined in Scheme, it is safer to pass the job as a
>> +script to mcron; otherwise, macros defined or imported with @code{use-modules}
>> +wouldn't expand correctly, as Guile requires macros to be strictly defined or
>> +imported at the top level of a Guile module.  This can be achieved using the
>> +@code{program-file} procedure from the @code{(guix gexp)} module, as shown in
>> +the example below.
>
> Macros are a very good example of the problem, but I wonder if it would
> be clearer to simply write something like:
>
>   For more complex jobs defined in Scheme where you need control over
>   the top level, for instance to introduce a @code{use-modules} form, you
>   can move your code to a separate program using the @code{program-file}
>   procedure of the @code{(guix gexp)} module (@pxref{G-Expressions}).
>   The example below illustrates that.

I like your version, which feels to me more elegant. But, from my
experimentation, using (use-modules) in a nested form is fine for
anything else than syntax (macros).  Also, the Guile Reference only says
that macros must be *defined* at the top level; it doesn't explicitly
mention that importing macros is equivalent to defining macros, and are
thus subjected to the same restrictions.  So, I've amended it to mention
the problem more precisely:

--8<---------------cut here---------------start------------->8---
For more complex jobs defined in Scheme where you need control over the top
level, for instance to introduce a @code{use-modules} form that defines syntax
(macros), you can move your code to a separate program using the
@code{program-file} procedure of the @code{(guix gexp)} module
(@pxref{G-Expressions}).  The example below illustrates that.
--8<---------------cut here---------------end--------------->8---

> Anyway, your patch looks like a great improvement (and a funny example
> :-)) so IMO you should push one version or another!

This is now live as commit 1407ebeaa1.  Thanks for feedback/review! :-)

Maxim


This bug report was last modified 5 years and 273 days ago.

Previous Next


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