public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/emerge/, pym/_emerge/
@ 2011-10-27 16:32 Zac Medico
  0 siblings, 0 replies; 3+ messages in thread
From: Zac Medico @ 2011-10-27 16:32 UTC (permalink / raw
  To: gentoo-commits

commit:     2c239afad567e73d961bac0f92488698f2513aac
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 27 16:31:33 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Oct 27 16:31:33 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2c239afa

Run pkg_pretend in PORTAGE_TMPDIR for bug #388593

---
 pym/_emerge/Scheduler.py                |    3 ++-
 pym/portage/tests/emerge/test_simple.py |    5 +++++
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py
index bc85a0d..2244083 100644
--- a/pym/_emerge/Scheduler.py
+++ b/pym/_emerge/Scheduler.py
@@ -915,8 +915,9 @@ class Scheduler(PollScheduler):
 			root_config = x.root_config
 			settings = self.pkgsettings[root_config.root]
 			settings.setcpv(x)
-			tmpdir = tempfile.mkdtemp()
 			tmpdir_orig = settings["PORTAGE_TMPDIR"]
+			build_prefix_orig = os.path.join(tmpdir_orig, 'portage')
+			tmpdir = tempfile.mkdtemp(dir=build_prefix_orig)
 			settings["PORTAGE_TMPDIR"] = tmpdir
 
 			try:

diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py
index 2719115..4110b55 100644
--- a/pym/portage/tests/emerge/test_simple.py
+++ b/pym/portage/tests/emerge/test_simple.py
@@ -29,6 +29,11 @@ class SimpleEmergeTestCase(TestCase):
 
 		install_something = """
 S="${WORKDIR}"
+
+pkg_pretend() {
+	einfo "called pkg_pretend for $CATEGORY/$PF"
+}
+
 src_install() {
 	einfo "installing something..."
 	# TODO: Add prefix support to shell code/helpers, so we



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/emerge/, pym/_emerge/
@ 2011-11-16 21:14 Zac Medico
  0 siblings, 0 replies; 3+ messages in thread
From: Zac Medico @ 2011-11-16 21:14 UTC (permalink / raw
  To: gentoo-commits

commit:     001970d23ff76b451a60ecdc9075344ee8e3c7d5
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 16 21:14:42 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Nov 16 21:14:42 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=001970d2

pkg_pretend: clean first for bug #390711

---
 pym/_emerge/Scheduler.py                |   46 ++++++++++++++++++++++---------
 pym/portage/tests/emerge/test_simple.py |    4 +++
 2 files changed, 37 insertions(+), 13 deletions(-)

diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py
index 729b2d7..d5e801b 100644
--- a/pym/_emerge/Scheduler.py
+++ b/pym/_emerge/Scheduler.py
@@ -7,10 +7,8 @@ from collections import deque
 import gc
 import gzip
 import logging
-import shutil
 import signal
 import sys
-import tempfile
 import textwrap
 import time
 import warnings
@@ -28,9 +26,10 @@ from portage.output import colorize, create_color_func, red
 bad = create_color_func("BAD")
 from portage._sets import SETPREFIX
 from portage._sets.base import InternalPackageSet
-from portage.util import ensure_dirs, writemsg, writemsg_level
+from portage.util import writemsg, writemsg_level
 from portage.package.ebuild.digestcheck import digestcheck
 from portage.package.ebuild.digestgen import digestgen
+from portage.package.ebuild.doebuild import _check_temp_dir
 from portage.package.ebuild.prepare_build_dirs import prepare_build_dirs
 
 import _emerge
@@ -44,6 +43,7 @@ from _emerge.create_depgraph_params import create_depgraph_params
 from _emerge.create_world_atom import create_world_atom
 from _emerge.DepPriority import DepPriority
 from _emerge.depgraph import depgraph, resume_depgraph
+from _emerge.EbuildBuildDir import EbuildBuildDir
 from _emerge.EbuildFetcher import EbuildFetcher
 from _emerge.EbuildPhase import EbuildPhase
 from _emerge.emergelog import emergelog
@@ -52,11 +52,9 @@ from _emerge._find_deep_system_runtime_deps import _find_deep_system_runtime_dep
 from _emerge._flush_elog_mod_echo import _flush_elog_mod_echo
 from _emerge.JobStatusDisplay import JobStatusDisplay
 from _emerge.MergeListItem import MergeListItem
-from _emerge.MiscFunctionsProcess import MiscFunctionsProcess
 from _emerge.Package import Package
 from _emerge.PackageMerge import PackageMerge
 from _emerge.PollScheduler import PollScheduler
-from _emerge.RootConfig import RootConfig
 from _emerge.SlotObject import SlotObject
 from _emerge.SequentialTaskQueue import SequentialTaskQueue
 
@@ -915,11 +913,14 @@ class Scheduler(PollScheduler):
 			root_config = x.root_config
 			settings = self.pkgsettings[root_config.root]
 			settings.setcpv(x)
-			tmpdir_orig = settings["PORTAGE_TMPDIR"]
-			build_prefix_orig = os.path.join(tmpdir_orig, 'portage')
-			ensure_dirs(build_prefix_orig)
-			tmpdir = tempfile.mkdtemp(dir=build_prefix_orig)
-			settings["PORTAGE_TMPDIR"] = tmpdir
+
+			# setcpv/package.env allows for per-package PORTAGE_TMPDIR so we
+			# have to validate it for each package
+			rval = _check_temp_dir(settings)
+			if rval != os.EX_OK:
+				return rval
+
+			build_dir = None
 
 			try:
 				if x.built:
@@ -948,7 +949,8 @@ class Scheduler(PollScheduler):
 					if fetched:
 						bintree.inject(x.cpv, filename=fetched)
 					tbz2_file = bintree.getname(x.cpv)
-					infloc = os.path.join(tmpdir, x.category, x.pf, "build-info")
+					infloc = os.path.join(settings["PORTAGE_TMPDIR"],
+						x.category, x.pf, "build-info")
 					os.makedirs(infloc)
 					portage.xpak.tbz2(tbz2_file).unpackinfo(infloc)
 					ebuild_path = os.path.join(infloc, x.pf + ".ebuild")
@@ -970,6 +972,20 @@ class Scheduler(PollScheduler):
 				portage.package.ebuild.doebuild.doebuild_environment(ebuild_path,
 					"pretend", settings=settings,
 					db=self.trees[settings['EROOT']][tree].dbapi)
+
+				existing_buildir = os.path.isdir(settings["PORTAGE_BUILDDIR"])
+				build_dir = EbuildBuildDir(scheduler=sched_iface,
+					settings=settings)
+				build_dir.lock()
+
+				# Clean up the existing build dir, in case pkg_pretend
+				# checks for available space (bug #390711).
+				if existing_buildir:
+					clean_phase = EbuildPhase(background=False,
+						phase='clean', scheduler=sched_iface, settings=settings)
+					clean_phase.start()
+					clean_phase.wait()
+
 				prepare_build_dirs(root_config.root, settings, cleanup=0)
 
 				vardb = root_config.trees['vartree'].dbapi
@@ -987,8 +1003,12 @@ class Scheduler(PollScheduler):
 					failures += 1
 				portage.elog.elog_process(x.cpv, settings)
 			finally:
-				shutil.rmtree(tmpdir)
-				settings["PORTAGE_TMPDIR"] = tmpdir_orig
+				if build_dir is not None:
+					clean_phase = EbuildPhase(background=False,
+						phase='clean', scheduler=sched_iface, settings=settings)
+					clean_phase.start()
+					clean_phase.wait()
+					build_dir.unlock()
 
 		if failures:
 			return 1

diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py
index db3f496..5f285c2 100644
--- a/pym/portage/tests/emerge/test_simple.py
+++ b/pym/portage/tests/emerge/test_simple.py
@@ -228,7 +228,11 @@ pkg_preinst() {
 			emerge_cmd + ("-p", "dev-libs/B"),
 			emerge_cmd + ("-B", "dev-libs/B",),
 			emerge_cmd + ("--oneshot", "--usepkg", "dev-libs/B",),
+
+			# trigger clean prior to pkg_pretend as in bug #390711
+			ebuild_cmd + (test_ebuild, "unpack"), 
 			emerge_cmd + ("--oneshot", "dev-libs/A",),
+
 			emerge_cmd + ("--noreplace", "dev-libs/A",),
 			emerge_cmd + ("--config", "dev-libs/A",),
 			emerge_cmd + ("--info", "dev-libs/A", "dev-libs/B"),



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/emerge/, pym/_emerge/
@ 2017-05-30  3:31 Zac Medico
  0 siblings, 0 replies; 3+ messages in thread
From: Zac Medico @ 2017-05-30  3:31 UTC (permalink / raw
  To: gentoo-commits

commit:     565ceb1bebc83ec1a5572a672e2e08ea7d91e7a8
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun May 28 08:55:27 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue May 30 03:30:50 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=565ceb1b

emerge: warn for --autounmask-continue with --autounmask=n (bug 619612)

In order to avoid possible confusion when the user has specified
--autounmask-continue and EMERGE_DEFAULT_OPTS contains
--autounmask=n, display a warning message as follows:

 * --autounmask-continue has been disabled by --autounmask=n

X-Gentoo-bug: 619612
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=619612
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/_emerge/actions.py                  | 6 ++++++
 pym/portage/tests/emerge/test_simple.py | 5 ++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 1bc20c3ed..c8a62fb01 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -2862,6 +2862,12 @@ def run_action(emerge_config):
 	adjust_configs(emerge_config.opts, emerge_config.trees)
 	apply_priorities(emerge_config.target_config.settings)
 
+	if ("--autounmask-continue" in emerge_config.opts and
+		emerge_config.opts.get("--autounmask") == "n"):
+		writemsg_level(
+			" %s --autounmask-continue has been disabled by --autounmask=n\n" %
+			warn("*"), level=logging.WARNING, noiselevel=-1)
+
 	for fmt in emerge_config.target_config.settings.get("PORTAGE_BINPKG_FORMAT", "").split():
 		if not fmt in portage.const.SUPPORTED_BINPKG_FORMATS:
 			if "--pkg-format" in emerge_config.opts:

diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py
index 5930f6cc8..f99c77927 100644
--- a/pym/portage/tests/emerge/test_simple.py
+++ b/pym/portage/tests/emerge/test_simple.py
@@ -311,7 +311,10 @@ pkg_preinst() {
 			emerge_cmd + ("--unmerge", "--quiet", "dev-libs/A"),
 			emerge_cmd + ("-C", "--quiet", "dev-libs/B"),
 
-			emerge_cmd + ("--autounmask-continue", "dev-libs/C",),
+			# If EMERGE_DEFAULT_OPTS contains --autounmask=n, then --autounmask
+			# must be specified with --autounmask-continue.
+			({"EMERGE_DEFAULT_OPTS" : "--autounmask=n"},) + \
+				emerge_cmd + ("--autounmask", "--autounmask-continue", "dev-libs/C",),
 			# Verify that the above --autounmask-continue command caused
 			# USE=flag to be applied correctly to dev-libs/D.
 			portageq_cmd + ("match", eroot, "dev-libs/D[flag]"),


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-30  3:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-27 16:32 [gentoo-commits] proj/portage:master commit in: pym/portage/tests/emerge/, pym/_emerge/ Zac Medico
  -- strict thread matches above, loose matches on Subject: below --
2011-11-16 21:14 Zac Medico
2017-05-30  3:31 Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox