* [gentoo-commits] proj/portage:master commit in: pym/_emerge/, pym/portage/package/ebuild/
@ 2017-12-02 22:54 Zac Medico
0 siblings, 0 replies; 3+ messages in thread
From: Zac Medico @ 2017-12-02 22:54 UTC (permalink / raw
To: gentoo-commits
commit: a544824d5f62d26b08826c991275ed8e0e70f525
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 2 22:26:49 2017 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Dec 2 22:33:06 2017 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=a544824d
profile_check: detect missing ARCH variable (bug 586214)
The Scheduler._env_sanity_check method executed too late
to prevent a KeyError for ARCH in getmaskingstatus, so
use profile_check to detect missing ARCH and exit earlier.
Bug: https://bugs.gentoo.org/586214
pym/_emerge/Scheduler.py | 36 ------------------------------------
pym/_emerge/main.py | 3 ++-
pym/portage/package/ebuild/config.py | 4 +++-
3 files changed, 5 insertions(+), 38 deletions(-)
diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py
index 079fac7b9..3a38cbafd 100644
--- a/pym/_emerge/Scheduler.py
+++ b/pym/_emerge/Scheduler.py
@@ -656,38 +656,6 @@ class Scheduler(PollScheduler):
return os.EX_OK
- def _env_sanity_check(self):
- """
- Verify a sane environment before trying to build anything from source.
- """
- have_src_pkg = False
- for x in self._mergelist:
- if isinstance(x, Package) and not x.built:
- have_src_pkg = True
- break
-
- if not have_src_pkg:
- return os.EX_OK
-
- for settings in self.pkgsettings.values():
- for var in ("ARCH", ):
- value = settings.get(var)
- if value and value.strip():
- continue
- msg = _("%(var)s is not set... "
- "Are you missing the '%(configroot)s%(profile_path)s' symlink? "
- "Is the symlink correct? "
- "Is your portage tree complete?") % \
- {"var": var, "configroot": settings["PORTAGE_CONFIGROOT"],
- "profile_path": portage.const.PROFILE_PATH}
-
- out = portage.output.EOutput()
- for line in textwrap.wrap(msg, 70):
- out.eerror(line)
- return FAILURE
-
- return os.EX_OK
-
def _check_manifests(self):
# Verify all the manifests now so that the user is notified of failure
# as soon as possible.
@@ -1002,10 +970,6 @@ class Scheduler(PollScheduler):
if rval != os.EX_OK:
return rval
- rval = self._env_sanity_check()
- if rval != os.EX_OK:
- return rval
-
# TODO: Immediately recalculate deps here if --keep-going
# is enabled and corrupt manifests are detected.
rval = self._check_manifests()
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index d3a415b91..6a4bb87d0 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1123,7 +1123,8 @@ def profile_check(trees, myaction):
if myaction in ("help", "info", "search", "sync", "version"):
return os.EX_OK
for root_trees in trees.values():
- if root_trees["root_config"].settings.profiles:
+ if (root_trees["root_config"].settings.profiles and
+ 'ARCH' in root_trees["root_config"].settings):
continue
# generate some profile related warning messages
validate_ebuild_environment(trees)
diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 6691024f2..cd2b009aa 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -1098,7 +1098,9 @@ class config(object):
profile_broken = False
- if not self.profile_path:
+ # getmaskingstatus requires ARCH for ACCEPT_KEYWORDS support
+ arch = self.get('ARCH')
+ if not self.profile_path or not arch:
profile_broken = True
else:
# If any one of these files exists, then
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/_emerge/, pym/portage/package/ebuild/
@ 2018-01-26 14:59 Michał Górny
0 siblings, 0 replies; 3+ messages in thread
From: Michał Górny @ 2018-01-26 14:59 UTC (permalink / raw
To: gentoo-commits
commit: 9ca94adf2c91aaf075799faddd5b85dcea92a026
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 18 14:07:58 2017 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jan 26 14:58:58 2018 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9ca94adf
portage.package.ebuild: Move _prepare_fake_distdir to .prepare_build_dirs
Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>
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)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/_emerge/, pym/portage/package/ebuild/
@ 2018-05-21 16:58 Zac Medico
0 siblings, 0 replies; 3+ messages in thread
From: Zac Medico @ 2018-05-21 16:58 UTC (permalink / raw
To: gentoo-commits
commit: ef99f7e9e0e0b4d0ae20b6964b1efbee4c49fdaa
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri May 18 03:57:59 2018 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon May 21 16:57:42 2018 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=ef99f7e9
preinst_selinux_labels: disable LD_PRELOAD sandbox (bug 655996)
Since SELinux does not allow LD_PRELOAD across domain transitions,
disable the LD_PRELOAD sandbox for preinst_selinux_labels.
Bug: https://bugs.gentoo.org/655996
Tested-by: Jason Zaman <perfinion <AT> gentoo.org>
pym/_emerge/EbuildPhase.py | 30 +++++++++++++++++++++++++++++-
pym/_emerge/MiscFunctionsProcess.py | 6 +++++-
pym/portage/package/ebuild/doebuild.py | 28 +++++++++++++++++++++-------
3 files changed, 55 insertions(+), 9 deletions(-)
diff --git a/pym/_emerge/EbuildPhase.py b/pym/_emerge/EbuildPhase.py
index 890b17870..d057dc45e 100644
--- a/pym/_emerge/EbuildPhase.py
+++ b/pym/_emerge/EbuildPhase.py
@@ -13,6 +13,7 @@ from _emerge.MiscFunctionsProcess import MiscFunctionsProcess
from _emerge.EbuildProcess import EbuildProcess
from _emerge.CompositeTask import CompositeTask
from _emerge.PackagePhase import PackagePhase
+from _emerge.TaskSequence import TaskSequence
from portage.package.ebuild.prepare_build_dirs import (_prepare_workdir,
_prepare_fake_distdir, _prepare_fake_filesdir)
from portage.util import writemsg
@@ -275,7 +276,7 @@ class EbuildPhase(CompositeTask):
# when FEATURES=compress-build-logs is enabled.
fd, logfile = tempfile.mkstemp()
os.close(fd)
- post_phase = MiscFunctionsProcess(background=self.background,
+ post_phase = _PostPhaseCommands(background=self.background,
commands=post_phase_cmds, fd_pipes=self.fd_pipes,
logfile=logfile, phase=self.phase, scheduler=self.scheduler,
settings=settings)
@@ -405,3 +406,30 @@ class EbuildPhase(CompositeTask):
log_path = self.settings.get("PORTAGE_LOG_FILE")
self.scheduler.output(msg, log_path=log_path,
background=background)
+
+
+class _PostPhaseCommands(CompositeTask):
+
+ __slots__ = ("commands", "fd_pipes", "logfile", "phase", "settings")
+
+ def _start(self):
+ if isinstance(self.commands, list):
+ cmds = [({}, self.commands)]
+ else:
+ cmds = list(self.commands)
+
+ if 'selinux' not in self.settings.features:
+ cmds = [(kwargs, commands) for kwargs, commands in
+ cmds if not kwargs.get('selinux_only')]
+
+ tasks = TaskSequence()
+ for kwargs, commands in cmds:
+ # Select args intended for MiscFunctionsProcess.
+ kwargs = dict((k, v) for k, v in kwargs.items()
+ if k in ('ld_preload_sandbox',))
+ tasks.add(MiscFunctionsProcess(background=self.background,
+ commands=commands, fd_pipes=self.fd_pipes,
+ logfile=self.logfile, phase=self.phase,
+ scheduler=self.scheduler, settings=self.settings, **kwargs))
+
+ self._start_task(tasks, self._default_final_exit)
diff --git a/pym/_emerge/MiscFunctionsProcess.py b/pym/_emerge/MiscFunctionsProcess.py
index 99cf5983f..89fd22635 100644
--- a/pym/_emerge/MiscFunctionsProcess.py
+++ b/pym/_emerge/MiscFunctionsProcess.py
@@ -13,7 +13,7 @@ class MiscFunctionsProcess(AbstractEbuildProcess):
Spawns misc-functions.sh with an existing ebuild environment.
"""
- __slots__ = ('commands',)
+ __slots__ = ('commands', 'ld_preload_sandbox')
def _start(self):
settings = self.settings
@@ -29,6 +29,10 @@ class MiscFunctionsProcess(AbstractEbuildProcess):
AbstractEbuildProcess._start(self)
def _spawn(self, args, **kwargs):
+ # If self.ld_preload_sandbox is None, default to free=False,
+ # in alignment with the spawn(free=False) default.
+ kwargs.setdefault('free', False if self.ld_preload_sandbox is None
+ else not self.ld_preload_sandbox)
if self._dummy_pipe_fd is not None:
self.settings["PORTAGE_PIPE_FD"] = str(self._dummy_pipe_fd)
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index 31b552ff3..c3b89ade2 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -1722,13 +1722,27 @@ _post_phase_cmds = {
"install_symlink_html_docs",
"install_hooks"],
- "preinst" : [
- "preinst_sfperms",
- "preinst_selinux_labels",
- "preinst_suid_scan",
- "preinst_qa_check",
- ],
-
+ "preinst" : (
+ (
+ # Since SELinux does not allow LD_PRELOAD across domain transitions,
+ # disable the LD_PRELOAD sandbox for preinst_selinux_labels.
+ {
+ "ld_preload_sandbox": False,
+ "selinux_only": True,
+ },
+ [
+ "preinst_selinux_labels",
+ ],
+ ),
+ (
+ {},
+ [
+ "preinst_sfperms",
+ "preinst_suid_scan",
+ "preinst_qa_check",
+ ],
+ ),
+ ),
"postinst" : [
"postinst_qa_check"],
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-21 16:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-21 16:58 [gentoo-commits] proj/portage:master commit in: pym/_emerge/, pym/portage/package/ebuild/ Zac Medico
-- strict thread matches above, loose matches on Subject: below --
2018-01-26 14:59 Michał Górny
2017-12-02 22:54 Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox