unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Nikita Karetnikov <nikita@karetnikov.org>
Cc: guix-devel@gnu.org
Subject: Re: package.scm: (profile-derivation (%store) '())
Date: Fri, 20 Sep 2013 23:35:09 +0200	[thread overview]
Message-ID: <87wqmbch2q.fsf@gnu.org> (raw)
In-Reply-To: <87a9j7b3qq.fsf@karetnikov.org> (Nikita Karetnikov's message of "Sat, 21 Sep 2013 01:08:29 +0400")

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’.

      reply	other threads:[~2013-09-20 21:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wqmbch2q.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=nikita@karetnikov.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).