GNU bug report logs - #68406
[PATCH core-updates] guix: build: Expand `copy-recursively'.

Previous Next

Package: guix-patches;

Reported by: Romain GARBAGE <romain.garbage <at> inria.fr>

Date: Fri, 12 Jan 2024 15:25:01 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 68406 in the body.
You can then email your comments to 68406 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#68406; Package guix-patches. (Fri, 12 Jan 2024 15:25:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Romain GARBAGE <romain.garbage <at> inria.fr>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 12 Jan 2024 15:25:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Romain GARBAGE <romain.garbage <at> inria.fr>
To: guix-patches <at> gnu.org
Cc: Romain GARBAGE <romain.garbage <at> inria.fr>
Subject: [PATCH core-updates] guix: build: Expand `copy-recursively'.
Date: Fri, 12 Jan 2024 16:24:04 +0100
* guix/build/utils.scm (copy-recursively): Add `select?' key.

Change-Id: Icfe226164bb88dfede58ae24c15a98db9b696c3b
---
 guix/build/utils.scm | 42 ++++++++++++++++++++++++------------------
 1 file changed, 24 insertions(+), 18 deletions(-)

diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 2352a627e9..7567eb9e4d 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -430,32 +430,38 @@ (define* (copy-recursively source destination
                            (log (current-output-port))
                            (follow-symlinks? #f)
                            (copy-file copy-file)
-                           keep-mtime? keep-permissions?)
-  "Copy SOURCE directory to DESTINATION.  Follow symlinks if FOLLOW-SYMLINKS?
-is true; otherwise, just preserve them.  Call COPY-FILE to copy regular files.
-When KEEP-MTIME? is true, keep the modification time of the files in SOURCE on
-those of DESTINATION.  When KEEP-PERMISSIONS? is true, preserve file
-permissions.  Write verbose output to the LOG port."
+                           keep-mtime? keep-permissions?
+                           (select? (const #t)))
+  "Copy SOURCE directory to DESTINATION.  Follow symlinks if FOLLOW-SYMLINKS?  is
+true; otherwise, just preserve them.  Call COPY-FILE to copy regular files.  When
+KEEP-MTIME? is true, keep the modification time of the files in SOURCE on those of
+DESTINATION.  When KEEP-PERMISSIONS? is true, preserve file permissions.  Write
+verbose output to the LOG port. Call (SELECT?  FILE STAT) for each entry in source,
+where FILE is the entry's absolute file name and STAT is the result of 'lstat' (or
+'stat' if FOLLOW-SYMLINKS? is true); exclude entries for which SELECT? does not
+return true."
   (define strip-source
     (let ((len (string-length source)))
       (lambda (file)
         (substring file len))))
 
-  (file-system-fold (const #t)                    ; enter?
+  (file-system-fold (lambda (file stat result)    ; enter?
+                      (select? file stat))
                     (lambda (file stat result)    ; leaf
                       (let ((dest (string-append destination
                                                  (strip-source file))))
-                        (format log "`~a' -> `~a'~%" file dest)
-                        (case (stat:type stat)
-                          ((symlink)
-                           (let ((target (readlink file)))
-                             (symlink target dest)))
-                          (else
-                           (copy-file file dest)
-                           (when keep-permissions?
-                             (chmod dest (stat:perms stat)))))
-                        (when keep-mtime?
-                          (set-file-time dest stat))))
+                        (when (select? file stat)
+                          (format log "`~a' -> `~a'~%" file dest)
+                          (case (stat:type stat)
+                            ((symlink)
+                             (let ((target (readlink file)))
+                               (symlink target dest)))
+                            (else
+                             (copy-file file dest)
+                             (when keep-permissions?
+                               (chmod dest (stat:perms stat)))))
+                          (when keep-mtime?
+                            (set-file-time dest stat)))))
                     (lambda (dir stat result)     ; down
                       (let ((target (string-append destination
                                                    (strip-source dir))))
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#68406; Package guix-patches. (Fri, 19 Jan 2024 04:21:01 GMT) Full text and rfc822 format available.

Message #8 received at 68406 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Romain GARBAGE <romain.garbage <at> inria.fr>
Cc: 68406 <at> debbugs.gnu.org
Subject: Re: bug#68406: [PATCH core-updates] guix: build: Expand
 `copy-recursively'.
Date: Thu, 18 Jan 2024 23:20:08 -0500
Hi,

Romain GARBAGE <romain.garbage <at> inria.fr> writes:

> * guix/build/utils.scm (copy-recursively): Add `select?' key.
>
> Change-Id: Icfe226164bb88dfede58ae24c15a98db9b696c3b

Reviewed-by: Maxim Cournoyer <maxim.cournoyer <at> gmail>

-- 
Thanks,
Maxim




Reply sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
You have taken responsibility. (Sun, 21 Jan 2024 22:58:02 GMT) Full text and rfc822 format available.

Notification sent to Romain GARBAGE <romain.garbage <at> inria.fr>:
bug acknowledged by developer. (Sun, 21 Jan 2024 22:58:02 GMT) Full text and rfc822 format available.

Message #13 received at 68406-done <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Romain GARBAGE <romain.garbage <at> inria.fr>
Cc: 68406-done <at> debbugs.gnu.org
Subject: Re: bug#68406: [PATCH core-updates] guix: build: Expand
 `copy-recursively'.
Date: Sun, 21 Jan 2024 17:57:38 -0500
Hi!

Romain GARBAGE <romain.garbage <at> inria.fr> writes:

> * guix/build/utils.scm (copy-recursively): Add `select?' key.

Applied to core-updates.

-- 
Thanks,
Maxim




Information forwarded to guix-patches <at> gnu.org:
bug#68406; Package guix-patches. (Mon, 22 Jan 2024 11:32:02 GMT) Full text and rfc822 format available.

Message #16 received at 68406 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Romain GARBAGE <romain.garbage <at> inria.fr>
Cc: 68406 <at> debbugs.gnu.org, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: Re: bug#68406: [PATCH core-updates] guix: build: Expand
 `copy-recursively'.
Date: Mon, 22 Jan 2024 12:30:58 +0100
Hello!

Romain GARBAGE <romain.garbage <at> inria.fr> skribis:

> * guix/build/utils.scm (copy-recursively): Add `select?' key.
>
> Change-Id: Icfe226164bb88dfede58ae24c15a98db9b696c3b

[...]

> +  "Copy SOURCE directory to DESTINATION.  Follow symlinks if FOLLOW-SYMLINKS?  is
> +true; otherwise, just preserve them.  Call COPY-FILE to copy regular files.  When
> +KEEP-MTIME? is true, keep the modification time of the files in SOURCE on those of
> +DESTINATION.  When KEEP-PERMISSIONS? is true, preserve file permissions.  Write
> +verbose output to the LOG port. Call (SELECT?  FILE STAT) for each entry in source,
> +where FILE is the entry's absolute file name and STAT is the result of 'lstat' (or
> +'stat' if FOLLOW-SYMLINKS? is true); exclude entries for which SELECT? does not
> +return true."

Could you send a patch that updates ‘doc/guix.texi’ to match the
docstring?

I had completely overlooked that.

Thanks,
Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 19 Feb 2024 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 123 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.