--- pym/_emerge/EbuildExecuter.py | 4 +-- pym/portage/package/ebuild/doebuild.py | 34 ++---------------------- pym/portage/package/ebuild/prepare_build_dirs.py | 33 ++++++++++++++++++++++- 3 files changed, 36 insertions(+), 35 deletions(-)
diff --git a/pym/_emerge/EbuildExecuter.py b/pym/_emerge/EbuildExecuter.py index 5587d4eb0..ab79ce901 100644 --- a/pym/_emerge/EbuildExecuter.py +++ b/pym/_emerge/EbuildExecuter.py @@ -1,4 +1,4 @@ -# Copyright 1999-2011 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from _emerge.EbuildPhase import EbuildPhase @@ -8,7 +8,7 @@ import portage from portage import os from portage.eapi import eapi_has_src_prepare_and_src_configure, \ eapi_exports_replace_vars -from portage.package.ebuild.doebuild import _prepare_fake_distdir +from portage.package.ebuild.prepare_build_dirs import _prepare_fake_distdir class EbuildExecuter(CompositeTask): diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py index f75f11a1a..c8df9b744 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -1,4 +1,4 @@ -# Copyright 2010-2015 Gentoo Foundation +# Copyright 2010-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from __future__ import unicode_literals @@ -31,6 +31,7 @@ portage.proxy.lazyimport.lazyimport(globals(), 'portage.package.ebuild.digestcheck:digestcheck', 'portage.package.ebuild.digestgen:digestgen', 'portage.package.ebuild.fetch:fetch', + 'portage.package.ebuild.prepare_build_dirs:_prepare_fake_distdir', 'portage.package.ebuild._ipc.QueryCommand:QueryCommand', 'portage.dep._slot_operator:evaluate_slot_operator_equal_deps', 'portage.package.ebuild._spawn_nofetch:spawn_nofetch', @@ -1351,37 +1352,6 @@ def _prepare_env_file(settings): env_extractor.wait() return env_extractor.returncode -def _prepare_fake_distdir(settings, alist): - orig_distdir = settings["DISTDIR"] - settings["PORTAGE_ACTUAL_DISTDIR"] = orig_distdir - edpath = settings["DISTDIR"] = \ - os.path.join(settings["PORTAGE_BUILDDIR"], "distdir") - portage.util.ensure_dirs(edpath, gid=portage_gid, mode=0o755) - - # Remove any unexpected files or directories. - for x in os.listdir(edpath): - symlink_path = os.path.join(edpath, x) - st = os.lstat(symlink_path) - if x in alist and stat.S_ISLNK(st.st_mode): - continue - if stat.S_ISDIR(st.st_mode): - shutil.rmtree(symlink_path) - else: - os.unlink(symlink_path) - - # Check for existing symlinks and recreate if necessary. - for x in alist: - symlink_path = os.path.join(edpath, x) - target = os.path.join(orig_distdir, x) - try: - link_target = os.readlink(symlink_path) - except OSError: - os.symlink(target, symlink_path) - else: - if link_target != target: - os.unlink(symlink_path) - os.symlink(target, symlink_path) - def _spawn_actionmap(settings): features = settings.features restrict = settings["PORTAGE_RESTRICT"].split() diff --git a/pym/portage/package/ebuild/prepare_build_dirs.py b/pym/portage/package/ebuild/prepare_build_dirs.py index e3ae318bd..16afc3f98 100644 --- a/pym/portage/package/ebuild/prepare_build_dirs.py +++ b/pym/portage/package/ebuild/prepare_build_dirs.py @@ -1,4 +1,4 @@ -# Copyright 2010-2013 Gentoo Foundation +# Copyright 2010-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from __future__ import unicode_literals @@ -409,3 +409,34 @@ def _prepare_fake_filesdir(settings): if link_target != real_filesdir: os.unlink(symlink_path) os.symlink(real_filesdir, symlink_path) + +def _prepare_fake_distdir(settings, alist): + orig_distdir = settings["DISTDIR"] + settings["PORTAGE_ACTUAL_DISTDIR"] = orig_distdir + edpath = settings["DISTDIR"] = \ + os.path.join(settings["PORTAGE_BUILDDIR"], "distdir") + portage.util.ensure_dirs(edpath, gid=portage_gid, mode=0o755) + + # Remove any unexpected files or directories. + for x in os.listdir(edpath): + symlink_path = os.path.join(edpath, x) + st = os.lstat(symlink_path) + if x in alist and stat.S_ISLNK(st.st_mode): + continue + if stat.S_ISDIR(st.st_mode): + shutil.rmtree(symlink_path) + else: + os.unlink(symlink_path) + + # Check for existing symlinks and recreate if necessary. + for x in alist: + symlink_path = os.path.join(edpath, x) + target = os.path.join(orig_distdir, x) + try: + link_target = os.readlink(symlink_path) + except OSError: + os.symlink(target, symlink_path) + else: + if link_target != target: + os.unlink(symlink_path) + os.symlink(target, symlink_path) -- 2.16.1