From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id EB22E158086 for ; Tue, 5 Oct 2021 06:52:36 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 48DCBE0880; Tue, 5 Oct 2021 06:52:36 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 2A250E0880 for ; Tue, 5 Oct 2021 06:52:36 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 225723430AB for ; Tue, 5 Oct 2021 06:52:35 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 86987E5 for ; Tue, 5 Oct 2021 06:52:33 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1633416749.c2da00e04086fa8eefc981e97ae3559d42c4937d.mgorny@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/package/ebuild/, bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/phase-functions.sh lib/portage/package/ebuild/prepare_build_dirs.py X-VCS-Directories: bin/ lib/portage/package/ebuild/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: c2da00e04086fa8eefc981e97ae3559d42c4937d X-VCS-Branch: master Date: Tue, 5 Oct 2021 06:52:33 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 8dcaac4c-7d84-4c90-9537-70b857095868 X-Archives-Hash: eb2ee7347ff146ca08d42a6e0905bb90 commit: c2da00e04086fa8eefc981e97ae3559d42c4937d Author: Michał Górny gentoo org> AuthorDate: Tue Oct 5 06:51:11 2021 +0000 Commit: Michał Górny gentoo org> CommitDate: Tue Oct 5 06:52:29 2021 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=c2da00e0 Revert "Copy files/* into the work tree instead of symlinking it" Revert the series of FILESDIR changes that keep causing new regressions. Signed-off-by: Michał Górny gentoo.org> bin/phase-functions.sh | 2 +- lib/portage/package/ebuild/prepare_build_dirs.py | 35 ++++++++---------------- 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh index 9a4c97b16..d3221993d 100644 --- a/bin/phase-functions.sh +++ b/bin/phase-functions.sh @@ -296,7 +296,7 @@ __dyn_clean() { rm -rf "${PORTAGE_BUILDDIR}/build-info" rm -rf "${WORKDIR}" - rm -rf "${PORTAGE_BUILDDIR}/files" + rm -f "${PORTAGE_BUILDDIR}/files" fi if [ -f "${PORTAGE_BUILDDIR}/.unpacked" ]; then diff --git a/lib/portage/package/ebuild/prepare_build_dirs.py b/lib/portage/package/ebuild/prepare_build_dirs.py index 410c7e4ae..659198905 100644 --- a/lib/portage/package/ebuild/prepare_build_dirs.py +++ b/lib/portage/package/ebuild/prepare_build_dirs.py @@ -1,4 +1,4 @@ -# Copyright 2010-2021 Gentoo Authors +# Copyright 2010-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 __all__ = ["prepare_build_dirs"] @@ -27,7 +27,6 @@ from portage.util import ( normalize_path, writemsg, ) -from portage.util.file_copy import copyfile from portage.util.install_mask import _raise_exc @@ -477,30 +476,18 @@ def _ensure_log_subdirs(logdir, subdir): ensure_dirs(current, uid=uid, gid=gid, mode=grp_mode, mask=0) -def _copytree(src, dst, **kwargs): - try: - shutil.copytree(src, dst, **kwargs) - except FileExistsError: - shutil.rmtree(dst) - shutil.copytree(src, dst, **kwargs) - - def _prepare_fake_filesdir(settings): real_filesdir = settings["O"] + "/files" - filesdir = settings["FILESDIR"] - - # Copy files from real directory to ebuild directory (without metadata). - if os.path.isdir(real_filesdir): - _copytree(real_filesdir, filesdir, copy_function=copyfile) - apply_recursive_permissions( - filesdir, - uid=portage_uid, - gid=portage_gid, - dirmode=0o750, - dirmask=0, - filemode=0o640, - filemask=0, - ) + symlink_path = settings["FILESDIR"] + + try: + link_target = os.readlink(symlink_path) + except OSError: + os.symlink(real_filesdir, symlink_path) + else: + if link_target != real_filesdir: + os.unlink(symlink_path) + os.symlink(real_filesdir, symlink_path) def _prepare_fake_distdir(settings, alist):