GNU bug report logs - #35692
[PATCH] system: vm: Auto-detect if inputs should be registered.

Previous Next

Package: guix-patches;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Sun, 12 May 2019 00:55:02 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <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 35692 in the body.
You can then email your comments to 35692 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 guix-patches <at> gnu.org:
bug#35692; Package guix-patches. (Sun, 12 May 2019 00:55:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 12 May 2019 00:55:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: guix-patches <guix-patches <at> gnu.org>
Subject: [PATCH] system: vm: Auto-detect if inputs should be registered.
Date: Sat, 11 May 2019 20:50:54 -0400
[Message part 1 (text/plain, inline)]
Hello!

The argument REGISTER-CLOSURE? of the SYSTEM-DOCKER-IMAGE procedure can be
removed and its value computed automatically, since the operating-system
definition is available in its context.  When the operating-system definition
does not contain the GUIX-SERVICE-TYPE, do not register the closure in the
database of Guix, as it takes time and doesn't serve a purpose.

The time saving is close to 2 minutes on my machine for every test using
a very minimal OS configuration and building it with `guix system
docker-image my-config.scm'.

Thank you,

Maxim

[0001-system-vm-Auto-detect-if-inputs-should-be-registered.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#35692; Package guix-patches. (Sun, 12 May 2019 21:32:01 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: 35692 <at> debbugs.gnu.org
Subject: Re: [bug#35692] [PATCH] system: vm: Auto-detect if inputs should be
 registered.
Date: Sun, 12 May 2019 23:31:21 +0200
Hi Maxim,

Maxim Cournoyer <maxim.cournoyer <at> gmail.com> skribis:

> The argument REGISTER-CLOSURE? of the SYSTEM-DOCKER-IMAGE procedure can be
> removed and its value computed automatically, since the operating-system
> definition is available in its context.  When the operating-system definition
> does not contain the GUIX-SERVICE-TYPE, do not register the closure in the
> database of Guix, as it takes time and doesn't serve a purpose.

That’s clever!

> The time saving is close to 2 minutes on my machine for every test using
> a very minimal OS configuration and building it with `guix system
> docker-image my-config.scm'.

Neat.

>>From 59d78c066727d5c3df22a6e269025ae7e058b45c Mon Sep 17 00:00:00 2001
> From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
> Date: Tue, 16 Apr 2019 17:15:02 -0400
> Subject: [PATCH] system: vm: Auto-detect if inputs should be registered.
                   ^
I’d just write “vm:” here.

> The argument REGISTER-CLOSURE? of the SYSTEM-DOCKER-IMAGE procedure can be
> removed and its value computed automatically, since the operating-system
> definition is available in its context.  When the operating-system definition
> does not contain the GUIX-SERVICE-TYPE, do not register the closure in the
> database of Guix, as it takes time and doesn't serve a purpose.
>
> * gnu/system/vm.scm (use-modules): Add (gnu services base).

Nitpick: We don’t usually document ‘use-modules’ changes here.

> (system-docker-image): Remove the REGISTER-CLOSURES? argument, as well as its
> associate documentation in the docstring.
> [has-guix-service-type?] Add predicate and use it to compute the value of the
> REGISTER-CLOSURE? argument of the INITIALIZE procedure.

> +(define (has-guix-service-type? os)
> +  (find (lambda (service)
> +	  (eq? (service-kind service) guix-service-type))
> +        (operating-system-services os)))

Please add a docstring and make sure there are not tabs.  :-)

Otherwise LGTM, thank you!

Ludo’.




Reply sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
You have taken responsibility. (Tue, 14 May 2019 03:10:02 GMT) Full text and rfc822 format available.

Notification sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
bug acknowledged by developer. (Tue, 14 May 2019 03:10:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35692-done <at> debbugs.gnu.org
Subject: Re: [bug#35692] [PATCH] system: vm: Auto-detect if inputs should be
 registered.
Date: Mon, 13 May 2019 23:09:31 -0400
Hello!

Ludovic Courtès <ludo <at> gnu.org> writes:

[...]

>>>From 59d78c066727d5c3df22a6e269025ae7e058b45c Mon Sep 17 00:00:00 2001
>> From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
>> Date: Tue, 16 Apr 2019 17:15:02 -0400
>> Subject: [PATCH] system: vm: Auto-detect if inputs should be registered.
>                    ^
> I’d just write “vm:” here.

Done.

>> The argument REGISTER-CLOSURE? of the SYSTEM-DOCKER-IMAGE procedure can be
>> removed and its value computed automatically, since the operating-system
>> definition is available in its context.  When the operating-system definition
>> does not contain the GUIX-SERVICE-TYPE, do not register the closure in the
>> database of Guix, as it takes time and doesn't serve a purpose.
>>
>> * gnu/system/vm.scm (use-modules): Add (gnu services base).
>
> Nitpick: We don’t usually document ‘use-modules’ changes here.

OK. I've removed it.

>> (system-docker-image): Remove the REGISTER-CLOSURES? argument, as well as its
>> associate documentation in the docstring.
>> [has-guix-service-type?] Add predicate and use it to compute the value of the
>> REGISTER-CLOSURE? argument of the INITIALIZE procedure.
>
>> +(define (has-guix-service-type? os)
>> +  (find (lambda (service)
>> +	  (eq? (service-kind service) guix-service-type))
>> +        (operating-system-services os)))
>
> Please add a docstring and make sure there are not tabs.  :-)

> Otherwise LGTM, thank you!

No, thanks to you for tirelessly reviewing many contributions while also
producing a mind boggling amount of new code/features :-).

I noticed that this change was breaking tests/guix-system.sh. The reason
was that the HAS-GUIX-SERVICE predicate could return a service type as a
truthy value, which was unwieldy when passed to environments which lack
the service definition.  The solution is to ensure that the predicate
return booleans values, using (not (not ...)).

I've also slightly improved the commit message and some docstrings, and pushed as
commit d03de6be0aa2e2889314b5ed9a8867375363d79f.

Thank you!

Maxim




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 11 Jun 2019 11:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 315 days ago.

Previous Next


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