Stop using config["PORTDIR"] in some tests.
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Sat, 13 Jul 2013 00:39:15 +0000 (02:39 +0200)
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Sat, 13 Jul 2013 00:39:15 +0000 (02:39 +0200)
pym/portage/tests/dbapi/test_portdb_cache.py
pym/portage/tests/emerge/test_emerge_slot_abi.py
pym/portage/tests/emerge/test_simple.py
pym/portage/tests/repoman/test_simple.py
pym/portage/tests/update/test_move_ent.py
pym/portage/tests/update/test_move_slot_ent.py
pym/portage/tests/update/test_update_dbentry.py

index b9f9fed5a15708557b6ec8359af68259580f7a50..e5270c52671a61e353ab55849cc1b7273c5fa70a 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2012 Gentoo Foundation
+# Copyright 2012-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 import subprocess
@@ -29,9 +29,9 @@ class PortdbCacheTestCase(TestCase):
                playground = ResolverPlayground(ebuilds=ebuilds, debug=debug)
                settings = playground.settings
                eprefix = settings["EPREFIX"]
-               portdir = settings["PORTDIR"]
+               test_repo_location = settings.repositories["test_repo"].location
                user_config_dir = os.path.join(eprefix, USER_CONFIG_PATH)
-               metadata_dir = os.path.join(portdir, "metadata")
+               metadata_dir = os.path.join(test_repo_location, "metadata")
                md5_cache_dir = os.path.join(metadata_dir, "md5-cache")
                pms_cache_dir = os.path.join(metadata_dir, "cache")
                layout_conf_path = os.path.join(metadata_dir, "layout.conf")
index 401c23bbf175c8dc44a646028d68f4a22bb34b2c..949caf3111d21bea956559bd98213c0100c2bd31 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2012 Gentoo Foundation
+# Copyright 2012-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 import subprocess
@@ -64,7 +64,6 @@ class SlotAbiEmergeTestCase(TestCase):
                trees = playground.trees
                portdb = trees[eroot]["porttree"].dbapi
                vardb = trees[eroot]["vartree"].dbapi
-               portdir = settings["PORTDIR"]
                var_cache_edb = os.path.join(eprefix, "var", "cache", "edb")
                user_config_dir = os.path.join(eprefix, USER_CONFIG_PATH)
                package_mask_path = os.path.join(user_config_dir, "package.mask")
index bbff6d80d41833c275bed00eb8ac396a990a402c..a74e646adbdf68c0a06919ee9ef7f07cd61bb19a 100644 (file)
@@ -168,10 +168,10 @@ pkg_preinst() {
                eroot = settings["EROOT"]
                trees = playground.trees
                portdb = trees[eroot]["porttree"].dbapi
-               portdir = settings["PORTDIR"]
+               test_repo_location = settings.repositories["test_repo"].location
                var_cache_edb = os.path.join(eprefix, "var", "cache", "edb")
                cachedir = os.path.join(var_cache_edb, "dep")
-               cachedir_pregen = os.path.join(portdir, "metadata", "md5-cache")
+               cachedir_pregen = os.path.join(test_repo_location, "metadata", "md5-cache")
 
                portage_python = portage._python_interpreter
                dispatch_conf_cmd = (portage_python, "-Wd",
@@ -346,7 +346,7 @@ pkg_preinst() {
                        env["__PORTAGE_TEST_HARDLINK_LOCKS"] = \
                                os.environ["__PORTAGE_TEST_HARDLINK_LOCKS"]
 
-               updates_dir = os.path.join(portdir, "profiles", "updates")
+               updates_dir = os.path.join(test_repo_location, "profiles", "updates")
                dirs = [cachedir, cachedir_pregen, distdir, fake_bin,
                        portage_tmpdir, updates_dir,
                        user_config_dir, var_cache_edb]
@@ -372,7 +372,7 @@ pkg_preinst() {
                        with open(os.path.join(profile_path, "packages"), 'w') as f:
                                f.write("*dev-libs/token-system-pkg")
                        for cp, xml_data in metadata_xml_files:
-                               with open(os.path.join(portdir, cp, "metadata.xml"), 'w') as f:
+                               with open(os.path.join(test_repo_location, cp, "metadata.xml"), 'w') as f:
                                        f.write(playground.metadata_xml_template % xml_data)
                        with open(os.path.join(updates_dir, "1Q-2010"), 'w') as f:
                                f.write("""
index 420297caa3982ebf3938039444d26613b1af1f25..83227a9c5f2d9220c67c4b16177ce82eb96218cf 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 Gentoo Foundation
+# Copyright 2011-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 import subprocess
@@ -166,9 +166,9 @@ class SimpleRepomanTestCase(TestCase):
                portdb = playground.trees[playground.eroot]["porttree"].dbapi
                homedir = os.path.join(eroot, "home")
                distdir = os.path.join(eprefix, "distdir")
-               portdir = settings["PORTDIR"]
-               profiles_dir = os.path.join(portdir, "profiles")
-               license_dir = os.path.join(portdir, "licenses")
+               test_repo_location = settings.repositories["test_repo"].location
+               profiles_dir = os.path.join(test_repo_location, "profiles")
+               license_dir = os.path.join(test_repo_location, "licenses")
 
                repoman_cmd = (portage._python_interpreter, "-Wd",
                        os.path.join(PORTAGE_BIN_PATH, "repoman"))
@@ -228,7 +228,7 @@ class SimpleRepomanTestCase(TestCase):
                        "PATH" : os.environ["PATH"],
                        "PORTAGE_GRPNAME" : os.environ["PORTAGE_GRPNAME"],
                        "PORTAGE_USERNAME" : os.environ["PORTAGE_USERNAME"],
-                       "PORTDIR" : portdir,
+                       "PORTDIR" : test_repo_location,
                        "PYTHONPATH" : pythonpath,
                }
 
@@ -240,7 +240,7 @@ class SimpleRepomanTestCase(TestCase):
                try:
                        for d in dirs:
                                ensure_dirs(d)
-                       with open(os.path.join(portdir, "skel.ChangeLog"), 'w') as f:
+                       with open(os.path.join(test_repo_location, "skel.ChangeLog"), 'w') as f:
                                f.write(copyright_header)
                        with open(os.path.join(profiles_dir, "profiles.desc"), 'w') as f:
                                for x in profiles:
@@ -266,12 +266,12 @@ class SimpleRepomanTestCase(TestCase):
                                for k, v in use_desc:
                                        f.write("%s - %s\n" % (k, v))
                        for cp, xml_data in metadata_xml_files:
-                               with open(os.path.join(portdir, cp, "metadata.xml"), 'w') as f:
+                               with open(os.path.join(test_repo_location, cp, "metadata.xml"), 'w') as f:
                                        f.write(playground.metadata_xml_template % xml_data)
-                       # Use a symlink to portdir, in order to trigger bugs
+                       # Use a symlink to test_repo, in order to trigger bugs
                        # involving canonical vs. non-canonical paths.
-                       portdir_symlink = os.path.join(eroot, "portdir_symlink")
-                       os.symlink(portdir, portdir_symlink)
+                       test_repo_symlink = os.path.join(eroot, "test_repo_symlink")
+                       os.symlink(test_repo_location, test_repo_symlink)
                        # repoman checks metadata.dtd for recent CTIME, so copy the file in
                        # order to ensure that the CTIME is current
                        shutil.copyfile(metadata_dtd, os.path.join(distdir, "metadata.dtd"))
@@ -286,7 +286,7 @@ class SimpleRepomanTestCase(TestCase):
                                stdout = subprocess.PIPE
 
                        for cwd in ("", "dev-libs", "dev-libs/A", "dev-libs/B"):
-                               abs_cwd = os.path.join(portdir_symlink, cwd)
+                               abs_cwd = os.path.join(test_repo_symlink, cwd)
                                proc = subprocess.Popen([portage._python_interpreter, "-Wd",
                                        os.path.join(PORTAGE_BIN_PATH, "repoman"), "full"],
                                        cwd=abs_cwd, env=env, stdout=stdout)
@@ -306,7 +306,7 @@ class SimpleRepomanTestCase(TestCase):
 
                        if git_binary is not None:
                                for cwd, cmd in git_test:
-                                       abs_cwd = os.path.join(portdir_symlink, cwd)
+                                       abs_cwd = os.path.join(test_repo_symlink, cwd)
                                        proc = subprocess.Popen(cmd,
                                                cwd=abs_cwd, env=env, stdout=stdout)
 
index 2504dee2b13a8342ed6cf2b1df4e12fcb478b741..d9647a95e83d862ee328c5149830196753d1abae 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2012 Gentoo Foundation
+# Copyright 2012-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 import textwrap
@@ -59,12 +59,12 @@ class MoveEntTestCase(TestCase):
                settings = playground.settings
                trees = playground.trees
                eroot = settings["EROOT"]
-               portdir = settings["PORTDIR"]
+               test_repo_location = settings.repositories["test_repo"].location
                portdb = trees[eroot]["porttree"].dbapi
                vardb = trees[eroot]["vartree"].dbapi
                bindb = trees[eroot]["bintree"].dbapi
 
-               updates_dir = os.path.join(portdir, "profiles", "updates")
+               updates_dir = os.path.join(test_repo_location, "profiles", "updates")
 
                try:
                        ensure_dirs(updates_dir)
index fcb0cc64c6ac2365874342b496f70853e22dd23a..3e49e1144dcf0070f6db2da589d88a60d6a7878e 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2012 Gentoo Foundation
+# Copyright 2012-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 import textwrap
@@ -94,12 +94,12 @@ class MoveSlotEntTestCase(TestCase):
                settings = playground.settings
                trees = playground.trees
                eroot = settings["EROOT"]
-               portdir = settings["PORTDIR"]
+               test_repo_location = settings.repositories["test_repo"].location
                portdb = trees[eroot]["porttree"].dbapi
                vardb = trees[eroot]["vartree"].dbapi
                bindb = trees[eroot]["bintree"].dbapi
 
-               updates_dir = os.path.join(portdir, "profiles", "updates")
+               updates_dir = os.path.join(test_repo_location, "profiles", "updates")
 
                try:
                        ensure_dirs(updates_dir)
index 39b8e665d8d238bbbd9534782f023c16c6ec4b8d..88951149a45ad2b4f8a568ac5408c1f0f54d458a 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2012 Gentoo Foundation
+# Copyright 2012-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 import re
@@ -189,14 +189,14 @@ class UpdateDbentryTestCase(TestCase):
                settings = playground.settings
                trees = playground.trees
                eroot = settings["EROOT"]
-               portdir = settings["PORTDIR"]
+               test_repo_location = settings.repositories["test_repo"].location
                portdb = trees[eroot]["porttree"].dbapi
                vardb = trees[eroot]["vartree"].dbapi
                bindb = trees[eroot]["bintree"].dbapi
                setconfig = trees[eroot]["root_config"].setconfig
                selected_set = setconfig.getSets()["selected"]
 
-               updates_dir = os.path.join(portdir, "profiles", "updates")
+               updates_dir = os.path.join(test_repo_location, "profiles", "updates")
 
                try:
                        ensure_dirs(updates_dir)