unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Ricardo Wurmus <rekado@elephly.net>
Cc: guix-devel@gnu.org
Subject: Re: Subdirectories in GUIX_PACKAGE_PATH
Date: Fri, 30 Jun 2017 11:35:54 +0200	[thread overview]
Message-ID: <8737ahq0lh.fsf@gnu.org> (raw)
In-Reply-To: <87h8z3kn7j.fsf@elephly.net> (Ricardo Wurmus's message of "Mon, 26 Jun 2017 13:22:40 +0200")

[-- Attachment #1: Type: text/plain, Size: 1047 bytes --]

Hello,

Ricardo Wurmus <rekado@elephly.net> skribis:

> Christopher Baines <mail@cbaines.net> writes:
>
>> Recently I had problems with the way GUIX_PACKAGE_PATH was working with
>> govuk-guix [1]. Currently, I'm using a separate directory for the
>> GUIX_PACKAGE_PATH that contains symlinks to a subset of the Guile
>> modules necessary for the packages in the repository.
>>
>> I think support (whether intentional or otherwise) for this approach was
>> removed in [2].
>
> Looks like this was removed in an attempt to improve performance over
> NFS.  The “scheme-files” procedure now includes a comment:
>
>   ;; XXX: We don't recurse if we find a symlink.
>
> Would it not be better to fix this instead of adding support for special
> syntax in GUIX_PACKAGE_PATH?

Indeed, apologies for the breakage.

I think the patch below fixes it.  It incurs overhead only when a
symlink is encountered, which is reasonable I think.

Chris & Alex: could you give it a try and report back?

Thanks in advance,
Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1249 bytes --]

diff --git a/guix/discovery.scm b/guix/discovery.scm
index 292df2bd9..b1731de93 100644
--- a/guix/discovery.scm
+++ b/guix/discovery.scm
@@ -60,11 +60,20 @@ DIRECTORY is not accessible."
                      (case (entry-type absolute properties)
                        ((directory)
                         (append (scheme-files absolute) result))
-                       ((regular symlink)
-                        ;; XXX: We don't recurse if we find a symlink.
+                       ((regular)
                         (if (string-suffix? ".scm" name)
                             (cons absolute result)
                             result))
+                       ((symlink)
+                        (cond ((string-suffix? ".scm" name)
+                               (cons absolute result))
+                              ((stat absolute #f)
+                               =>
+                               (match-lambda
+                                 (#f result)
+                                 ((= stat:type 'directory)
+                                  (append (scheme-files absolute)
+                                          result))))))
                        (else
                         result))))))
               '()

  parent reply	other threads:[~2017-06-30  9:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-23 20:20 Subdirectories in GUIX_PACKAGE_PATH Christopher Baines
2017-06-24 19:13 ` Alex Kost
2017-06-26 11:22 ` Ricardo Wurmus
2017-06-26 20:15   ` Christopher Baines
2017-06-30  9:35   ` Ludovic Courtès [this message]
2017-07-03 18:15     ` Alex Kost
2017-07-03 21:53       ` Ludovic Courtès
2017-07-05  7:04         ` 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

  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=8737ahq0lh.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=rekado@elephly.net \
    /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).