* package.scm: (profile-derivation (%store) '())
@ 2013-09-20 17:39 Nikita Karetnikov
2013-09-20 20:21 ` Ludovic Courtès
0 siblings, 1 reply; 4+ messages in thread
From: Nikita Karetnikov @ 2013-09-20 17:39 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 697 bytes --]
I’d like to know how ‘roll-back’ creates an empty generation because
it’s necessary to do the same for ‘--delete-generations’.
However, I fail to understand how (profile-derivation (%store) ‘())
works (or any other function that uses (%store)). I assume that some
code should set ‘%store’ to something else. Like so:
scheme@(guix scripts package)> %store
$1 = #<<parameter> 934e7f8 proc: #<procedure 934e810 at ice-9/boot-9.scm:3154:17 () | (x)>>
scheme@(guix scripts package)> (%store)
$2 = #f
scheme@(guix scripts package)> (%store "FOO")
$3 = #f
scheme@(guix scripts package)> (%store)
$4 = "FOO"
But I don’t see anything similar in ‘package.scm’.
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: package.scm: (profile-derivation (%store) '())
2013-09-20 17:39 package.scm: (profile-derivation (%store) '()) Nikita Karetnikov
@ 2013-09-20 20:21 ` Ludovic Courtès
2013-09-20 21:08 ` Nikita Karetnikov
0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2013-09-20 20:21 UTC (permalink / raw)
To: Nikita Karetnikov; +Cc: guix-devel
Nikita Karetnikov <nikita@karetnikov.org> skribis:
> I’d like to know how ‘roll-back’ creates an empty generation because
> it’s necessary to do the same for ‘--delete-generations’.
>
> However, I fail to understand how (profile-derivation (%store) ‘())
> works (or any other function that uses (%store)). I assume that some
> code should set ‘%store’ to something else. Like so:
>
> scheme@(guix scripts package)> %store
> $1 = #<<parameter> 934e7f8 proc: #<procedure 934e810 at ice-9/boot-9.scm:3154:17 () | (x)>>
> scheme@(guix scripts package)> (%store)
> $2 = #f
> scheme@(guix scripts package)> (%store "FOO")
> $3 = #f
> scheme@(guix scripts package)> (%store)
> $4 = "FOO"
>
> But I don’t see anything similar in ‘package.scm’.
‘%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.
HTH,
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: package.scm: (profile-derivation (%store) '())
2013-09-20 20:21 ` Ludovic Courtès
@ 2013-09-20 21:08 ` Nikita Karetnikov
2013-09-20 21:35 ` Ludovic Courtès
0 siblings, 1 reply; 4+ messages in thread
From: Nikita Karetnikov @ 2013-09-20 21:08 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 1272 bytes --]
> ‘%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’.
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]>
This error is produced by (profile-derivation (%store) '()) since
‘%store’ is set to #f.
But why does this command work?
$ ./pre-inst-env guix package -p test --roll-back
switching from generation 1 to 0
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.
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: package.scm: (profile-derivation (%store) '())
2013-09-20 21:08 ` Nikita Karetnikov
@ 2013-09-20 21:35 ` Ludovic Courtès
0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2013-09-20 21:35 UTC (permalink / raw)
To: Nikita Karetnikov; +Cc: guix-devel
Nikita Karetnikov <nikita@karetnikov.org> 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’.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-09-20 21:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-20 17:39 package.scm: (profile-derivation (%store) '()) Nikita Karetnikov
2013-09-20 20:21 ` Ludovic Courtès
2013-09-20 21:08 ` Nikita Karetnikov
2013-09-20 21:35 ` Ludovic Courtès
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.