GNU bug report logs -
#53676
[PATCH 0/5] *** PulseAudio service improvements ***
Previous Next
Full log
Message #148 received at 53676 <at> debbugs.gnu.org (full text, mbox):
Hi Maxime,
Maxime Devos <maximedevos <at> telenet.be> writes:
> Maxim Cournoyer schreef op do 24-02-2022 om 11:38 [-0500]:
>> + (define (file-like->name file)
>> + (match file
>> + ((? local-file?)
>> + (local-file-name file))
>> + ((? plain-file?)
>> + (plain-file-name file))
>> + ((? computed-file?)
>> + (computed-file-name file))
>> + (_ (leave (G_ "~a is not a local-file, plain-file or \
>> +computed-file object~%") file))))
>
> This would not work with things like '(file-append ...)'.
> Perhaps 'extra-script-files->file-union' can be made more general
> by creating a variant of 'file-union' for this use case?
> Maybe something like (untested):
>
> ;; Based on 'file-union'
> (define* (file-directory . files)
> ; files: (file-like1 file-like2 ...)
> (computed-file name
> (with-imported-modules '((guix build utils))
> (gexp
> (begin
> (use-modules (guix build utils))
>
> (mkdir (ungexp output))
> (chdir (ungexp output))
> (ungexp-splicing
> (map (lambda (source)
> (gexp
> (let ((target (basename source))
> ;; Stat the source to abort early if it does
> ;; not exist.
> (stat (ungexp source))
> (symlink (ungexp source) (ungexp target)))))
> files)))))))
Not a bad idea, but it steers a bit on the too-complicated side of
things for my taste; for one thing, I wouldn't know how to do the
validation of the file name anymore (it needs to end by ".pa"). It
could be done inside that procedure, but it'd become more tangled.
The simple file-like->name procedure above will error with an accurate
message telling the users about its limits (that it only accepts
local-file, plain-file or computed-file).
G-Exp wizards can still opt the mixed-text-file + any G-Exp
transformation they wish via the 'script-file' field.
Thanks,
Maxim
This bug report was last modified 3 years and 145 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.