guix-patches
[Top][All Lists]
Advanced

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

[bug#31089] [PATCH 3/5] services: cgit: Add support for file-like object


From: Ludovic Courtès
Subject: [bug#31089] [PATCH 3/5] services: cgit: Add support for file-like objects.
Date: Tue, 10 Apr 2018 22:59:23 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Clément Lassieur <address@hidden> skribis:

> * doc/guix.texi (Version Control Services): Update accordingly.
> * gnu/services/cgit.scm (serialize-field, serialize-string, serialize-boolean,
> serialize-integer, serialize-repository-cgit-configuration-list,
> serialize-nginx-server-configuration-list, serialize-repo-field,
> serialize-repo-boolean, serialize-repo-integer, serialize-module-link-path,
> serialize-repository-directory, serialize-mimetype-alist): Return strings or
> string-valued gexps and stop printing.
> (repository-cgit-configuration)[source-filter, about-filter, commit-filter,
> logo, owner-filter], (cgit-configuration)[auth-filter, commit-filter, css,
> email-filter, favicon, include, logo, owner-filter, mimetype-file, readme,
> source-filter]: Replace STRING with FILE-OBJECT.
> (file-object?, serialize-file-object, repo-file-object?,
> serialize-repo-file-object): New procedures.
> (cgit-activation): Use SERIALIZE-CONFIGURATION's return value with
> MIXED-TEXT-FILE instead of using its output with PLAIN-FILE.

Nice!

>           (config-str
>            (if opaque-config?
>                (opaque-cgit-configuration-cgitrc config)
> -              (with-output-to-string
> -                (lambda ()
> -                  (serialize-configuration config
> -                                           cgit-configuration-fields))))))
> +              (serialize-configuration config cgit-configuration-fields))))
>      #~(begin
>          (use-modules (guix build utils))
>          (mkdir-p #$(if opaque-config?
>                         (opaque-cgit-configuration-cache-root config)
>                         (cgit-configuration-cache-root config)))
> -        (copy-file #$(plain-file "cgitrc" config-str) "/etc/cgitrc"))))
> +        (copy-file #$(mixed-text-file "cgitrc" config-str)
> +                   "/etc/cgitrc"))))

For clarity, since ‘config-str’ is no longer a string (right?), I’d
rename it to just ‘config’ or something.

Also, could it be that you’re missing ‘apply’ above, as in:

  (apply mixed-text-file "cgitrc" config-str)

?

Otherwise LGTM, thanks!

Ludo’.





reply via email to

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