1 |
commit: c2da00e04086fa8eefc981e97ae3559d42c4937d |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Oct 5 06:51:11 2021 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Oct 5 06:52:29 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=c2da00e0 |
7 |
|
8 |
Revert "Copy files/* into the work tree instead of symlinking it" |
9 |
|
10 |
Revert the series of FILESDIR changes that keep causing new regressions. |
11 |
|
12 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
13 |
|
14 |
bin/phase-functions.sh | 2 +- |
15 |
lib/portage/package/ebuild/prepare_build_dirs.py | 35 ++++++++---------------- |
16 |
2 files changed, 12 insertions(+), 25 deletions(-) |
17 |
|
18 |
diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh |
19 |
index 9a4c97b16..d3221993d 100644 |
20 |
--- a/bin/phase-functions.sh |
21 |
+++ b/bin/phase-functions.sh |
22 |
@@ -296,7 +296,7 @@ __dyn_clean() { |
23 |
|
24 |
rm -rf "${PORTAGE_BUILDDIR}/build-info" |
25 |
rm -rf "${WORKDIR}" |
26 |
- rm -rf "${PORTAGE_BUILDDIR}/files" |
27 |
+ rm -f "${PORTAGE_BUILDDIR}/files" |
28 |
fi |
29 |
|
30 |
if [ -f "${PORTAGE_BUILDDIR}/.unpacked" ]; then |
31 |
|
32 |
diff --git a/lib/portage/package/ebuild/prepare_build_dirs.py b/lib/portage/package/ebuild/prepare_build_dirs.py |
33 |
index 410c7e4ae..659198905 100644 |
34 |
--- a/lib/portage/package/ebuild/prepare_build_dirs.py |
35 |
+++ b/lib/portage/package/ebuild/prepare_build_dirs.py |
36 |
@@ -1,4 +1,4 @@ |
37 |
-# Copyright 2010-2021 Gentoo Authors |
38 |
+# Copyright 2010-2020 Gentoo Authors |
39 |
# Distributed under the terms of the GNU General Public License v2 |
40 |
|
41 |
__all__ = ["prepare_build_dirs"] |
42 |
@@ -27,7 +27,6 @@ from portage.util import ( |
43 |
normalize_path, |
44 |
writemsg, |
45 |
) |
46 |
-from portage.util.file_copy import copyfile |
47 |
from portage.util.install_mask import _raise_exc |
48 |
|
49 |
|
50 |
@@ -477,30 +476,18 @@ def _ensure_log_subdirs(logdir, subdir): |
51 |
ensure_dirs(current, uid=uid, gid=gid, mode=grp_mode, mask=0) |
52 |
|
53 |
|
54 |
-def _copytree(src, dst, **kwargs): |
55 |
- try: |
56 |
- shutil.copytree(src, dst, **kwargs) |
57 |
- except FileExistsError: |
58 |
- shutil.rmtree(dst) |
59 |
- shutil.copytree(src, dst, **kwargs) |
60 |
- |
61 |
- |
62 |
def _prepare_fake_filesdir(settings): |
63 |
real_filesdir = settings["O"] + "/files" |
64 |
- filesdir = settings["FILESDIR"] |
65 |
- |
66 |
- # Copy files from real directory to ebuild directory (without metadata). |
67 |
- if os.path.isdir(real_filesdir): |
68 |
- _copytree(real_filesdir, filesdir, copy_function=copyfile) |
69 |
- apply_recursive_permissions( |
70 |
- filesdir, |
71 |
- uid=portage_uid, |
72 |
- gid=portage_gid, |
73 |
- dirmode=0o750, |
74 |
- dirmask=0, |
75 |
- filemode=0o640, |
76 |
- filemask=0, |
77 |
- ) |
78 |
+ symlink_path = settings["FILESDIR"] |
79 |
+ |
80 |
+ try: |
81 |
+ link_target = os.readlink(symlink_path) |
82 |
+ except OSError: |
83 |
+ os.symlink(real_filesdir, symlink_path) |
84 |
+ else: |
85 |
+ if link_target != real_filesdir: |
86 |
+ os.unlink(symlink_path) |
87 |
+ os.symlink(real_filesdir, symlink_path) |
88 |
|
89 |
|
90 |
def _prepare_fake_distdir(settings, alist): |