guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#64471] [PATCH 0/2] File database update services


From: Ludovic Courtès
Subject: [bug#64471] [PATCH 0/2] File database update services
Date: Mon, 17 Jul 2023 22:22:14 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Hello,

Bruno Victal <mirai@makinata.eu> skribis:

> On 2023-07-05 11:16, Ludovic Courtès wrote:
>> +(define-record-type* <file-database-configuration>
>> +  file-database-configuration make-file-database-configuration
>> +  file-database-configuration?
>> +  (package              file-database-configuration-package
>> +                        (default
>> +                          (let-system (system target)
>> +                            ;; Unless we're cross-compiling, avoid pulling a
>> +                            ;; second copy of findutils.
>> +                            (if target
>> +                                findutils
>> +                                (canonical-package findutils)))))
>> +  (schedule             file-database-configuration-schedule
>> +                        (default %default-file-database-update-schedule))
>> +  (excluded-directories file-database-configuration-excluded-directories
>> +                        (default 
>> %default-file-database-excluded-directories)))
>
> How about using define-configuration instead to have the documentation neatly
> in sync with the fields?

Hmm, good point, I’ll take a look.

>> +(define (file-database-mcron-jobs configuration)
>> +  (match-record configuration <file-database-configuration>
>> +    (package schedule excluded-directories)
>> +    (let ((updatedb (program-file
>> +                     "updatedb"
>> +                     #~(execl #$(file-append package "/bin/updatedb")
>> +                              "updatedb"
>> +                              #$(string-append "--prunepaths="
>> +                                               (string-join
>> +                                                excluded-directories))))))
>> +      (list #~(job #$schedule #$updatedb)))))
>
> I'm afraid #$schedule might be insufficient if this is a _mcron_ time-spec.
> There's an elaborate dance done by fstrim-service-type to handle the more 
> exotic
> mcron time expressions, perhaps you can reuse it here?

I’m not sure what fstrim-service-type is trying to achieve with this:

    #~(job
       ;; Note: The “if” below is to ensure that
       ;; lists are ungexp'd correctly since @var{schedule}
       ;; can be either a procedure, a string or a list.
       #$(if (list? schedule)
             #~'(#$@schedule)
             schedule)
       …")

If we simply have:

  #~(job #$schedule …)

then ‘schedule’ can be anything you might expect, like:

  • "0 * * * *"         ;string

  • #~(next-hour …)     ;gexp

  • #~(lambda (x) …)    ;another gexp

What’s the problem? :-)

Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]