all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Alex Kost <alezost@gmail.com>
Cc: guix-devel@gnu.org
Subject: Re: Using symlinks in 'local-file'
Date: Fri, 19 Jun 2015 10:26:53 +0200	[thread overview]
Message-ID: <87d20s3xyq.fsf@gnu.org> (raw)
In-Reply-To: <87616ny1ea.fsf@gmail.com> (Alex Kost's message of "Tue, 16 Jun 2015 21:05:33 +0300")

Alex Kost <alezost@gmail.com> skribis:

> Ludovic Courtès (2015-06-15 23:44 +0300) wrote:
>
>> Alex Kost <alezost@gmail.com> skribis:
>>
>>> If one uses a relative symlink in 'local-file', it will lead to a broken
>>> symlink in the store as illustrated in the attached example.  So I think
>>> it either:
>>>
>>> - should be documented explicitly that 'local-file' adds a specified
>>>   file to the store blindly, which may lead to the problem with a broken
>>>   symlink.
>>>
>>> - or 'local-file' (or a deeper procedure) should take care of that case
>>>   and dereference a symlink if needed.
>>>
>>> WDYT?
>>
>> Actually, this only happens with #:recursive? #t, which is currently the
>> default.
>>
>> With #:recursive? #f, you get an error:
>>
>>
>> scheme@(guile-user)> ,enter-store-monad
>> store-monad@(guile-user) [1]> (gexp->derivation "foo" #~(symlink #$(local-file "/tmp/symlink1" #:recursive? #f) #$output))
>> guix/store.scm:604:22: In procedure add-to-store:
>> guix/store.scm:604:22: Throw to key `srfi-34' with args `(#<condition &nix-protocol-error [message: "regular file expected" status: 1] 30c5ab0>)'.
>>
>> So I think we should first make #:recursive? default to #f, since that’s
>> what we want by default, and optionally have the <local-file> gexp
>> expander resolve symlinks.
>>
>> WDYT?
>
> I agree, getting an error is better than a broken link, so I'm for
> making (#:recursive? #f) a default.  And resolving symlinks would
> probably be even better.

Done in commits 020f3e4 and 7833db1.

>>> (define (call-derivation drv)
>>>   (apply system*
>>>          (cons (derivation-builder drv)
>>>                (derivation-builder-arguments drv))))
>>
>> This is quite original.  ;-)
>
> I suppose that's a polite version of "That's not how it should be done".

Well, yes and no; I find it clever actually.

> I just don't know what the proper way to "call" derivation is :-)

With ‘build-derivations’, which lets guix-daemon built it on your behalf
in a container.

Roughly, what the daemon does is:

   (eval-in-container
     #~(apply system*
              (cons (derivation-builder drv)
                    (derivation-builder-arguments drv))))

in terms of David’s forthcoming ‘eval-in-container’.  ;-)

Ludo’.

  reply	other threads:[~2015-06-19  8:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-14 19:02 Using symlinks in 'local-file' Alex Kost
2015-06-15 20:44 ` Ludovic Courtès
2015-06-16 18:05   ` Alex Kost
2015-06-19  8:26     ` Ludovic Courtès [this message]
2015-06-20 16:35       ` Alex Kost

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

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

  git send-email \
    --in-reply-to=87d20s3xyq.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=alezost@gmail.com \
    --cc=guix-devel@gnu.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 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.