[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#28960] [PATCH] services: Add murmur.
From: |
nee |
Subject: |
[bug#28960] [PATCH] services: Add murmur. |
Date: |
Mon, 30 Oct 2017 23:38:06 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
Am 24.10.2017 um 23:34 schrieb Ludovic Courtès:
> Indeed. I figured something like this works:
>
> --8<---------------cut here---------------start------------->8---
> scheme@(guile-user)> (define-syntax match-record
> (syntax-rules ()
> ((_ record type (field fields ...) body ...)
> (if (eq? (struct-vtable record) type)
> (let ((field ((record-accessor type 'field)
> record)))
> (match-record record type (fields ...) body
> ...))
> (throw 'wrong-type-arg record)))
> ((_ record type () body ...)
> (begin body ...))))
> scheme@(guile-user)> (match-record coreutils (@@ (guix packages) <package>)
> (home-page) home-page)
> $6 = "https://www.gnu.org/software/coreutils/"
> scheme@(guile-user)> (match-record coreutils (@@ (guix packages) <package>)
> (home-page synopsis) (list synopsis home-page))
> $7 = ("Core GNU utilities (file, text, shell)"
> "https://www.gnu.org/software/coreutils/")
> --8<---------------cut here---------------end--------------->8---
Great!
>
> We could use that for now.
>
> Eventually though, we should have something better in (guix records)
> that (1) computes indices and report wrong-field-name errors at
> expansion time, and (2) accounts for thunked/delayed fields.
>
> WDYT?
I didn't even know guix records had those features :)
>
> If the above macro is good enough, we can add it to (guix records) with
> a TODO comment. That would already be better than the other options.
>
I added it for now. Personally I don't like having functions with big
TODOs like this. What would be the solution for thunked delayed fields?
Force them as they are bound in the let?
>> I also noticed a missing equal sign after rememberchannel in the
>> defaultconfig and added that.
>
> I noticed a couple of obvious mistakes:
>
>
>
> diff --git a/gnu/services/telephony.scm b/gnu/services/telephony.scm
> index 0c30b409f..a305a1be8 100644
> --- a/gnu/services/telephony.scm
> +++ b/gnu/services/telephony.scm
> @@ -240,7 +240,7 @@ Or set public-registration to #f")))))))))
> (define (murmur-activation config)
> #~(begin
> (use-modules (guix build utils))
> - (let ((log-dir (dirname #$(murmur-configuration-log-file config)))
> + (let* ((log-dir (dirname #$(murmur-configuration-log-file config)))
> (pid-dir (dirname #$(murmur-configuration-pid-file config)))
> (db-dir (dirname #$(murmur-configuration-database-file config)))
> (user (getpwnam #$(murmur-configuration-user config)))
I think there was no mistake here the init-dir function took the user as
argument, but I changed it into the let* form and removed the argument now.
> @@ -283,7 +283,7 @@ Or set public-registration to #f")))))))))
> (documentation "Run the murmur mumble-server.")
> (requirement '(networking))
> (start #~(make-forkexec-constructor
> - '(#$(file-append (murmur-configuration-package)
> + '(#$(file-append (murmur-configuration-package config)
> "/bin/murmurd")
> "-ini"
> #$(or (murmur-configuration-file config)
>
Ouch, so much about me thinking that I could just make a quick change.
>
> This makes me think that it would be good to have a unit test. Would
> you like to try writing one now (see the examples in gnu/tests/*.scm),
> or do you prefer to leave it for later?
I would like to write some tests, but right now I need to setup my guix
development environment on a different computer first. On my current
setup I have 15 gigabytes of free hard drive space and when I run `make
check-system` it fails with some 'no space left on device' message.
>
> In the latter case, please test the system to make sure it actually
> works (that can be done in a VM.)
For this patch:
I ran make and got no warnings.
I deployed it on my server and connected with mumble from my computer
and it worked.
0001-guix-records-Add-match-record.patch
Description: Text Data
0002-services-Add-murmur.patch
Description: Text Data