From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/tests/emerge/, bin/
Date: Mon, 5 Sep 2011 22:36:05 +0000 (UTC) [thread overview]
Message-ID: <41652a49cbd99ea129b36834faf5ba7508f3f617.zmedico@gentoo> (raw)
commit: 41652a49cbd99ea129b36834faf5ba7508f3f617
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 5 22:35:02 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Sep 5 22:35:02 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=41652a49
tests/emerge: test egencache
This tests --update in any case, and --update-use-local-desc only if
python xml support is detected.
---
bin/egencache | 11 +++-----
pym/portage/tests/emerge/test_simple.py | 43 ++++++++++++++++++++++++------
2 files changed, 38 insertions(+), 16 deletions(-)
diff --git a/bin/egencache b/bin/egencache
index 53ae565..bf29474 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -772,8 +772,6 @@ def egencache_main(args):
parser, options, atoms = parse_args(args)
config_root = options.config_root
- if config_root is None:
- config_root = '/'
# The calling environment is ignored, so the program is
# completely controlled by commandline arguments.
@@ -790,8 +788,10 @@ def egencache_main(args):
if options.portdir is not None:
env['PORTDIR'] = options.portdir
+ eprefix = os.environ.get("__PORTAGE_TEST_EPREFIX")
+
settings = portage.config(config_root=config_root,
- target_root='/', local_config=False, env=env)
+ local_config=False, env=env, _eprefix=eprefix)
default_opts = None
if not options.ignore_default_opts:
@@ -800,14 +800,11 @@ def egencache_main(args):
if default_opts:
parser, options, args = parse_args(default_opts + args)
- if options.config_root is not None:
- config_root = options.config_root
-
if options.cache_dir is not None:
env['PORTAGE_DEPCACHEDIR'] = options.cache_dir
settings = portage.config(config_root=config_root,
- target_root='/', local_config=False, env=env)
+ local_config=False, env=env, _eprefix=eprefix)
if not options.update and not options.update_use_local_desc \
and not options.update_changelogs:
diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py
index 20cfa8f..3f7a3be 100644
--- a/pym/portage/tests/emerge/test_simple.py
+++ b/pym/portage/tests/emerge/test_simple.py
@@ -7,7 +7,7 @@ import sys
import portage
from portage import os
from portage import _unicode_decode
-from portage.const import PORTAGE_BIN_PATH, PORTAGE_PYM_PATH
+from portage.const import PORTAGE_BIN_PATH, PORTAGE_PYM_PATH, USER_CONFIG_PATH
from portage.process import find_binary
from portage.tests import TestCase
from portage.tests.resolver.ResolverPlayground import ResolverPlayground
@@ -15,6 +15,14 @@ from portage.util import ensure_dirs
class SimpleEmergeTestCase(TestCase):
+ def _have_python_xml(self):
+ try:
+ __import__("xml.etree.ElementTree")
+ __import__("xml.parsers.expat").parsers.expat.ExpatError
+ except (AttributeError, ImportError):
+ return False
+ return True
+
def testSimple(self):
debug = False
@@ -111,6 +119,8 @@ src_install() {
)
portage_python = portage._python_interpreter
+ egencache_cmd = (portage_python, "-Wd",
+ os.path.join(PORTAGE_BIN_PATH, "egencache"))
emerge_cmd = (portage_python, "-Wd",
os.path.join(PORTAGE_BIN_PATH, "emerge"))
emaint_cmd = (portage_python, "-Wd",
@@ -118,7 +128,12 @@ src_install() {
quickpkg_cmd = (portage_python, "-Wd",
os.path.join(PORTAGE_BIN_PATH, "quickpkg"))
+ egencache_extra_args = []
+ if self._have_python_xml():
+ egencache_extra_args.append("--update-use-local-desc")
+
test_commands = (
+ egencache_cmd + ("--update",) + tuple(egencache_extra_args),
emerge_cmd + ("--version",),
emerge_cmd + ("--info",),
emerge_cmd + ("--info", "--verbose"),
@@ -149,8 +164,21 @@ src_install() {
portage_tmpdir = os.path.join(eprefix, "var", "tmp", "portage")
portdir = settings["PORTDIR"]
profile_path = settings.profile_path
+ user_config_dir = os.path.join(os.sep, eprefix, USER_CONFIG_PATH)
var_cache_edb = os.path.join(eprefix, "var", "cache", "edb")
+ features = []
+ features.append("metadata-transfer")
+ if not portage.process.sandbox_capable:
+ features.append("-sandbox")
+
+ # Since egencache ignores settings from the calling environment,
+ # configure it via make.conf.
+ make_conf = (
+ "FEATURES=\"%s\"\n" % (" ".join(features),),
+ "PORTDIR=\"%s\"\n" % (portdir,),
+ )
+
path = os.environ.get("PATH")
if path is not None and not path.strip():
path = None
@@ -188,17 +216,11 @@ src_install() {
"PORTAGE_PYTHON" : portage_python,
"PORTAGE_TMPDIR" : portage_tmpdir,
"PORTAGE_USERNAME" : os.environ["PORTAGE_USERNAME"],
- "PORTDIR" : portdir,
"PYTHONPATH" : pythonpath,
}
- features = []
- if not portage.process.sandbox_capable:
- features.append("-sandbox")
- if features:
- env["FEATURES"] = " ".join(features)
-
- dirs = [distdir, fake_bin, portage_tmpdir, var_cache_edb]
+ dirs = [distdir, fake_bin, portage_tmpdir,
+ user_config_dir, var_cache_edb]
true_symlinks = ["chown", "chgrp"]
true_binary = find_binary("true")
self.assertEqual(true_binary is None, False,
@@ -206,6 +228,9 @@ src_install() {
try:
for d in dirs:
ensure_dirs(d)
+ with open(os.path.join(user_config_dir, "make.conf"), 'w') as f:
+ for line in make_conf:
+ f.write(line)
for x in true_symlinks:
os.symlink(true_binary, os.path.join(fake_bin, x))
with open(os.path.join(var_cache_edb, "counter"), 'wb') as f:
next reply other threads:[~2011-09-05 22:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-05 22:36 Zac Medico [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-09-07 17:50 [gentoo-commits] proj/portage:master commit in: pym/portage/tests/emerge/, bin/ Zac Medico
2013-02-10 20:14 Zac Medico
2013-03-21 0:38 Zac Medico
2014-11-14 17:29 Zac Medico
2018-05-01 18:15 Zac Medico
2018-05-01 23:50 Zac Medico
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41652a49cbd99ea129b36834faf5ba7508f3f617.zmedico@gentoo \
--to=zmedico@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox