GNU bug report logs - #66609
[PATCH 0/1] services: admin: Export rottlog-configuration accessors.

Previous Next

Package: guix-patches;

Reported by: Simon Tournier <zimon.toutoune <at> gmail.com>

Date: Wed, 18 Oct 2023 15:10:02 UTC

Severity: normal

Tags: patch

Done: Simon Tournier <zimon.toutoune <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 66609 in the body.
You can then email your comments to 66609 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to Yann.Dupont <at> univ-nantes.fr, guix-patches <at> gnu.org:
bug#66609; Package guix-patches. (Wed, 18 Oct 2023 15:10:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Simon Tournier <zimon.toutoune <at> gmail.com>:
New bug report received and forwarded. Copy sent to Yann.Dupont <at> univ-nantes.fr, guix-patches <at> gnu.org. (Wed, 18 Oct 2023 15:10:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Simon Tournier <zimon.toutoune <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Simon Tournier <zimon.toutoune <at> gmail.com>
Subject: [PATCH 0/1] services: admin: Export rottlog-configuration accessors.
Date: Wed, 18 Oct 2023 17:08:59 +0200
Hi,

In some cases, people have a template configuration, and then another
configuration with some specific ’log-rotation’ files.  Then, they want to
custom-merge these configurations.  Therefore, they need to access field
values of <rottlog-configuration>.

For one trivial example: replace ’log-rotation’ of syslog defined with
%rotated-files by some others – do not ask why. :-)

--8<---------------cut here---------------start------------->8---
(use-modules (gnu services base)
             (gnu services admin)
             (srfi srfi-1))

(define config-template (rottlog-configuration))

(define some-logs
  (list (log-rotation
         (files '("/var/log/foo"
                  "/var/log/bar"
                  "/var/log/baz"))
         (frequency 'weekly)
         (options `("rotate 16"
                    "sharedscripts"
                    ,@%default-log-rotation-options)))
        (log-rotation
         (files '("/var/log/some-evil.log"))
         (options `("rotate 4"
                    ,@%default-log-rotation-options)))))

(define other-config (rottlog-configuration
                      (rotations some-logs)))

(define my-config
  (rottlog-configuration
   (inherit config-template)
   (rotations (filter
               (lambda (log)
                 (not (lset= eq? (log-rotation-files log) %rotated-files)))
               (append-map rottlog-configuration-rotations
                           (list other-config
                                 config-template))))))
--8<---------------cut here---------------end--------------->8---

Without this patch, it needs to rely on ’@@’ which is not nice.

--8<---------------cut here---------------start------------->8---
(define rottlog-configuration-rotations
  (@@ (gnu services admin) rottlog-rotations))
--8<---------------cut here---------------end--------------->8---

Therefore, let export them!  To stay consistent with the schema for naming,
the accessors are renamed rottlog-configuration-

Cheers,
simon



Simon Tournier (1):
  services: admin: Export rottlog-configuration accessors.

 gnu/services/admin.scm | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)


base-commit: 202c97c4ce2e948266b8b6ee4d80631adbfba92b
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#66609; Package guix-patches. (Wed, 18 Oct 2023 15:11:02 GMT) Full text and rfc822 format available.

Message #8 received at 66609 <at> debbugs.gnu.org (full text, mbox):

From: Simon Tournier <zimon.toutoune <at> gmail.com>
To: 66609 <at> debbugs.gnu.org
Cc: Simon Tournier <zimon.toutoune <at> gmail.com>
Subject: [PATCH 1/1] services: admin: Export rottlog-configuration accessors.
Date: Wed, 18 Oct 2023 17:10:09 +0200
* gnu/services/admin.scm (<rottlog-configuration>): Rename accessors
rottlog-rottlog to rottlog-configuration-rottlog, rottlog-rc-file to
rottlog-configuration-rc-file, rottlog-rotations to
rottlog-configuration-rotations, rottlog-jobs to rottlog-configuration-jobs.
(rottlog-etc, rottlog-jobs-or-default, rottlog-service-type): Adjust
accordingly.
---
 gnu/services/admin.scm | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm
index 5cf74c6e4d..ce27f7f7d3 100644
--- a/gnu/services/admin.scm
+++ b/gnu/services/admin.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2016-2023 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2020 Brice Waegeneire <brice <at> waegenei.re>
 ;;; Copyright © 2023 Giacomo Leidi <goodoldpaul <at> autistici.org>
+;;; Copyright © 2023 Simon Tournier <zimon.toutoune <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -52,6 +53,10 @@ (define-module (gnu services admin)
 
             rottlog-configuration
             rottlog-configuration?
+            rottlog-configuration-rottlog
+            rottlog-configuration-rc-file
+            rottlog-configuration-rotations
+            rottlog-configuration-jobs
             rottlog-service
             rottlog-service-type
 
@@ -193,25 +198,25 @@ (define (default-jobs rottlog)
 (define-record-type* <rottlog-configuration>
   rottlog-configuration make-rottlog-configuration
   rottlog-configuration?
-  (rottlog            rottlog-rottlog             ;file-like
+  (rottlog            rottlog-configuration-rottlog             ;file-like
                       (default rottlog))
-  (rc-file            rottlog-rc-file             ;file-like
+  (rc-file            rottlog-configuration-rc-file             ;file-like
                       (default (file-append rottlog "/etc/rc")))
-  (rotations          rottlog-rotations           ;list of <log-rotation>
+  (rotations          rottlog-configuration-rotations           ;list of <log-rotation>
                       (default %default-rotations))
-  (jobs               rottlog-jobs                ;list of <mcron-job>
+  (jobs               rottlog-configuration-jobs                ;list of <mcron-job>
                       (default #f)))
 
 (define (rottlog-etc config)
   `(("rottlog"
      ,(file-union "rottlog"
-                  (cons `("rc" ,(rottlog-rc-file config))
+                  (cons `("rc" ,(rottlog-configuration-rc-file config))
                         (log-rotations->/etc-entries
-                         (rottlog-rotations config)))))))
+                         (rottlog-configuration-rotations config)))))))
 
 (define (rottlog-jobs-or-default config)
-  (or (rottlog-jobs config)
-      (default-jobs (rottlog-rottlog config))))
+  (or (rottlog-configuration-jobs config)
+      (default-jobs (rottlog-configuration-rottlog config))))
 
 (define rottlog-service-type
   (service-type
@@ -226,12 +231,12 @@ (define rottlog-service-type
                      ;; Add Rottlog to the global profile so users can access
                      ;; the documentation.
                      (service-extension profile-service-type
-                                        (compose list rottlog-rottlog))))
+                                        (compose list rottlog-configuration-rottlog))))
    (compose concatenate)
    (extend (lambda (config rotations)
              (rottlog-configuration
               (inherit config)
-              (rotations (append (rottlog-rotations config)
+              (rotations (append (rottlog-configuration-rotations config)
                                  rotations)))))
    (default-value (rottlog-configuration))))
 
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#66609; Package guix-patches. (Wed, 18 Oct 2023 15:46:01 GMT) Full text and rfc822 format available.

Message #11 received at 66609 <at> debbugs.gnu.org (full text, mbox):

From: Bruno Victal <mirai <at> makinata.eu>
To: Simon Tournier <zimon.toutoune <at> gmail.com>
Cc: 66609 <at> debbugs.gnu.org
Subject: Re: [bug#66609] [PATCH 1/1] services: admin: Export
 rottlog-configuration accessors.
Date: Wed, 18 Oct 2023 16:44:31 +0100
Hi Simon,

On 2023-10-18 16:10, Simon Tournier wrote:
> * gnu/services/admin.scm (<rottlog-configuration>): Rename accessors
> rottlog-rottlog to rottlog-configuration-rottlog, rottlog-rc-file to
> rottlog-configuration-rc-file, rottlog-rotations to
> rottlog-configuration-rotations, rottlog-jobs to rottlog-configuration-jobs.
> (rottlog-etc, rottlog-jobs-or-default, rottlog-service-type): Adjust
> accordingly.

[…]

> +;;; Copyright © 2023 Simon Tournier <zimon.toutoune <at> gmail.com>

The changes don't look original enough to warrant this IMO, other
than that it LGTM.

-- 
Furthermore, I consider that nonfree software must be eradicated.

Cheers,
Bruno.




Information forwarded to guix-patches <at> gnu.org:
bug#66609; Package guix-patches. (Fri, 20 Oct 2023 22:23:02 GMT) Full text and rfc822 format available.

Message #14 received at 66609 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Simon Tournier <zimon.toutoune <at> gmail.com>
Cc: 66609 <at> debbugs.gnu.org
Subject: Re: [bug#66609] [PATCH 1/1] services: admin: Export
 rottlog-configuration accessors.
Date: Sat, 21 Oct 2023 00:21:55 +0200
Hi!

Simon Tournier <zimon.toutoune <at> gmail.com> skribis:

> * gnu/services/admin.scm (<rottlog-configuration>): Rename accessors
> rottlog-rottlog to rottlog-configuration-rottlog, rottlog-rc-file to
> rottlog-configuration-rc-file, rottlog-rotations to
> rottlog-configuration-rotations, rottlog-jobs to rottlog-configuration-jobs.
> (rottlog-etc, rottlog-jobs-or-default, rottlog-service-type): Adjust
> accordingly.

LGTM!

Ludo’.




Reply sent to Simon Tournier <zimon.toutoune <at> gmail.com>:
You have taken responsibility. (Tue, 24 Oct 2023 18:15:03 GMT) Full text and rfc822 format available.

Notification sent to Simon Tournier <zimon.toutoune <at> gmail.com>:
bug acknowledged by developer. (Tue, 24 Oct 2023 18:15:03 GMT) Full text and rfc822 format available.

Message #19 received at 66609-done <at> debbugs.gnu.org (full text, mbox):

From: Simon Tournier <zimon.toutoune <at> gmail.com>
To: Bruno Victal <mirai <at> makinata.eu>, Ludovic Courtès
 <ludo <at> gnu.org>
Cc: 66609-done <at> debbugs.gnu.org
Subject: Re: [bug#66609] [PATCH 1/1] services: admin: Export
 rottlog-configuration accessors.
Date: Tue, 24 Oct 2023 18:56:13 +0200
Hi,

On Wed, 18 Oct 2023 at 16:44, Bruno Victal <mirai <at> makinata.eu> wrote:

> The changes don't look original enough to warrant this IMO, other
> than that it LGTM.

Thanks Bruno and Ludo.  Pushed as 7e4324575c.  Closing.

Cheers,
simon




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 22 Nov 2023 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 208 days ago.

Previous Next


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