aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-03-18 15:07:58 +0100
committerMichał Górny <mgorny@gentoo.org>2018-01-26 15:58:58 +0100
commit9ca94adf2c91aaf075799faddd5b85dcea92a026 (patch)
treefe2c5dbbebae7aa7285f1cf0392889786d145a1c
parentinstall-qa-check.d: Scan build log for CMake unused var warnings (diff)
downloadportage-9ca94adf.tar.gz
portage-9ca94adf.tar.bz2
portage-9ca94adf.zip
portage.package.ebuild: Move _prepare_fake_distdir to .prepare_build_dirs
Reviewed-by: Zac Medico <zmedico@gentoo.org>
-rw-r--r--pym/_emerge/EbuildExecuter.py4
-rw-r--r--pym/portage/package/ebuild/doebuild.py34
-rw-r--r--pym/portage/package/ebuild/prepare_build_dirs.py33
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)