summaryrefslogtreecommitdiffstats
path: root/pym/portage/tests/update
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2012-07-13 16:33:49 -0700
committerZac Medico <zmedico@gentoo.org>2012-07-13 16:33:49 -0700
commitdde6df65ecbc522dc23cb8d24be3e4dd52657da8 (patch)
tree9b0ca15a0ed3aa826654a6eb8c090e510c175268 /pym/portage/tests/update
parent4f1558ec085d4d1716faf8558741aad2e542463f (diff)
downloadportage-dde6df65ecbc522dc23cb8d24be3e4dd52657da8.tar.gz
portage-dde6df65ecbc522dc23cb8d24be3e4dd52657da8.tar.bz2
portage-dde6df65ecbc522dc23cb8d24be3e4dd52657da8.zip
slotmove: fix handling for EAPI 4-slot-abiv2.2.0_alpha118
This is just a really minimal fix, in order to prevent slotmove from behaving incorrectly with packages that use EAPI 4-slot-abi. Any slotmove commands that try so specify a sub-slot are treated as invalid for now, since that will required additional EAPI conditional logic, as reported in bug #426476.
Diffstat (limited to 'pym/portage/tests/update')
-rw-r--r--pym/portage/tests/update/__init__.py2
-rw-r--r--pym/portage/tests/update/__test__0
-rw-r--r--pym/portage/tests/update/test_move_slot_ent.py149
3 files changed, 151 insertions, 0 deletions
diff --git a/pym/portage/tests/update/__init__.py b/pym/portage/tests/update/__init__.py
new file mode 100644
index 000000000..418ad862b
--- /dev/null
+++ b/pym/portage/tests/update/__init__.py
@@ -0,0 +1,2 @@
+# Copyright 2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
diff --git a/pym/portage/tests/update/__test__ b/pym/portage/tests/update/__test__
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/pym/portage/tests/update/__test__
diff --git a/pym/portage/tests/update/test_move_slot_ent.py b/pym/portage/tests/update/test_move_slot_ent.py
new file mode 100644
index 000000000..64475bcd5
--- /dev/null
+++ b/pym/portage/tests/update/test_move_slot_ent.py
@@ -0,0 +1,149 @@
+# Copyright 2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import textwrap
+
+import portage
+from portage import os
+from portage.tests import TestCase
+from portage.tests.resolver.ResolverPlayground import ResolverPlayground
+from portage.util import ensure_dirs
+from portage._global_updates import _do_global_updates
+
+class MoveSlotEntTestCase(TestCase):
+
+ def testMoveSlotEnt(self):
+
+ ebuilds = {
+
+ "dev-libs/A-2::dont_apply_updates" : {
+ "EAPI": "4-slot-abi",
+ "SLOT": "0/2.30",
+ },
+
+ "dev-libs/B-2::dont_apply_updates" : {
+ "SLOT": "0",
+ },
+
+ "dev-libs/C-2.1::dont_apply_updates" : {
+ "EAPI": "4-slot-abi",
+ "SLOT": "0/2.1",
+ },
+
+ }
+
+ installed = {
+
+ "dev-libs/A-1::test_repo" : {
+ "EAPI": "4-slot-abi",
+ "SLOT": "0/2.30",
+ },
+
+ "dev-libs/B-1::test_repo" : {
+ "SLOT": "0",
+ },
+
+ "dev-libs/C-1::test_repo" : {
+ "EAPI": "4-slot-abi",
+ "SLOT": "0/1",
+ },
+
+ }
+
+ binpkgs = {
+
+ "dev-libs/A-1::test_repo" : {
+ "EAPI": "4-slot-abi",
+ "SLOT": "0/2.30",
+ },
+
+ "dev-libs/A-2::dont_apply_updates" : {
+ "EAPI": "4-slot-abi",
+ "SLOT": "0/2.30",
+ },
+
+ "dev-libs/B-1::test_repo" : {
+ "SLOT": "0",
+ },
+
+ "dev-libs/B-2::dont_apply_updates" : {
+ "SLOT": "0",
+ },
+
+ "dev-libs/C-1::test_repo" : {
+ "EAPI": "4-slot-abi",
+ "SLOT": "0/1",
+ },
+
+ "dev-libs/C-2.1::dont_apply_updates" : {
+ "EAPI": "4-slot-abi",
+ "SLOT": "0/2.1",
+ },
+
+ }
+
+ updates = textwrap.dedent("""
+ slotmove dev-libs/A 0 2
+ slotmove dev-libs/B 0 1
+ slotmove dev-libs/C 0 1
+ """)
+
+ playground = ResolverPlayground(binpkgs=binpkgs,
+ ebuilds=ebuilds, installed=installed)
+
+ settings = playground.settings
+ trees = playground.trees
+ eroot = settings["EROOT"]
+ portdir = settings["PORTDIR"]
+ portdb = trees[eroot]["porttree"].dbapi
+ vardb = trees[eroot]["vartree"].dbapi
+ bindb = trees[eroot]["bintree"].dbapi
+
+ updates_dir = os.path.join(portdir, "profiles", "updates")
+
+ try:
+ ensure_dirs(updates_dir)
+ with open(os.path.join(updates_dir, "1Q-2010"), 'w') as f:
+ f.write(updates)
+
+ # Create an empty updates directory, so that this
+ # repo doesn't inherit updates from the main repo.
+ ensure_dirs(os.path.join(
+ portdb.getRepositoryPath("dont_apply_updates"),
+ "profiles", "updates"))
+
+ global_noiselimit = portage.util.noiselimit
+ portage.util.noiselimit = -2
+ try:
+ _do_global_updates(trees, {})
+ finally:
+ portage.util.noiselimit = global_noiselimit
+
+ # 0/2.30 -> 2/2.30
+ self.assertEqual("2/2.30",
+ vardb.aux_get("dev-libs/A-1", ["SLOT"])[0])
+ self.assertEqual("2/2.30",
+ bindb.aux_get("dev-libs/A-1", ["SLOT"])[0])
+
+ # 0 -> 1
+ self.assertEqual("1",
+ vardb.aux_get("dev-libs/B-1", ["SLOT"])[0])
+ self.assertEqual("1",
+ bindb.aux_get("dev-libs/B-1", ["SLOT"])[0])
+
+ # 0/1 -> 1 (equivalent to 1/1)
+ self.assertEqual("1",
+ vardb.aux_get("dev-libs/C-1", ["SLOT"])[0])
+ self.assertEqual("1",
+ bindb.aux_get("dev-libs/C-1", ["SLOT"])[0])
+
+ # dont_apply_updates
+ self.assertEqual("0/2.30",
+ bindb.aux_get("dev-libs/A-2", ["SLOT"])[0])
+ self.assertEqual("0",
+ bindb.aux_get("dev-libs/B-2", ["SLOT"])[0])
+ self.assertEqual("0/2.1",
+ bindb.aux_get("dev-libs/C-2.1", ["SLOT"])[0])
+
+ finally:
+ playground.cleanup()