unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 74582@debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer@gmail.com>,
	Maxim Cournoyer <maxim.cournoyer@gmail.com>,
	Lars-Dominik Braun <lars@6xq.net>, Marius Bakke <marius@gnu.org>,
	Munyoki Kilyungi <me@bonfacemunyoki.com>,
	Sharlatan Hellseher <sharlatanus@gmail.com>,
	Tanguy Le Carrour <tanguy@bioneland.org>,
	jgart <jgart@dismail.de>
Subject: [bug#74582] [PATCH python-team 1/4] build/pyproject: Really merge directories in install phase.
Date: Thu, 28 Nov 2024 21:16:39 +0900	[thread overview]
Message-ID: <35ca6b4d6fb04d511694f38e52e766134b8565dc.1732781055.git.maxim.cournoyer@gmail.com> (raw)
In-Reply-To: <cover.1732781055.git.maxim.cournoyer@gmail.com>

Using rename-file, the destination had to be empty otherwise it would error
out.  By using copy-recursively, a directory can be copied onto a pre-existing
directory, really merging them.  This problem manifested itself attempting to
build the python-pyre package.

* guix/build/pyproject-build-system.scm (install)
<merge-directories>: Use copy-recursively instead of rename-file.

Change-Id: Iceb8609a86f29b17e5fbe6a9629339d0bc26e11f
---
 guix/build/pyproject-build-system.scm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/guix/build/pyproject-build-system.scm b/guix/build/pyproject-build-system.scm
index c69ccc9d64..03992d915f 100644
--- a/guix/build/pyproject-build-system.scm
+++ b/guix/build/pyproject-build-system.scm
@@ -194,8 +194,13 @@ (define* (install #:key inputs outputs #:allow-other-keys)
                   (format #t "~a/~a -> ~a/~a~%"
                           source file destination file)
                   (mkdir-p destination)
-                  (rename-file (string-append source "/" file)
-                               (string-append destination "/" file))
+                  ;; Use 'copy-recursively' rather than 'rename-file' to guard
+                  ;; against the odd case where DESTINATION is a non-empty
+                  ;; directory, which may happen when using hybrid Python
+                  ;; build systems.
+                  (copy-recursively (string-append source "/" file)
+                                    (string-append destination "/" file))
+                  (delete-file-recursively (string-append source "/" file))
                   (when post-move
                     (post-move file)))
                 (scandir source
-- 
2.46.0





  reply	other threads:[~2024-11-28 13:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-28  8:05 [bug#74582] [PATCH python-team 0/4] Fix edge case in pyproject-build-system Maxim Cournoyer
2024-11-28 12:16 ` Maxim Cournoyer [this message]
2024-11-28 12:16 ` [bug#74582] [PATCH python-team 2/4] build/pyproject: Fix indentation Maxim Cournoyer
2024-11-28 12:16 ` [bug#74582] [PATCH python-team 3/4] build/pyproject: Update PEP 427 reference URL in comment Maxim Cournoyer
2024-11-28 12:16 ` [bug#74582] [PATCH python-team 4/4] build/pyproject: Resolve import warning Maxim Cournoyer
2024-11-28 18:44   ` jgart via Guix-patches via

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=35ca6b4d6fb04d511694f38e52e766134b8565dc.1732781055.git.maxim.cournoyer@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=74582@debbugs.gnu.org \
    --cc=jgart@dismail.de \
    --cc=lars@6xq.net \
    --cc=marius@gnu.org \
    --cc=me@bonfacemunyoki.com \
    --cc=sharlatanus@gmail.com \
    --cc=tanguy@bioneland.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).