guix-devel
[Top][All Lists]
Advanced

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

Re: package.scm: (profile-derivation (%store) '())


From: Ludovic Courtès
Subject: Re: package.scm: (profile-derivation (%store) '())
Date: Fri, 20 Sep 2013 23:35:09 +0200
User-agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux)

Nikita Karetnikov <address@hidden> skribis:

>> ‘%store’ is a SRFI-39 parameter (info "(guile) Parameters"), aka. a
>> dynamically-scoped variable.
>
>> It is initialized with the ‘parameterize’ form, which sets its value for
>> the dynamic extent of its body.
>
> I don’t understand what code initializes ‘%store’.

This:

          (parameterize ((%store (open-connection)))
             ...)

> For example, I have one generation in the ‘test’ profile.  So ‘test’
> points to ‘test-1-link’.  If I do
>
> scheme@(guix scripts package)> (roll-back "test")
>
> I get an error
>
> guix/derivations.scm:428:17: In procedure derivation->output-path:
> guix/derivations.scm:428:17: In procedure struct_vtable: Wrong type argument 
> in position 1 (expecting struct): #f
>
> Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
> scheme@(guix scripts package) [1]> 

I suspect it’s the ‘%guile-for-build’ parameter that’s set to #f instead
of being set to a derivation here.  There’s also a ‘parameterize’ form
for that one in guix/scripts/package.scm.

> But why does this command work?
>
> $ ./pre-inst-env guix package -p test --roll-back
> switching from generation 1 to 0

Because it’s designed to work!  :-)

> As far as I understand, this code is called when the above command is
> invoked:
>
>     ;; First roll back if asked to.
>     (if (and (assoc-ref opts 'roll-back?) (not dry-run?))
>         (begin
>           (roll-back profile)
>
> I don’t see any references to ‘%store’ here.

Look for ‘parameterize’; it’s dynamic scoping, which makes it less
visible.

HTH,
Ludo’.



reply via email to

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