1 |
commit: f371f1804c5d2d263ca78aa79c3feed1bc5831ae |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Oct 3 17:48:48 2021 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Oct 3 19:30:33 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=f371f180 |
7 |
|
8 |
prepare_build_dirs: handle copytree FileExistsError |
9 |
|
10 |
Bug: https://bugs.gentoo.org/815871 |
11 |
Reviewed-by: Michał Górny <mgorny <AT> gentoo.org> |
12 |
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> |
13 |
|
14 |
lib/portage/package/ebuild/prepare_build_dirs.py | 10 +++++++++- |
15 |
1 file changed, 9 insertions(+), 1 deletion(-) |
16 |
|
17 |
diff --git a/lib/portage/package/ebuild/prepare_build_dirs.py b/lib/portage/package/ebuild/prepare_build_dirs.py |
18 |
index 41de1a3a9..410c7e4ae 100644 |
19 |
--- a/lib/portage/package/ebuild/prepare_build_dirs.py |
20 |
+++ b/lib/portage/package/ebuild/prepare_build_dirs.py |
21 |
@@ -477,13 +477,21 @@ def _ensure_log_subdirs(logdir, subdir): |
22 |
ensure_dirs(current, uid=uid, gid=gid, mode=grp_mode, mask=0) |
23 |
|
24 |
|
25 |
+def _copytree(src, dst, **kwargs): |
26 |
+ try: |
27 |
+ shutil.copytree(src, dst, **kwargs) |
28 |
+ except FileExistsError: |
29 |
+ shutil.rmtree(dst) |
30 |
+ shutil.copytree(src, dst, **kwargs) |
31 |
+ |
32 |
+ |
33 |
def _prepare_fake_filesdir(settings): |
34 |
real_filesdir = settings["O"] + "/files" |
35 |
filesdir = settings["FILESDIR"] |
36 |
|
37 |
# Copy files from real directory to ebuild directory (without metadata). |
38 |
if os.path.isdir(real_filesdir): |
39 |
- shutil.copytree(real_filesdir, filesdir, copy_function=copyfile) |
40 |
+ _copytree(real_filesdir, filesdir, copy_function=copyfile) |
41 |
apply_recursive_permissions( |
42 |
filesdir, |
43 |
uid=portage_uid, |