Nigko, that you attempted the recipe and found an error and a fix is
extremely helpful.  It seems to me that what is written in "The
Repository as a Channel", when copied literally, has never worked.

I tried with a guile package instead of your test-repo package,
using gnu-build-system rather than copy-build-system, and both
current guix master branch as well as old version-1.4.0 branch.
It still failed, like you wrote.

I turned your description of the work-around into a patch,
(see e-mail attachment), in your name and e-mail address, with
copyright.

Your work-around is to move the package, for which guix.scm is a
symlink, to its own directory.  It works for me.  And looks like a
good recommendation in general.

I believe Attila Lendvai’s bug with (current-filename) being #f
will *not* lead to a fix that makes this cookbook change unnecessary.

Is the patch okay?  Do you have suggestions for a better commit message?
May I push it to the guix repo?

Regards,
Florian

From: Nigko Yerden <nigko.yer...@gmail.com>
Date: Wed, 14 Aug 2024 17:06:49 +0200
Subject: [PATCH] doc: cookbook: Fix non-working recipe.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fixes: <https://lists.gnu.org/archive/html/guix-devel/2024-08/msg00047.html>

* doc/guix-cookbook.texi (Software Development)[The Repository as a Channel]:
Move package to its own directory.  With Guix’ default GUILE_LOAD_PATH
setting, `local-file' cannot correctly follow symlinks otherwise.

Change-Id: I45d6878139e32f33b40465e272356c106a6d920a
---
 doc/guix-cookbook.texi | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi
index da67921ad0..bcb1bf67fc 100644
--- a/doc/guix-cookbook.texi
+++ b/doc/guix-cookbook.texi
@@ -25,6 +25,7 @@
 Copyright @copyright{} 2023-2024 Ludovic Courtès@*
 Copyright @copyright{} 2023 Thomas Ieong@*
 Copyright @copyright{} 2024 Florian Pelz@*
+Copyright @copyright{} 2024 Nigko Yerden@*
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -4623,9 +4624,9 @@ The Repository as a Channel
 symlink for the sake of @command{guix shell}:
 
 @lisp
-mkdir -p .guix/modules
-mv guix.scm .guix/modules/guile-package.scm
-ln -s .guix/modules/guile-package.scm guix.scm
+mkdir -p .guix/modules/guile
+mv guix.scm .guix/modules/guile/package.scm
+ln -s .guix/modules/guile/package.scm guix.scm
 @end lisp
 
 To make it usable as part of a channel, we need to turn our
@@ -4639,21 +4640,21 @@ The Repository as a Channel
 looks like this (not repeating things that haven't changed):
 
 @lisp
-(define-module (guile-package)
+(define-module (guile package)
   #:use-module (guix)
   #:use-module (guix git-download)   ;for ‘git-predicate’
   @dots{})
 
 (define vcs-file?
   ;; Return true if the given file is under version control.
-  (or (git-predicate (dirname (dirname (current-source-directory))))
+  (or (git-predicate (dirname (dirname (dirname (current-source-directory)))))
       (const #t)))                                ;not in a Git checkout
 
 (define-public guile
   (package
     (name "guile")
     (version "3.0.99-git")                          ;funky version number
-    (source (local-file "../.." "guile-checkout"
+    (source (local-file "../../.." "guile-checkout"
                         #:recursive? #t
                         #:select? vcs-file?))
     @dots{}))

base-commit: 174ecf5b1077d29498d9de22e27b13047f314feb
-- 
2.45.2

Reply via email to