Package portage :: Package tests :: Package resolver :: Module test_virtual_slot
[hide private]

Source Code for Module portage.tests.resolver.test_virtual_slot

  1  # Copyright 2011 Gentoo Foundation 
  2  # Distributed under the terms of the GNU General Public License v2 
  3   
  4  from portage.tests import TestCase 
  5  from portage.tests.resolver.ResolverPlayground import ResolverPlayground, ResolverPlaygroundTestCase 
  6   
7 -class VirtualSlotResolverTestCase(TestCase):
8
10 11 ebuilds = { 12 "dev-java/oracle-jdk-bin-1.7.0" : {"SLOT": "1.7", "LICENSE": "TEST"}, 13 "dev-java/sun-jdk-1.6.0" : {"SLOT": "1.6", "LICENSE": "TEST"}, 14 "dev-java/icedtea-6.1.10.3" : {"SLOT": "6"}, 15 "app-misc/java-app-1": {"RDEPEND": ">=virtual/jdk-1.6.0"}, 16 "virtual/jdk-1.6.0": {"SLOT": "1.6", "RDEPEND": "|| ( =dev-java/icedtea-6* =dev-java/sun-jdk-1.6.0* )"}, 17 "virtual/jdk-1.7.0": {"SLOT": "1.7", "RDEPEND": "|| ( =dev-java/oracle-jdk-bin-1.7.0* )"}, 18 } 19 20 installed = { 21 "app-misc/java-app-1": {"RDEPEND": ">=virtual/jdk-1.6.0"}, 22 "dev-java/icedtea-6.1.10.3" : {"SLOT": "6"}, 23 "virtual/jdk-1.6.0": {"SLOT" : "1.6", "RDEPEND": "|| ( =dev-java/icedtea-6* =dev-java/sun-jdk-1.6.0* )"}, 24 } 25 26 world = ("app-misc/java-app",) 27 28 test_cases = ( 29 # Bug #382557 - Don't pull in the virtual/jdk-1.7.0 slot update 30 # since its dependencies can only be satisfied by a package that 31 # is masked by license. 32 ResolverPlaygroundTestCase( 33 ["@world"], 34 options = {"--update" : True, "--deep" : True}, 35 success = True, 36 mergelist = []), 37 ) 38 39 playground = ResolverPlayground( 40 ebuilds=ebuilds, installed=installed, world=world) 41 try: 42 for test_case in test_cases: 43 playground.run_TestCase(test_case) 44 self.assertEqual(test_case.test_success, True, test_case.fail_msg) 45 finally: 46 playground.cleanup()
47
48 - def testVirtualSlotUpdate(self):
49 50 ebuilds = { 51 "dev-java/oracle-jdk-bin-1.7.0" : {"SLOT": "1.7", "LICENSE": "TEST"}, 52 "dev-java/sun-jdk-1.6.0" : {"SLOT": "1.6", "LICENSE": "TEST"}, 53 "dev-java/icedtea-6.1.10.3" : {"SLOT": "6"}, 54 "dev-java/icedtea-7" : {"SLOT": "7"}, 55 "app-misc/java-app-1": {"RDEPEND": ">=virtual/jdk-1.6.0"}, 56 "virtual/jdk-1.6.0": {"SLOT": "1.6", "RDEPEND": "|| ( =dev-java/icedtea-6* =dev-java/sun-jdk-1.6.0* )"}, 57 "virtual/jdk-1.7.0": {"SLOT": "1.7", "RDEPEND": "|| ( =dev-java/icedtea-7* =dev-java/oracle-jdk-bin-1.7.0* )"}, 58 } 59 60 installed = { 61 "app-misc/java-app-1": {"RDEPEND": ">=virtual/jdk-1.6.0"}, 62 "dev-java/icedtea-6.1.10.3" : {"SLOT": "6"}, 63 "virtual/jdk-1.6.0": {"SLOT" : "1.6", "RDEPEND": "|| ( =dev-java/icedtea-6* =dev-java/sun-jdk-1.6.0* )"}, 64 } 65 66 world = ("app-misc/java-app",) 67 68 test_cases = ( 69 # Pull in the virtual/jdk-1.7.0 slot update since its dependencies 70 # can only be satisfied by an unmasked package. 71 ResolverPlaygroundTestCase( 72 ["@world"], 73 options = {"--update" : True, "--deep" : True}, 74 success = True, 75 mergelist = ["dev-java/icedtea-7", "virtual/jdk-1.7.0"]), 76 77 # Bug #275945 - Don't pull in the virtual/jdk-1.7.0 slot update 78 # unless --update is enabled. 79 ResolverPlaygroundTestCase( 80 ["@world"], 81 options = {"--selective" : True, "--deep" : True}, 82 success = True, 83 mergelist = []), 84 ) 85 86 playground = ResolverPlayground( 87 ebuilds=ebuilds, installed=installed, world=world) 88 try: 89 for test_case in test_cases: 90 playground.run_TestCase(test_case) 91 self.assertEqual(test_case.test_success, True, test_case.fail_msg) 92 finally: 93 playground.cleanup()
94
95 - def testVirtualSlotDepclean(self):
96 97 ebuilds = { 98 "dev-java/oracle-jdk-bin-1.7.0" : {"SLOT": "1.7", "LICENSE": "TEST"}, 99 "dev-java/sun-jdk-1.6.0" : {"SLOT": "1.6", "LICENSE": "TEST"}, 100 "dev-java/icedtea-6.1.10.3" : {"SLOT": "6"}, 101 "dev-java/icedtea-7" : {"SLOT": "7"}, 102 "app-misc/java-app-1": {"RDEPEND": ">=virtual/jdk-1.6.0"}, 103 "virtual/jdk-1.6.0": {"SLOT": "1.6", "RDEPEND": "|| ( =dev-java/icedtea-6* =dev-java/sun-jdk-1.6.0* )"}, 104 "virtual/jdk-1.7.0": {"SLOT": "1.7", "RDEPEND": "|| ( =dev-java/icedtea-7* =dev-java/oracle-jdk-bin-1.7.0* )"}, 105 } 106 107 installed = { 108 "app-misc/java-app-1": {"RDEPEND": ">=virtual/jdk-1.6.0"}, 109 "dev-java/icedtea-6.1.10.3" : {"SLOT": "6"}, 110 "dev-java/icedtea-7" : {"SLOT": "7"}, 111 "virtual/jdk-1.6.0": {"SLOT" : "1.6", "RDEPEND": "|| ( =dev-java/icedtea-6* =dev-java/sun-jdk-1.6.0* )"}, 112 "virtual/jdk-1.7.0": {"SLOT": "1.7", "RDEPEND": "|| ( =dev-java/icedtea-7* =dev-java/oracle-jdk-bin-1.7.0* )"}, 113 } 114 115 world = ("virtual/jdk:1.6", "app-misc/java-app",) 116 117 test_cases = ( 118 # Make sure that depclean doesn't remove a new slot even though 119 # it is redundant in the sense that the older slot will satisfy 120 # all dependencies. 121 ResolverPlaygroundTestCase( 122 [], 123 options = {"--depclean" : True}, 124 success = True, 125 cleanlist = []), 126 127 # Prune redundant lower slots, even if they are in world. 128 ResolverPlaygroundTestCase( 129 [], 130 options = {"--prune" : True}, 131 success = True, 132 cleanlist = ['virtual/jdk-1.6.0', 'dev-java/icedtea-6.1.10.3']), 133 ) 134 135 playground = ResolverPlayground( 136 ebuilds=ebuilds, installed=installed, world=world) 137 try: 138 for test_case in test_cases: 139 playground.run_TestCase(test_case) 140 self.assertEqual(test_case.test_success, True, test_case.fail_msg) 141 finally: 142 playground.cleanup()
143