def testWithTestDeps(self):
		ebuilds = {
			"app-misc/A-0": {
				"EAPI": "5",
				"IUSE": "test",
				"DEPEND": "test? ( app-misc/B )"
			},
			"app-misc/B-0": {
				"EAPI": "5",
				"IUSE": "test",
				"DEPEND": "test? ( app-misc/C )"
			},
			"app-misc/C-0": {
				"EAPI": "5",
			}
		}

		test_cases = (
			# Test that --with-test-deps only pulls in direct
			# test deps of packages matched by arguments.
			ResolverPlaygroundTestCase(
				["app-misc/A"],
				success = True,
				options = { "--onlydeps": True, "--with-test-deps": True },
				mergelist = ["app-misc/B-0"]),
		)

		playground = ResolverPlayground(ebuilds=ebuilds, debug=False)
		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success,
					True, test_case.fail_msg)
		finally:
			playground.cleanup()
Example #2
0
	def testSetCpv(self):
		"""
		Test the clone via constructor.
		"""

		ebuilds = {
			"dev-libs/A-1": {"IUSE": "static-libs"},
			"dev-libs/B-1": {"IUSE": "static-libs"},
		}

		env_files = {
			"A" : ("USE=\"static-libs\"",)
		}

		package_env = (
			"dev-libs/A A",
		)

		eprefix = normalize_path(tempfile.mkdtemp())
		playground = None
		try:
			user_config_dir = os.path.join(eprefix, USER_CONFIG_PATH)
			os.makedirs(user_config_dir)

			with io.open(os.path.join(user_config_dir, "package.env"),
				mode='w', encoding=_encodings['content']) as f:
				for line in package_env:
					f.write(line + "\n")

			env_dir = os.path.join(user_config_dir, "env")
			os.makedirs(env_dir)
			for k, v in env_files.items():
				with io.open(os.path.join(env_dir, k), mode='w',
					encoding=_encodings['content']) as f:
					for line in v:
						f.write(line + "\n")

			playground = ResolverPlayground(eprefix=eprefix, ebuilds=ebuilds)
			settings = config(clone=playground.settings)

			result = playground.run(["=dev-libs/A-1"])
			pkg, existing_node = result.depgraph._select_package(
				playground.eroot, Atom("=dev-libs/A-1"))
			settings.setcpv(pkg)
			self.assertTrue("static-libs" in
				settings["PORTAGE_USE"].split())

			# Test bug #522362, where a USE=static-libs package.env
			# setting leaked from one setcpv call to the next.
			pkg, existing_node = result.depgraph._select_package(
				playground.eroot, Atom("=dev-libs/B-1"))
			settings.setcpv(pkg)
			self.assertTrue("static-libs" not in
				settings["PORTAGE_USE"].split())

		finally:
			if playground is None:
				shutil.rmtree(eprefix)
			else:
				playground.cleanup()
Example #3
0
    def testPackageMaskOrder(self):

        ebuilds = {"dev-libs/A-1": {}, "dev-libs/B-1": {}, "dev-libs/C-1": {}, "dev-libs/D-1": {}, "dev-libs/E-1": {}}

        repo_configs = {"test_repo": {"package.mask": ("dev-libs/A", "dev-libs/C")}}

        profile = {"package.mask": ("-dev-libs/A", "dev-libs/B", "-dev-libs/B", "dev-libs/D")}

        user_config = {"package.mask": ("-dev-libs/C", "-dev-libs/D", "dev-libs/E")}

        test_cases = (
            ResolverPlaygroundTestCase(["dev-libs/A"], options={"--autounmask": "n"}, success=False),
            ResolverPlaygroundTestCase(["dev-libs/B"], success=True, mergelist=["dev-libs/B-1"]),
            ResolverPlaygroundTestCase(["dev-libs/C"], success=True, mergelist=["dev-libs/C-1"]),
            ResolverPlaygroundTestCase(["dev-libs/D"], success=True, mergelist=["dev-libs/D-1"]),
            ResolverPlaygroundTestCase(["dev-libs/E"], options={"--autounmask": "n"}, success=False),
        )

        playground = ResolverPlayground(
            ebuilds=ebuilds, repo_configs=repo_configs, profile=profile, user_config=user_config
        )
        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True, test_case.fail_msg)
        finally:
            playground.cleanup()
Example #4
0
	def testConnectedCollision(self):
		"""
		Ensure that we are able to solve connected slot conflicts
		which cannot be solved each on their own.
		"""
		ebuilds = {
			"dev-libs/A-1": { "RDEPEND": "=dev-libs/X-1" },
			"dev-libs/B-1": { "RDEPEND": "dev-libs/X" },

			"dev-libs/X-1": { "RDEPEND": "=dev-libs/Y-1" },
			"dev-libs/X-2": { "RDEPEND": "=dev-libs/Y-2" },

			"dev-libs/Y-1": { "PDEPEND": "=dev-libs/X-1" },
			"dev-libs/Y-2": { "PDEPEND": "=dev-libs/X-2" },
			}

		test_cases = (
			ResolverPlaygroundTestCase(
				["dev-libs/A", "dev-libs/B"],
				all_permutations = True,
				options = { "--backtrack": 0 },
				success = True,
				ambiguous_merge_order = True,
				mergelist = ["dev-libs/Y-1", "dev-libs/X-1", ("dev-libs/A-1", "dev-libs/B-1")]),
			)

		playground = ResolverPlayground(ebuilds=ebuilds, debug=False)
		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
		finally:
			playground.cleanup()
    def testBacktrackNotNeeded(self):
        ebuilds = {
            "dev-libs/A-1": {},
            "dev-libs/A-2": {},
            "dev-libs/B-1": {},
            "dev-libs/B-2": {},
            "dev-libs/C-1": {"DEPEND": "dev-libs/A dev-libs/B"},
            "dev-libs/D-1": {"DEPEND": "=dev-libs/A-1 =dev-libs/B-1"},
        }

        test_cases = (
            ResolverPlaygroundTestCase(
                ["dev-libs/C", "dev-libs/D"],
                all_permutations=True,
                options={"--backtrack": 1},
                mergelist=["dev-libs/A-1", "dev-libs/B-1", "dev-libs/C-1", "dev-libs/D-1"],
                ignore_mergelist_order=True,
                success=True,
            ),
        )

        playground = ResolverPlayground(ebuilds=ebuilds)

        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True, test_case.fail_msg)
        finally:
            playground.cleanup()
    def testBacktrackNoWrongRebuilds(self):
        """
		Ensure we remove backtrack masks if the reason for the mask gets masked itself.
		"""

        ebuilds = {
            "dev-libs/A-1": {},
            "dev-libs/A-2": {},
            "dev-libs/B-1": {"RDEPEND": "dev-libs/D"},
            "dev-libs/C-1": {},
            "dev-libs/C-2": {"RDEPEND": ">=dev-libs/A-2"},
            "dev-libs/D-1": {"RDEPEND": "<dev-libs/A-2"},
        }

        installed = {
            "dev-libs/A-1": {},
            "dev-libs/B-1": {"RDEPEND": "dev-libs/D"},
            "dev-libs/C-1": {},
            "dev-libs/D-1": {"RDEPEND": "<dev-libs/A-2"},
        }

        world = ["dev-libs/B", "dev-libs/C"]

        options = {"--update": True, "--deep": True, "--selective": True}

        test_cases = (ResolverPlaygroundTestCase(["@world"], options=options, mergelist=[], success=True),)

        playground = ResolverPlayground(ebuilds=ebuilds, installed=installed, world=world)

        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True, test_case.fail_msg)
        finally:
            playground.cleanup()
Example #7
0
	def testDepcleanInstalledKeywordMaskedSlot(self):
		"""
		Verify that depclean removes newer slot
		masked by KEYWORDS (see bug #350285).
		"""
		ebuilds = {
			"dev-libs/A-1": { "RDEPEND": "|| ( =dev-libs/B-2.7* =dev-libs/B-2.6* )" },
			"dev-libs/B-2.6": { "SLOT":"2.6", "KEYWORDS": "x86" },
			"dev-libs/B-2.7": { "SLOT":"2.7", "KEYWORDS": "~x86" },
			}
		installed = {
			"dev-libs/A-1": { "EAPI" : "3", "RDEPEND": "|| ( dev-libs/B:2.7 dev-libs/B:2.6 )" },
			"dev-libs/B-2.6": { "SLOT":"2.6", "KEYWORDS": "x86" },
			"dev-libs/B-2.7": { "SLOT":"2.7", "KEYWORDS": "~x86" },
			}

		world = (
			"dev-libs/A",
			)

		test_cases = (
			ResolverPlaygroundTestCase(
				[],
				options={"--depclean": True},
				success=True,
				cleanlist=["dev-libs/B-2.7"]),
			)

		playground = ResolverPlayground(ebuilds=ebuilds, installed=installed, world=world)
		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
		finally:
			playground.cleanup()
Example #8
0
	def testOnlydeps(self):
		ebuilds = {
			"dev-libs/A-1": { "DEPEND": "dev-libs/B" },
			"dev-libs/B-1": { },
			}
		installed = {
			"dev-libs/B-1": { },
		}

		test_cases = (
			ResolverPlaygroundTestCase(
				["dev-libs/A", "dev-libs/B"],
				all_permutations = True,
				success = True,
				options = { "--onlydeps": True },
				mergelist = ["dev-libs/B-1"]),
			)

		playground = ResolverPlayground(ebuilds=ebuilds,
			installed=installed, debug=False)
		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
		finally:
			playground.cleanup()
	def testOldDepChainDisplay(self):
		ebuilds = {
			"dev-libs/A-1": { "DEPEND": "foo? ( dev-libs/B[-bar] )", "IUSE": "+foo", "EAPI": "2" }, 
			"dev-libs/A-2": { "DEPEND": "foo? ( dev-libs/C )", "IUSE": "+foo", "EAPI": "1" }, 
			"dev-libs/B-1": { "IUSE": "bar", "DEPEND": "!bar? ( dev-libs/D[-baz] )", "EAPI": "2" },
			"dev-libs/C-1": { "KEYWORDS": "~x86" },
			"dev-libs/D-1": { "IUSE": "+baz", "EAPI": "1" },
			}

		test_cases = (
			ResolverPlaygroundTestCase(
				["=dev-libs/A-1"],
				options = { "--autounmask": 'n' },
				success = False),
			ResolverPlaygroundTestCase(
				["=dev-libs/A-2"],
				options = { "--autounmask": 'n' },
				success = False),
			)

		playground = ResolverPlayground(ebuilds=ebuilds)
		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
		finally:
			playground.cleanup()
Example #10
0
	def testFeaturesMutation(self):
		"""
		Test whether mutation of config.features updates the FEATURES
		variable and persists through config.regenerate() calls.
		"""
		playground = ResolverPlayground()
		try:
			settings = config(clone=playground.settings)

			settings.features.add('noclean')
			self.assertEqual('noclean' in settings['FEATURES'].split(), True)
			settings.regenerate()
			self.assertEqual('noclean' in settings['FEATURES'].split(),True)

			settings.features.discard('noclean')
			self.assertEqual('noclean' in settings['FEATURES'].split(), False)
			settings.regenerate()
			self.assertEqual('noclean' in settings['FEATURES'].split(), False)

			settings.features.add('noclean')
			self.assertEqual('noclean' in settings['FEATURES'].split(), True)
			settings.regenerate()
			self.assertEqual('noclean' in settings['FEATURES'].split(),True)
		finally:
			playground.cleanup()
	def testHittingTheBacktrackLimit(self):
		ebuilds = {
			"dev-libs/A-1": {},
			"dev-libs/A-2": {},
			"dev-libs/B-1": {},
			"dev-libs/B-2": {},
			"dev-libs/C-1": { "DEPEND": "dev-libs/A dev-libs/B" },
			"dev-libs/D-1": { "DEPEND": "=dev-libs/A-1 =dev-libs/B-1" },
			}

		test_cases = (
				ResolverPlaygroundTestCase(
					["dev-libs/C", "dev-libs/D"],
					all_permutations = True,
					mergelist = ["dev-libs/A-1", "dev-libs/B-1", "dev-libs/C-1", "dev-libs/D-1"],
					ignore_mergelist_order = True,
					success = True),
				#This one hits the backtrack limit. Be aware that this depends on the argument order.
				ResolverPlaygroundTestCase(
					["dev-libs/D", "dev-libs/C"],
					options = { "--backtrack": 1 },
					mergelist = ["dev-libs/A-1", "dev-libs/B-1", "dev-libs/A-2", "dev-libs/B-2", "dev-libs/C-1", "dev-libs/D-1"],
					ignore_mergelist_order = True,
					slot_collision_solutions = [],
					success = False),
			)

		playground = ResolverPlayground(ebuilds=ebuilds)

		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
		finally:
			playground.cleanup()
	def testSlotChangeWithoutRevBump(self):

		ebuilds = {
			"app-arch/libarchive-3.1.1" : {
				"EAPI": "5",
				"SLOT": "0/13"
			},
			"app-arch/libarchive-3.0.4-r1" : {
				"EAPI": "5",
				"SLOT": "0"
			},
			"kde-base/ark-4.10.0" : {
				"EAPI": "5",
				"DEPEND": "app-arch/libarchive:=",
				"RDEPEND": "app-arch/libarchive:="
			},
		}

		binpkgs = {
			"app-arch/libarchive-3.1.1" : {
				"EAPI": "5",
				"SLOT": "0"
			},
		}

		installed = {
			"app-arch/libarchive-3.1.1" : {
				"EAPI": "5",
				"SLOT": "0"
			},

			"kde-base/ark-4.10.0" : {
				"EAPI": "5",
				"DEPEND": "app-arch/libarchive:0/0=",
				"RDEPEND": "app-arch/libarchive:0/0="
			},
		}

		world = ["kde-base/ark"]

		test_cases = (

			# Demonstrate bug #456208, where a sub-slot change
			# without revbump needs to trigger a rebuild.
			ResolverPlaygroundTestCase(
				["kde-base/ark"],
				options = {"--oneshot": True, "--usepkg": True},
				success = True,
				mergelist = ['app-arch/libarchive-3.1.1', "kde-base/ark-4.10.0"]),

		)

		playground = ResolverPlayground(ebuilds=ebuilds, binpkgs=binpkgs,
			installed=installed, world=world, debug=False)
		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
		finally:
			playground.cleanup()
	def testBacktrackingGoodVersionFirst(self):
		"""
		When backtracking due to slot conflicts, we masked the version that has been pulled
		in first. This is not always a good idea. Mask the highest version instead.
		"""

		ebuilds = {
			"dev-libs/A-1": { "DEPEND": "=dev-libs/C-1 dev-libs/B" },
			"dev-libs/B-1": { "DEPEND": "=dev-libs/C-1" },
			"dev-libs/B-2": { "DEPEND": "=dev-libs/C-2" },
			"dev-libs/C-1": { },
			"dev-libs/C-2": { },
			}

		test_cases = (
				ResolverPlaygroundTestCase(
					["dev-libs/A"],
					mergelist = ["dev-libs/C-1", "dev-libs/B-1", "dev-libs/A-1", ],
					success = True),
			)

		playground = ResolverPlayground(ebuilds=ebuilds)

		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
		finally:
			playground.cleanup()
    def testAutounmaskMultilibUse(self):

        self.todo = True

        ebuilds = {
            "x11-proto/xextproto-7.2.1-r1": {"EAPI": "5", "IUSE": "abi_x86_32 abi_x86_64"},
            "x11-libs/libXaw-1.0.11-r2": {
                "EAPI": "5",
                "IUSE": "abi_x86_32 abi_x86_64",
                "RDEPEND": "x11-proto/xextproto[abi_x86_32(-)?,abi_x86_64(-)?]",
            },
            "app-emulation/emul-linux-x86-xlibs-20130224-r2": {"EAPI": "5", "RDEPEND": "x11-libs/libXaw[abi_x86_32]"},
            "games-util/steam-client-meta-0-r20130514": {"EAPI": "5", "RDEPEND": "app-emulation/emul-linux-x86-xlibs"},
        }

        installed = {
            "x11-proto/xextproto-7.2.1-r1": {
                "EAPI": "5",
                "IUSE": "abi_x86_32 abi_x86_64",
                "USE": "abi_x86_32 abi_x86_64",
            },
            "x11-libs/libXaw-1.0.11-r2": {
                "EAPI": "5",
                "IUSE": "abi_x86_32 abi_x86_64",
                "RDEPEND": "x11-proto/xextproto[abi_x86_32(-)?,abi_x86_64(-)?]",
                "USE": "abi_x86_32 abi_x86_64",
            },
            "app-emulation/emul-linux-x86-xlibs-20130224-r2": {"EAPI": "5", "RDEPEND": "x11-libs/libXaw[abi_x86_32]"},
            "games-util/steam-client-meta-0-r20130514": {"EAPI": "5", "RDEPEND": "app-emulation/emul-linux-x86-xlibs"},
        }

        user_config = {
            # "make.conf" : ("USE=\"abi_x86_32 abi_x86_64\"",)
            "make.conf": ('USE="abi_x86_64"',)
        }

        world = ("games-util/steam-client-meta",)

        test_cases = (
            # Test autounmask solving of multilib use deps for bug #481628.
            # We would like it to suggest some USE changes, but instead it
            # currently fails with a SLOT conflict.
            ResolverPlaygroundTestCase(
                ["x11-proto/xextproto", "x11-libs/libXaw"],
                options={"--oneshot": True, "--autounmask": True, "--backtrack": 30},
                mergelist=["x11-proto/xextproto-7.2.1-r1", "x11-libs/libXaw-1.0.11-r2"],
                success=True,
            ),
        )

        playground = ResolverPlayground(
            ebuilds=ebuilds, installed=installed, user_config=user_config, world=world, debug=False
        )

        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True, test_case.fail_msg)
        finally:
            playground.cleanup()
	def testDirectVirtualCircularDependency(self):

		# Bug #384107
		self.todo = True

		ebuilds = {
			"dev-java/icedtea-6.1.10.3": { "SLOT" : "6", "DEPEND": "virtual/jdk" },
			"dev-java/icedtea6-bin-1.10.3": {},
			"virtual/jdk-1.6.0": { "SLOT" : "1.6", "RDEPEND": "|| ( dev-java/icedtea6-bin =dev-java/icedtea-6* )" },
		}

		test_cases = (
			# Automatically pull in icedtea6-bin to solve a circular dep
			ResolverPlaygroundTestCase(
				["dev-java/icedtea"],
				mergelist = ["dev-java/icedtea6-bin-1.10.3", "virtual/jdk-1.6.0", "dev-java/icedtea-6.1.10.3"],
				success = True,
			),
		)

		playground = ResolverPlayground(ebuilds=ebuilds)
		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
		finally:
			playground.cleanup()
Example #16
0
	def testSimpleDepclean(self):
		ebuilds = {
			"dev-libs/A-1": {},
			"dev-libs/B-1": {},
			}
		installed = {
			"dev-libs/A-1": {},
			"dev-libs/B-1": {},
			}

		world = (
			"dev-libs/A",
			)

		test_cases = (
			ResolverPlaygroundTestCase(
				[],
				options={"--depclean": True},
				success=True,
				cleanlist=["dev-libs/B-1"]),
			)

		playground = ResolverPlayground(ebuilds=ebuilds, installed=installed, world=world)
		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
		finally:
			playground.cleanup()
	def testBacktrackMissedUpdates(self):
		"""
		An update is missed due to a dependency on an older version.
		"""

		ebuilds = {
			"dev-libs/A-1": { },
			"dev-libs/A-2": { },
			"dev-libs/B-1": { "RDEPEND": "<=dev-libs/A-1" },
			}

		installed = {
			"dev-libs/A-1": { "USE": "" },
			"dev-libs/B-1": { "USE": "", "RDEPEND": "<=dev-libs/A-1" },
			}

		options = {'--update' : True, '--deep' : True, '--selective' : True}

		test_cases = (
				ResolverPlaygroundTestCase(
					["dev-libs/A", "dev-libs/B"],
					options = options,
					all_permutations = True,
					mergelist = [],
					success = True),
			)

		playground = ResolverPlayground(ebuilds=ebuilds, installed=installed)

		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
		finally:
			playground.cleanup()
	def testUseDepDefaultse(self):

		ebuilds = {
			"dev-libs/A-1": { "DEPEND": "dev-libs/B[foo]", "RDEPEND": "dev-libs/B[foo]", "EAPI": "2" },
			"dev-libs/A-2": { "DEPEND": "dev-libs/B[foo(+)]", "RDEPEND": "dev-libs/B[foo(+)]", "EAPI": "4" },
			"dev-libs/A-3": { "DEPEND": "dev-libs/B[foo(-)]", "RDEPEND": "dev-libs/B[foo(-)]", "EAPI": "4" },
			"dev-libs/B-1": { "IUSE": "+foo", "EAPI": "1" },
			"dev-libs/B-2": {},
			}

		test_cases = (
			ResolverPlaygroundTestCase(
				["=dev-libs/A-1"],
				success = True,
				mergelist = ["dev-libs/B-1", "dev-libs/A-1"]),
			ResolverPlaygroundTestCase(
				["=dev-libs/A-2"],
				success = True,
				mergelist = ["dev-libs/B-2", "dev-libs/A-2"]),
			ResolverPlaygroundTestCase(
				["=dev-libs/A-3"],
				success = True,
				mergelist = ["dev-libs/B-1", "dev-libs/A-3"]),
			)

		playground = ResolverPlayground(ebuilds=ebuilds)
		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
		finally:
			playground.cleanup()
	def testBacktrackWithoutUpdates(self):
		"""
		If --update is not given we might have to mask the old installed version later.
		"""

		ebuilds = {
			"dev-libs/A-1": { "DEPEND": "dev-libs/Z" },
			"dev-libs/B-1": { "DEPEND": ">=dev-libs/Z-2" },
			"dev-libs/Z-1": { },
			"dev-libs/Z-2": { },
			}

		installed = {
			"dev-libs/Z-1": { "USE": "" },
			}

		test_cases = (
				ResolverPlaygroundTestCase(
					["dev-libs/B", "dev-libs/A"],
					all_permutations = True,
					mergelist = ["dev-libs/Z-2", "dev-libs/B-1", "dev-libs/A-1", ],
					ignore_mergelist_order = True,
					success = True),
			)

		playground = ResolverPlayground(ebuilds=ebuilds, installed=installed)

		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
		finally:
			playground.cleanup()
	def testAutounmaskParentUse(self):

		ebuilds = {
			"dev-libs/B-1": {
				"EAPI": "5",
				"DEPEND": "dev-libs/D[foo(-)?,bar(-)?]",
				"IUSE": "+bar +foo",
			},
			"dev-libs/D-1": {},
		}

		test_cases = (
			# Test bug 566704
			ResolverPlaygroundTestCase(
				["=dev-libs/B-1"],
				options={"--autounmask": True},
				success=False,
				use_changes={
					"dev-libs/B-1": {
						"foo": False,
						"bar": False,
					}
				}),
		)

		playground = ResolverPlayground(ebuilds=ebuilds)
		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
		finally:
			playground.cleanup()
Example #21
0
	def testSelfDEPENDRemovalCrash(self):
		"""
		Make sure we don't try to remove a packages twice. This happened
		in the past when a package had a DEPEND on itself.
		"""
		ebuilds = {
			"dev-libs/A-1": { "RDEPEND": "=dev-libs/X-1" },
			"dev-libs/B-1": { "RDEPEND": "dev-libs/X" },

			"dev-libs/X-1": { },
			"dev-libs/X-2": { "DEPEND": ">=dev-libs/X-2" },
			}

		test_cases = (
			ResolverPlaygroundTestCase(
				["dev-libs/A", "dev-libs/B"],
				all_permutations = True,
				success = True,
				ignore_mergelist_order = True,
				mergelist = ["dev-libs/X-1", "dev-libs/A-1", "dev-libs/B-1"]),
			)

		playground = ResolverPlayground(ebuilds=ebuilds, debug=False)
		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
		finally:
			playground.cleanup()
	def testSlotOperatorUpdateProbeParentDowngrade(self):

		ebuilds = {
			"net-nds/openldap-2.4.40-r3": {
				"EAPI": "5",
				"RDEPEND": "<sys-libs/db-6.0:= " + \
					"|| ( sys-libs/db:5.3 sys-libs/db:5.1 )"
			},
			"net-nds/openldap-2.4.40": {
				"EAPI": "5",
				"RDEPEND": "sys-libs/db"
			},
			"sys-libs/db-6.0": {
				"SLOT": "6.0",
			},
			"sys-libs/db-5.3": {
				"SLOT": "5.3",
			},
		}

		installed = {
			"net-nds/openldap-2.4.40-r3": {
				"EAPI": "5",
				"RDEPEND": "<sys-libs/db-6.0:5.3/5.3= " + \
					"|| ( sys-libs/db:5.3 sys-libs/db:5.1 )"
			},
			"sys-libs/db-6.0": {
				"SLOT": "6.0",
			},
			"sys-libs/db-5.3": {
				"SLOT": "5.3",
			},
		}

		world = (
			"net-nds/openldap",
		)

		test_cases = (
			# bug 528610 - openldap rebuild was triggered
			# inappropriately, due to slot_operator_update_probe
			# selecting an inappropriate replacement parent of
			# a lower version than desired.
			ResolverPlaygroundTestCase(
				["@world"],
				success = True,
				options = { "--update": True, "--deep": True },
				mergelist = []),
		)

		playground = ResolverPlayground(ebuilds=ebuilds,
			installed=installed, world=world, debug=False)
		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success,
					True, test_case.fail_msg)
		finally:
			playground.cleanup()
	def testDoebuildSpawn(self):
		playground = ResolverPlayground()
		try:
			settings = config(clone=playground.settings)
			cpv = 'sys-apps/portage-2.1'
			metadata = {
				'EAPI'      : '2',
				'INHERITED' : 'python eutils',
				'IUSE'      : 'build doc epydoc python3 selinux',
				'LICENSE'   : 'GPL-2',
				'PROVIDE'   : 'virtual/portage',
				'RDEPEND'   : '>=app-shells/bash-3.2_p17 >=dev-lang/python-2.6',
				'SLOT'      : '0',
			}
			root_config = playground.trees[playground.eroot]['root_config']
			pkg = Package(built=False, cpv=cpv, installed=False,
				metadata=metadata, root_config=root_config,
				type_name='ebuild')
			settings.setcpv(pkg)
			settings['PORTAGE_PYTHON'] = _python_interpreter
			settings['PORTAGE_BUILDDIR'] = os.path.join(
				settings['PORTAGE_TMPDIR'], cpv)
			settings['T'] = os.path.join(
				settings['PORTAGE_BUILDDIR'], 'temp')
			for x in ('PORTAGE_BUILDDIR', 'T'):
				os.makedirs(settings[x])
			# Create a fake environment, to pretend as if the ebuild
			# has been sourced already.
			open(os.path.join(settings['T'], 'environment'), 'wb').close()

			scheduler = PollScheduler().sched_iface
			for phase in ('_internal_test',):

				# Test EbuildSpawnProcess by calling doebuild.spawn() with
				# returnpid=False. This case is no longer used by portage
				# internals since EbuildPhase is used instead and that passes
				# returnpid=True to doebuild.spawn().
				rval = doebuild_spawn("%s %s" % (_shell_quote(
					os.path.join(settings["PORTAGE_BIN_PATH"],
					os.path.basename(EBUILD_SH_BINARY))), phase),
					settings, free=1)
				self.assertEqual(rval, os.EX_OK)

				ebuild_phase = EbuildPhase(background=False,
					phase=phase, scheduler=scheduler,
					settings=settings)
				ebuild_phase.start()
				ebuild_phase.wait()
				self.assertEqual(ebuild_phase.returncode, os.EX_OK)

			ebuild_phase = MiscFunctionsProcess(background=False,
				commands=['success_hooks'],
				scheduler=scheduler, settings=settings)
			ebuild_phase.start()
			ebuild_phase.wait()
			self.assertEqual(ebuild_phase.returncode, os.EX_OK)
		finally:
			playground.cleanup()
Example #24
0
	def testAutounmaskAndSets(self):

		ebuilds = {
			#ebuilds to test use changes
			"dev-libs/A-1": { },
			"dev-libs/A-2": { "KEYWORDS": "~x86" },
			"dev-libs/B-1": { "DEPEND": "dev-libs/A" },
			"dev-libs/C-1": { "DEPEND": ">=dev-libs/A-2" },
			"dev-libs/D-1": { "DEPEND": "dev-libs/A" },
			}

		world_sets = ["@test-set"]
		sets = {
			"test-set": (
					"dev-libs/A", "dev-libs/B", "dev-libs/C", "dev-libs/D",
				),
			}

		test_cases = (
				#Test USE changes.
				#The simple case.

				ResolverPlaygroundTestCase(
					["dev-libs/B", "dev-libs/C", "dev-libs/D"],
					all_permutations=True,
					options={"--autounmask": "y"},
					mergelist=["dev-libs/A-2", "dev-libs/B-1", "dev-libs/C-1", "dev-libs/D-1"],
					ignore_mergelist_order=True,
					unstable_keywords=["dev-libs/A-2"],
					success=False),

				ResolverPlaygroundTestCase(
					["@test-set"],
					all_permutations=True,
					options={"--autounmask": "y"},
					mergelist=["dev-libs/A-2", "dev-libs/B-1", "dev-libs/C-1", "dev-libs/D-1"],
					ignore_mergelist_order=True,
					unstable_keywords=["dev-libs/A-2"],
					success=False),

				ResolverPlaygroundTestCase(
					["@world"],
					all_permutations=True,
					options={"--autounmask": "y"},
					mergelist=["dev-libs/A-2", "dev-libs/B-1", "dev-libs/C-1", "dev-libs/D-1"],
					ignore_mergelist_order=True,
					unstable_keywords=["dev-libs/A-2"],
					success=False),
			)


		playground = ResolverPlayground(ebuilds=ebuilds, world_sets=world_sets, sets=sets)
		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
		finally:
			playground.cleanup()
	def testUnpackDependencies(self):
		distfiles = {
			"A-1.tar.gz": b"binary\0content",
			"B-1.TAR.XZ": b"binary\0content",
			"B-docs-1.tar.bz2": b"binary\0content",
			"C-1.TAR.XZ": b"binary\0content",
			"C-docs-1.tar.bz2": b"binary\0content",
		}

		ebuilds = {
			"dev-libs/A-1": {"SRC_URI": "A-1.tar.gz", "EAPI": "5-progress"},
			"dev-libs/B-1": {"IUSE": "doc", "SRC_URI": "B-1.TAR.XZ doc? ( B-docs-1.tar.bz2 )", "EAPI": "5-progress"},
			"dev-libs/C-1": {"IUSE": "doc", "SRC_URI": "C-1.TAR.XZ doc? ( C-docs-1.tar.bz2 )", "EAPI": "5-progress"},
			"app-arch/bzip2-1": {},
			"app-arch/gzip-1": {},
			"app-arch/tar-1": {},
			"app-arch/xz-utils-1": {},
		}

		repo_configs = {
			"test_repo": {
				"unpack_dependencies/5-progress": (
					"tar.bz2 app-arch/tar app-arch/bzip2",
					"tar.gz app-arch/tar app-arch/gzip",
					"tar.xz app-arch/tar app-arch/xz-utils",
				),
			},
		}

		test_cases = (
			ResolverPlaygroundTestCase(
				["dev-libs/A"],
				success = True,
				ignore_mergelist_order = True,
				mergelist = ["app-arch/tar-1", "app-arch/gzip-1", "dev-libs/A-1"]),
			ResolverPlaygroundTestCase(
				["dev-libs/B"],
				success = True,
				ignore_mergelist_order = True,
				mergelist = ["app-arch/tar-1", "app-arch/xz-utils-1", "dev-libs/B-1"]),
			ResolverPlaygroundTestCase(
				["dev-libs/C"],
				success = True,
				ignore_mergelist_order = True,
				mergelist = ["app-arch/tar-1", "app-arch/xz-utils-1", "app-arch/bzip2-1", "dev-libs/C-1"]),
		)

		user_config = {
			"package.use": ("dev-libs/C doc",)
		}

		playground = ResolverPlayground(distfiles=distfiles, ebuilds=ebuilds, repo_configs=repo_configs, user_config=user_config)
		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
		finally:
			playground.cleanup()
	def testFeaturesTestUse(self):
		ebuilds = {
			"dev-libs/A-1" : {
				"IUSE": "test"
			},
			"dev-libs/B-1" : {
				"IUSE": "test foo"
			},
		}

		installed = {
			"dev-libs/A-1" : {
				"USE": "",
				"IUSE": "test"
			},
			"dev-libs/B-1" : {
				"USE": "foo",
				"IUSE": "test foo"
			},
		}

		user_config = {
			"make.conf" : ("FEATURES=test", "USE=\"-test -foo\"")
		}

		test_cases = (

			# USE=test state should not trigger --newuse rebuilds, as
			# specified in bug #373209, comment #3.
			ResolverPlaygroundTestCase(
				["dev-libs/A"],
				options = {"--newuse": True, "--selective": True},
				success = True,
				mergelist = []),

			# USE=-test -> USE=test, with USE=test forced by FEATURES=test
			ResolverPlaygroundTestCase(
				["dev-libs/A"],
				options = {},
				success = True,
				mergelist = ["dev-libs/A-1"]),

			# USE=foo -> USE=-foo, with USE=test forced by FEATURES=test
			ResolverPlaygroundTestCase(
				["dev-libs/B"],
				options = {"--newuse": True, "--selective": True},
				success = True,
				mergelist = ["dev-libs/B-1"]),
		)

		playground = ResolverPlayground(ebuilds=ebuilds,
			installed=installed, user_config=user_config, debug=False)
		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
		finally:
			playground.cleanup()
Example #27
0
	def testCompleteGraphVersionChange(self):
		"""
		Prevent reverse dependency breakage triggered by version changes.
		"""

		ebuilds = {
			"sys-libs/x-0.1": {},
			"sys-libs/x-1": {},
			"sys-libs/x-2": {},
			"sys-apps/a-1": {"RDEPEND" : ">=sys-libs/x-1 <sys-libs/x-2"},
		}

		installed = {
			"sys-libs/x-1": {},
			"sys-apps/a-1": {"RDEPEND" : ">=sys-libs/x-1 <sys-libs/x-2"},
		}

		world = ["sys-apps/a"]

		test_cases = (
			ResolverPlaygroundTestCase(
				[">=sys-libs/x-2"],
				options = {"--complete-graph-if-new-ver" : "n", "--rebuild-if-new-slot": "n"},
				mergelist = ["sys-libs/x-2"],
				success = True,
			),
			ResolverPlaygroundTestCase(
				[">=sys-libs/x-2"],
				options = {"--complete-graph-if-new-ver" : "y"},
				mergelist = ["sys-libs/x-2"],
				slot_collision_solutions = [],
				success = False,
			),
			ResolverPlaygroundTestCase(
				["<sys-libs/x-1"],
				options = {"--complete-graph-if-new-ver" : "n", "--rebuild-if-new-slot": "n"},
				mergelist = ["sys-libs/x-0.1"],
				success = True,
			),
			ResolverPlaygroundTestCase(
				["<sys-libs/x-1"],
				options = {"--complete-graph-if-new-ver" : "y"},
				mergelist = ["sys-libs/x-0.1"],
				slot_collision_solutions = [],
				success = False,
			),
		)

		playground = ResolverPlayground(ebuilds=ebuilds,
			installed=installed, world=world, debug=False)

		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
		finally:
			playground.cleanup()
Example #28
0
	def testUseMask(self):

		profile = {
			"use.mask":
			(
				"abi_ppc_32",
			),
		}

		ebuilds = {

			"sys-libs/A-1" : {
				"EAPI": "5",
				"RDEPEND": "|| ( sys-libs/zlib[abi_ppc_32(-)] " + \
					"sys-libs/zlib[abi_x86_32(-)] )"
			},

			"sys-libs/zlib-1.2.8-r1" : {
				"EAPI": "5",
				"IUSE": "abi_ppc_32 abi_x86_32"
			},

			"sys-libs/zlib-1.2.8" : {
				"EAPI": "5",
				"IUSE": ""
			},
		}

		test_cases = (

			# bug #515584: We want to prefer choices that do
			# not require changes to use.mask or use.force.
			# In this case, abi_ppc_32 is use.masked in the
			# profile, so we want to avoid that choice.
			ResolverPlaygroundTestCase(
				["sys-libs/A"],
				options = {},
				success = False,
				use_changes = {
					'sys-libs/zlib-1.2.8-r1': {'abi_x86_32': True}
				},
				mergelist = ["sys-libs/zlib-1.2.8-r1", "sys-libs/A-1"]
			),

		)

		playground = ResolverPlayground(ebuilds=ebuilds,
			profile=profile, debug=False)
		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True,
					test_case.fail_msg)
		finally:
			playground.cleanup()
	def testSlotConflictDepChange(self):
		"""
		Bug 490362
		The dependency in the ebuild was changed form slot operator to
		no slot operator. The vdb contained the slot operator and emerge
		would refuse to rebuild.
		"""
		ebuilds = {
			"app-misc/A-1" : {
				"EAPI": "5",
				"DEPEND": "app-misc/B",
				"RDEPEND": "app-misc/B"
			},

			"app-misc/B-1" : {
				"EAPI": "5",
				"SLOT": "0/1"
			},

			"app-misc/B-2" : {
				"EAPI": "5",
				"SLOT": "0/2"
			},
		}

		installed = {
			"app-misc/A-1" : {
				"EAPI": "5",
				"DEPEND": "app-misc/B:0/1=",
				"RDEPEND": "app-misc/B:0/1="
			},
			"app-misc/B-1" : {
				"EAPI": "5",
				"SLOT": "0/1"
			},
		}

		test_cases = (
			ResolverPlaygroundTestCase(
				["app-misc/B"],
				success = True,
				mergelist = ['app-misc/B-2', 'app-misc/A-1']),
		)

		world = ["app-misc/A"]

		playground = ResolverPlayground(ebuilds=ebuilds,
			installed=installed, world=world, debug=False)
		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
		finally:
			playground.cleanup()
Example #30
0
	def testOrChoicesLibpostproc(self):
		ebuilds = {
			"media-video/ffmpeg-0.10" : {
				"EAPI": "5",
				"SLOT": "0.10"
			},
			"media-video/ffmpeg-1.2.2" : {
				"EAPI": "5",
				"SLOT": "0"
			},
			"media-libs/libpostproc-0.8.0.20121125" : {
				"EAPI": "5"
			},
			"media-plugins/gst-plugins-ffmpeg-0.10.13_p201211-r1" : {
				"EAPI": "5",
				"RDEPEND" : "|| ( media-video/ffmpeg:0 media-libs/libpostproc )"
			},
		}

		installed = {
			"media-video/ffmpeg-0.10" : {
				"EAPI": "5",
				"SLOT": "0.10"
			},
			"media-libs/libpostproc-0.8.0.20121125" : {
				"EAPI": "5"
			},
			"media-plugins/gst-plugins-ffmpeg-0.10.13_p201211-r1" : {
				"EAPI": "5",
				"RDEPEND" : "|| ( media-video/ffmpeg:0 media-libs/libpostproc )"
			},
		}

		world = ["media-plugins/gst-plugins-ffmpeg"]

		test_cases = (
			# Demonstrate that libpostproc is preferred
			# over ffmpeg:0 for bug #480736.
			ResolverPlaygroundTestCase(
				["@world"],
				options = {"--update": True, "--deep": True},
				success=True,
				all_permutations = True,
				mergelist = []),
		)

		playground = ResolverPlayground(ebuilds=ebuilds, installed=installed,
			world=world, debug=False)
		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
		finally:
			playground.cleanup()
    def testCircularPypyExe(self):

        ebuilds = {
            'dev-python/pypy-7.3.0': {
                'EAPI': '7',
                'SLOT': '0/73',
                'DEPEND': '|| ( dev-python/pypy-exe dev-python/pypy-exe-bin )'
            },
            'dev-python/pypy-exe-7.3.0': {
                'EAPI': '7',
                'IUSE': 'low-memory',
                'SLOT': '7.3.0',
                'BDEPEND': '!low-memory? ( dev-python/pypy )'
            },
            'dev-python/pypy-exe-bin-7.3.0': {
                'EAPI': '7',
                'SLOT': '7.3.0',
            },
        }

        test_cases = (
            # Demonstrate bug 705986, where a USE change suggestion was given
            # even though an || preference adjustment would solve the problem
            # by pulling in pypy-exe-bin instead of pypy-exe.
            ResolverPlaygroundTestCase(
                ['dev-python/pypy'],
                mergelist=[
                    'dev-python/pypy-exe-bin-7.3.0', 'dev-python/pypy-7.3.0'
                ],
                success=True,
            ), )

        playground = ResolverPlayground(ebuilds=ebuilds, debug=False)
        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True,
                                 test_case.fail_msg)
        finally:
            playground.debug = False
            playground.cleanup()
Example #32
0
    def testAutounmask9999(self):

        ebuilds = {
            "dev-libs/A-1": {},
            "dev-libs/A-2": {},
            "dev-libs/A-9999": {
                "KEYWORDS": ""
            },
            "dev-libs/B-1": {
                "DEPEND": ">=dev-libs/A-2"
            },
            "dev-libs/C-1": {
                "DEPEND": ">=dev-libs/A-3"
            },
        }

        profile = {
            "package.mask": (">=dev-libs/A-2", ),
        }

        test_cases = (
            ResolverPlaygroundTestCase(
                ["dev-libs/B"],
                success=False,
                options={"--autounmask": True},
                mergelist=["dev-libs/A-2", "dev-libs/B-1"],
                needed_p_mask_changes=set(["dev-libs/A-2"]),
            ),
            ResolverPlaygroundTestCase(
                ["dev-libs/C"],
                success=False,
                options={"--autounmask": True},
                mergelist=["dev-libs/A-9999", "dev-libs/C-1"],
                unstable_keywords=set(["dev-libs/A-9999"]),
                needed_p_mask_changes=set(["dev-libs/A-9999"]),
            ),
        )

        playground = ResolverPlayground(ebuilds=ebuilds, profile=profile)
        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True,
                                 test_case.fail_msg)
        finally:
            playground.cleanup()
Example #33
0
    def test_no_forced_use_test(self):
        """
        Test that FEATURES=test no longer forces USE=test.
        """
        user_config = {"make.conf": ("FEATURES=test", 'USE="-test"')}
        test_case = ResolverPlaygroundTestCase(
            ["dev-libs/A"], options={}, success=True, mergelist=["dev-libs/A-1"]
        )

        playground = ResolverPlayground(
            ebuilds=self.ebuilds, user_config=user_config, debug=False
        )
        try:
            playground.run_TestCase(test_case)
            self.assertEqual(test_case.test_success, True, test_case.fail_msg)
        finally:
            playground.cleanup()
Example #34
0
    def testConnectedCollision(self):
        """
		Ensure that we are able to solve connected slot conflicts
		which cannot be solved each on their own.
		"""
        ebuilds = {
            "dev-libs/A-1": {
                "RDEPEND": "=dev-libs/X-1"
            },
            "dev-libs/B-1": {
                "RDEPEND": "dev-libs/X"
            },
            "dev-libs/X-1": {
                "RDEPEND": "=dev-libs/Y-1"
            },
            "dev-libs/X-2": {
                "RDEPEND": "=dev-libs/Y-2"
            },
            "dev-libs/Y-1": {
                "PDEPEND": "=dev-libs/X-1"
            },
            "dev-libs/Y-2": {
                "PDEPEND": "=dev-libs/X-2"
            },
        }

        test_cases = (ResolverPlaygroundTestCase(["dev-libs/A", "dev-libs/B"],
                                                 all_permutations=True,
                                                 options={"--backtrack": 0},
                                                 success=True,
                                                 ambiguous_merge_order=True,
                                                 mergelist=[
                                                     "dev-libs/Y-1",
                                                     "dev-libs/X-1",
                                                     ("dev-libs/A-1",
                                                      "dev-libs/B-1")
                                                 ]), )

        playground = ResolverPlayground(ebuilds=ebuilds, debug=False)
        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True,
                                 test_case.fail_msg)
        finally:
            playground.cleanup()
Example #35
0
    def testAutounmaskUseBreakage(self):

        ebuilds = {
            "app-misc/A-0": {
                "EAPI": "5",
                "RDEPEND": "app-misc/D[-foo]",
            },
            "app-misc/B-0": {
                "EAPI": "5",
                "RDEPEND": "app-misc/D[foo]"
            },
            "app-misc/C-0": {
                "EAPI": "5",
                "RDEPEND": ">=app-misc/D-1"
            },
            "app-misc/D-0": {
                "EAPI": "5",
                "IUSE": "foo"
            },
            "app-misc/D-1": {
                "EAPI": "5",
                "IUSE": "bar"
            },
        }

        test_cases = (

            # Bug 510270
            # _solve_non_slot_operator_slot_conflicts throws
            # IndexError: tuple index out of range
            # due to autounmask USE breakage.
            ResolverPlaygroundTestCase(
                ["app-misc/C", "app-misc/B", "app-misc/A"],
                all_permutations=True,
                success=False,
                ambiguous_slot_collision_solutions=True,
                slot_collision_solutions=[None, []]), )

        playground = ResolverPlayground(ebuilds=ebuilds, debug=False)
        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True,
                                 test_case.fail_msg)
        finally:
            playground.cleanup()
    def testCircularPypyExe(self):

        ebuilds = {
            "dev-python/pypy-7.3.0": {
                "EAPI": "7",
                "SLOT": "0/73",
                "DEPEND": "|| ( dev-python/pypy-exe dev-python/pypy-exe-bin )",
            },
            "dev-python/pypy-exe-7.3.0": {
                "EAPI": "7",
                "IUSE": "low-memory",
                "SLOT": "7.3.0",
                "BDEPEND": "!low-memory? ( dev-python/pypy )",
            },
            "dev-python/pypy-exe-bin-7.3.0": {
                "EAPI": "7",
                "SLOT": "7.3.0",
            },
        }

        test_cases = (
            # Demonstrate bug 705986, where a USE change suggestion was given
            # even though an || preference adjustment would solve the problem
            # by pulling in pypy-exe-bin instead of pypy-exe.
            ResolverPlaygroundTestCase(
                ["dev-python/pypy"],
                mergelist=[
                    "dev-python/pypy-exe-bin-7.3.0", "dev-python/pypy-7.3.0"
                ],
                success=True,
            ), )

        playground = ResolverPlayground(ebuilds=ebuilds, debug=False)
        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True,
                                 test_case.fail_msg)
        finally:
            playground.debug = False
            playground.cleanup()
Example #37
0
    def _test_mod(self, auxdbmodule):
        ebuilds = {
            "cat/A-1": {
                "EAPI": "7",
                "MISC_CONTENT": "inherit foo",
            },
            "cat/B-1": {
                "EAPI": "7",
                "MISC_CONTENT": "inherit foo",
            },
        }

        ebuild_inherited = frozenset(["bar", "foo"])
        eclass_defined_phases = "prepare"
        eclass_depend = "bar/foo"

        eclasses = {
            "foo": ("inherit bar", ),
            "bar": (
                "EXPORT_FUNCTIONS src_prepare",
                "DEPEND=\"{}\"".format(eclass_depend),
                "bar_src_prepare() { default; }",
            ),
        }

        playground = ResolverPlayground(
            ebuilds=ebuilds,
            eclasses=eclasses,
            user_config={
                'modules': ('portdbapi.auxdbmodule = %s' % auxdbmodule, )
            })

        portdb = playground.trees[playground.eroot]["porttree"].dbapi

        loop = asyncio._wrap_loop()
        loop.run_until_complete(
            self._test_mod_async(ebuilds, ebuild_inherited,
                                 eclass_defined_phases, eclass_depend, portdb))
    def testVirtualCmakeBootstrapUseConditional(self):

        ebuilds = {
            "dev-libs/jsoncpp-1.9.2": {
                "EAPI": "7",
                "BDEPEND": "virtual/cmake"
            },
            "dev-util/cmake-bootstrap-3.16.2": {
                "EAPI": "7",
            },
            "dev-util/cmake-3.16.2": {
                "EAPI": "7",
                "BDEPEND": ">=dev-libs/jsoncpp-0.6.0_rc2:0=",
            },
            "virtual/cmake-0": {
                "EAPI":
                "7",
                "IUSE":
                "+bootstrap",
                "RDEPEND":
                "bootstrap? ( dev-util/cmake-bootstrap ) !bootstrap? ( dev-util/cmake )",
            },
        }

        test_cases = (
            # Solve bug 703440 with a dependency conditional on the bootstrap USE flag.
            ResolverPlaygroundTestCase(
                ["dev-util/cmake"],
                mergelist=[
                    "dev-util/cmake-bootstrap-3.16.2",
                    "virtual/cmake-0",
                    "dev-libs/jsoncpp-1.9.2",
                    "dev-util/cmake-3.16.2",
                ],
                success=True,
            ), )

        playground = ResolverPlayground(ebuilds=ebuilds)
        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True,
                                 test_case.fail_msg)
        finally:
            playground.cleanup()
Example #39
0
    def testDepcleanAndWildcards(self):

        installed = {
            "dev-libs/A-1": {
                "RDEPEND": "dev-libs/B"
            },
            "dev-libs/B-1": {},
        }

        # depclean asserts non-empty @world set
        world = ["non-empty/world-set"]

        test_cases = (
            ResolverPlaygroundTestCase(
                ["*/*"],
                options={"--depclean": True},
                success=True,
                cleanlist=["dev-libs/A-1", "dev-libs/B-1"],
            ),
            ResolverPlaygroundTestCase(
                ["dev-libs/*"],
                options={"--depclean": True},
                success=True,
                cleanlist=["dev-libs/A-1", "dev-libs/B-1"],
            ),
            ResolverPlaygroundTestCase(
                ["*/A"],
                options={"--depclean": True},
                success=True,
                cleanlist=["dev-libs/A-1"],
            ),
            ResolverPlaygroundTestCase(["*/B"],
                                       options={"--depclean": True},
                                       success=True,
                                       cleanlist=[]),
        )

        playground = ResolverPlayground(installed=installed, world=world)
        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True,
                                 test_case.fail_msg)
        finally:
            playground.cleanup()
Example #40
0
    def testAutounmaskKeepMasks(self):
        """
        Ensure that we try to use a masked version with keywords before trying
        masked version with missing keywords (prefer masked regular version
        over -9999 version).
        """
        ebuilds = {
            "app-text/A-1": {},
        }

        test_cases = (
            # Test mask and keyword changes.
            ResolverPlaygroundTestCase(
                ["app-text/A"],
                options={
                    "--autounmask": True,
                    "--autounmask-keep-masks": "y"
                },
                success=False,
            ),
            ResolverPlaygroundTestCase(
                ["app-text/A"],
                options={
                    "--autounmask": True,
                    "--autounmask-keep-masks": "n"
                },
                success=False,
                mergelist=["app-text/A-1"],
                needed_p_mask_changes=["app-text/A-1"],
            ),
        )

        profile = {
            "package.mask": ("app-text/A", ),
        }

        playground = ResolverPlayground(ebuilds=ebuilds, profile=profile)

        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True,
                                 test_case.fail_msg)
        finally:
            playground.cleanup()
    def testHittingTheBacktrackLimit(self):
        ebuilds = {
            "dev-libs/A-1": {},
            "dev-libs/A-2": {},
            "dev-libs/B-1": {},
            "dev-libs/B-2": {},
            "dev-libs/C-1": {
                "DEPEND": "dev-libs/A dev-libs/B"
            },
            "dev-libs/D-1": {
                "DEPEND": "=dev-libs/A-1 =dev-libs/B-1"
            },
        }

        test_cases = (
            ResolverPlaygroundTestCase(["dev-libs/C", "dev-libs/D"],
                                       all_permutations=True,
                                       mergelist=[
                                           "dev-libs/A-1", "dev-libs/B-1",
                                           "dev-libs/C-1", "dev-libs/D-1"
                                       ],
                                       ignore_mergelist_order=True,
                                       success=True),
            #This one hits the backtrack limit. Be aware that this depends on the argument order.
            ResolverPlaygroundTestCase(["dev-libs/D", "dev-libs/C"],
                                       options={"--backtrack": 1},
                                       mergelist=[
                                           "dev-libs/A-1", "dev-libs/B-1",
                                           "dev-libs/A-2", "dev-libs/B-2",
                                           "dev-libs/C-1", "dev-libs/D-1"
                                       ],
                                       ignore_mergelist_order=True,
                                       slot_collision_solutions=[],
                                       success=False),
        )

        playground = ResolverPlayground(ebuilds=ebuilds)

        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True,
                                 test_case.fail_msg)
        finally:
            playground.cleanup()
Example #42
0
    def test_default_use_test(self):
        """
		Test that FEATURES=test enables USE=test by default.
		"""
        user_config = {"make.conf": ("FEATURES=test", "USE=\"\"")}
        test_case = ResolverPlaygroundTestCase(
            ["dev-libs/A"],
            options={},
            success=True,
            mergelist=["dev-libs/B-1", "dev-libs/A-1"])

        playground = ResolverPlayground(ebuilds=self.ebuilds,
                                        user_config=user_config,
                                        debug=False)
        try:
            playground.run_TestCase(test_case)
            self.assertEqual(test_case.test_success, True, test_case.fail_msg)
        finally:
            playground.cleanup()
    def testVirtualCmakeBootstrapUseConditional(self):

        ebuilds = {
            'dev-libs/jsoncpp-1.9.2': {
                'EAPI': '7',
                'BDEPEND': 'virtual/cmake'
            },
            'dev-util/cmake-bootstrap-3.16.2': {
                'EAPI': '7',
            },
            'dev-util/cmake-3.16.2': {
                'EAPI': '7',
                'BDEPEND': '>=dev-libs/jsoncpp-0.6.0_rc2:0=',
            },
            'virtual/cmake-0': {
                'EAPI':
                '7',
                'IUSE':
                '+bootstrap',
                'RDEPEND':
                'bootstrap? ( dev-util/cmake-bootstrap ) !bootstrap? ( dev-util/cmake )'
            },
        }

        test_cases = (
            # Solve bug 703440 with a dependency conditional on the bootstrap USE flag.
            ResolverPlaygroundTestCase(
                ['dev-util/cmake'],
                mergelist=[
                    'dev-util/cmake-bootstrap-3.16.2', 'virtual/cmake-0',
                    'dev-libs/jsoncpp-1.9.2', 'dev-util/cmake-3.16.2'
                ],
                success=True,
            ), )

        playground = ResolverPlayground(ebuilds=ebuilds)
        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True,
                                 test_case.fail_msg)
        finally:
            playground.cleanup()
Example #44
0
    def testOldDepChainDisplay(self):
        ebuilds = {
            "dev-libs/A-1": {
                "DEPEND": "foo? ( dev-libs/B[-bar] )",
                "IUSE": "+foo",
                "EAPI": "2"
            },
            "dev-libs/A-2": {
                "DEPEND": "foo? ( dev-libs/C )",
                "IUSE": "+foo",
                "EAPI": "1"
            },
            "dev-libs/B-1": {
                "IUSE": "bar",
                "DEPEND": "!bar? ( dev-libs/D[-baz] )",
                "EAPI": "2"
            },
            "dev-libs/C-1": {
                "KEYWORDS": "~x86"
            },
            "dev-libs/D-1": {
                "IUSE": "+baz",
                "EAPI": "1"
            },
        }

        test_cases = (
            ResolverPlaygroundTestCase(["=dev-libs/A-1"],
                                       options={"--autounmask": 'n'},
                                       success=False),
            ResolverPlaygroundTestCase(["=dev-libs/A-2"],
                                       options={"--autounmask": 'n'},
                                       success=False),
        )

        playground = ResolverPlayground(ebuilds=ebuilds)
        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True,
                                 test_case.fail_msg)
        finally:
            playground.cleanup()
    def testOnlydeps(self):
        ebuilds = {
            "app-misc/A-1": {
                "EAPI": "5",
                "SLOT": "1",
                "DEPEND": "|| ( app-misc/B app-misc/A:1 )",
            },
            "app-misc/A-2": {
                "EAPI": "5",
                "SLOT": "2",
            },
            "app-misc/B-0": {
                "EAPI": "5",
            },
        }

        installed = {
            "app-misc/A-2": {
                "EAPI": "5",
                "SLOT": "2",
            }
        }

        test_cases = (
            # bug 524916 - direct circular dep should not pull
            # in an onlydeps node when possible
            ResolverPlaygroundTestCase(
                ["app-misc/A:1"],
                success=True,
                options={"--onlydeps": True},
                mergelist=["app-misc/B-0"],
            ), )

        playground = ResolverPlayground(ebuilds=ebuilds,
                                        installed=installed,
                                        debug=False)
        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True,
                                 test_case.fail_msg)
        finally:
            playground.cleanup()
Example #46
0
    def testOnlydepsMinimal(self):
        ebuilds = {
            "dev-libs/A-1": {
                "DEPEND": "dev-libs/B",
                "RDEPEND": "dev-libs/C",
                "PDEPEND": "dev-libs/D"
            },
            "dev-libs/B-1": {},
            "dev-libs/C-1": {},
            "dev-libs/D-1": {},
        }
        installed = {}

        test_cases = (
            ResolverPlaygroundTestCase(
                ["dev-libs/A"],
                all_permutations=True,
                success=True,
                options={
                    "--onlydeps": True,
                    "--onlydeps-with-rdeps": "y"
                },
                mergelist=["dev-libs/B-1", "dev-libs/C-1", "dev-libs/D-1"]),
            ResolverPlaygroundTestCase(["dev-libs/A"],
                                       all_permutations=True,
                                       success=True,
                                       options={
                                           "--onlydeps": True,
                                           "--onlydeps-with-rdeps": "n"
                                       },
                                       mergelist=["dev-libs/B-1"]),
        )

        playground = ResolverPlayground(ebuilds=ebuilds,
                                        installed=installed,
                                        debug=False)
        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True,
                                 test_case.fail_msg)
        finally:
            playground.cleanup()
Example #47
0
	def testVirtualWine(self):
		ebuilds = {
			'virtual/wine-0-r6': {
				'RDEPEND': '|| ( app-emulation/wine-staging app-emulation/wine-any ) '
					'|| ( app-emulation/wine-vanilla app-emulation/wine-staging app-emulation/wine-any )'
			},
			'app-emulation/wine-staging-4': {},
			'app-emulation/wine-any-4': {},
			'app-emulation/wine-vanilla-4': {},
		}

		test_cases = (
			# Test bug 701996, where separate disjunctions where not
			# converted to DNF, causing both wine-vanilla and
			# wine-staging to be pulled in.
			ResolverPlaygroundTestCase(
				[
					'virtual/wine',
				],
				success=True,
				mergelist=(
					'app-emulation/wine-staging-4',
					'virtual/wine-0-r6',
				),
			),
		)

		playground = ResolverPlayground(debug=False, ebuilds=ebuilds)

		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True,
					test_case.fail_msg)
		finally:
			playground.debug = False
			playground.cleanup()
Example #48
0
    def test_newuse(self):
        """
        Test that --newuse now detects USE=test changes.
        """
        user_config = {"make.conf": ("FEATURES=test", 'USE=""')}
        test_case = ResolverPlaygroundTestCase(
            ["dev-libs/A"],
            options={"--newuse": True, "--selective": True},
            success=True,
            mergelist=["dev-libs/B-1", "dev-libs/A-1"],
        )

        playground = ResolverPlayground(
            ebuilds=self.ebuilds, user_config=user_config, debug=False
        )
        try:
            playground.run_TestCase(test_case)
            self.assertEqual(test_case.test_success, True, test_case.fail_msg)
        finally:
            playground.cleanup()
    def testBacktrackWithoutUpdates(self):
        """
		If --update is not given we might have to mask the old installed version later.
		"""

        ebuilds = {
            "dev-libs/A-1": {
                "DEPEND": "dev-libs/Z"
            },
            "dev-libs/B-1": {
                "DEPEND": ">=dev-libs/Z-2"
            },
            "dev-libs/Z-1": {},
            "dev-libs/Z-2": {},
        }

        installed = {
            "dev-libs/Z-1": {
                "USE": ""
            },
        }

        test_cases = (ResolverPlaygroundTestCase(["dev-libs/B", "dev-libs/A"],
                                                 all_permutations=True,
                                                 mergelist=[
                                                     "dev-libs/Z-2",
                                                     "dev-libs/B-1",
                                                     "dev-libs/A-1",
                                                 ],
                                                 ignore_mergelist_order=True,
                                                 success=True), )

        playground = ResolverPlayground(ebuilds=ebuilds, installed=installed)

        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True,
                                 test_case.fail_msg)
        finally:
            playground.cleanup()
    def testBacktrackMissedUpdates(self):
        """
		An update is missed due to a dependency on an older version.
		"""

        ebuilds = {
            "dev-libs/A-1": {},
            "dev-libs/A-2": {},
            "dev-libs/B-1": {
                "RDEPEND": "<=dev-libs/A-1"
            },
        }

        installed = {
            "dev-libs/A-1": {
                "USE": ""
            },
            "dev-libs/B-1": {
                "USE": "",
                "RDEPEND": "<=dev-libs/A-1"
            },
        }

        options = {'--update': True, '--deep': True, '--selective': True}

        test_cases = (ResolverPlaygroundTestCase(["dev-libs/A", "dev-libs/B"],
                                                 options=options,
                                                 all_permutations=True,
                                                 mergelist=[],
                                                 success=True), )

        playground = ResolverPlayground(ebuilds=ebuilds, installed=installed)

        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True,
                                 test_case.fail_msg)
        finally:
            playground.cleanup()
Example #51
0
    def testSolveNonSlotOperatorSlotConflicts(self):

        ebuilds = {
            "app-misc/A-1": {"EAPI": "5", "SLOT": "0/1", "PDEPEND": "app-misc/B"},
            "app-misc/A-2": {"EAPI": "5", "SLOT": "0/2", "PDEPEND": "app-misc/B"},
            "app-misc/B-0": {"EAPI": "5", "RDEPEND": "app-misc/A:="},
        }

        installed = {
            "app-misc/A-1": {"EAPI": "5", "SLOT": "0/1", "PDEPEND": "app-misc/B"},
            "app-misc/B-0": {"EAPI": "5", "RDEPEND": "app-misc/A:0/1="},
        }

        world = ["app-misc/A"]

        test_cases = (
            # bug 522084
            # In this case, _solve_non_slot_operator_slot_conflicts
            # removed both versions of app-misc/A from the graph, since
            # they didn't have any non-conflict parents (except for
            # @selected which matched both instances). The result was
            # a missed update.
            ResolverPlaygroundTestCase(
                ["@world"],
                options={"--update": True, "--deep": True},
                success=True,
                mergelist=["app-misc/A-2", "app-misc/B-0"],
            ),
        )

        playground = ResolverPlayground(
            ebuilds=ebuilds, installed=installed, world=world, debug=False
        )
        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True, test_case.fail_msg)
        finally:
            playground.cleanup()
    def testBacktrackingGoodVersionFirst(self):
        """
        When backtracking due to slot conflicts, we masked the version that has been pulled
        in first. This is not always a good idea. Mask the highest version instead.
        """

        ebuilds = {
            "dev-libs/A-1": {
                "DEPEND": "=dev-libs/C-1 dev-libs/B"
            },
            "dev-libs/B-1": {
                "DEPEND": "=dev-libs/C-1"
            },
            "dev-libs/B-2": {
                "DEPEND": "=dev-libs/C-2"
            },
            "dev-libs/C-1": {},
            "dev-libs/C-2": {},
        }

        test_cases = (ResolverPlaygroundTestCase(
            ["dev-libs/A"],
            mergelist=[
                "dev-libs/C-1",
                "dev-libs/B-1",
                "dev-libs/A-1",
            ],
            success=True,
        ), )

        playground = ResolverPlayground(ebuilds=ebuilds)

        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True,
                                 test_case.fail_msg)
        finally:
            playground.cleanup()
    def testCircularJsoncppCmakeBootstrapOrDeps(self):

        ebuilds = {
            'dev-libs/jsoncpp-1.9.2': {
                'EAPI': '7',
                'BDEPEND': '|| ( dev-util/cmake-bootstrap dev-util/cmake )'
            },
            'dev-util/cmake-bootstrap-3.16.2': {
                'EAPI': '7',
            },
            'dev-util/cmake-3.16.2': {
                'EAPI': '7',
                'BDEPEND': '>=dev-libs/jsoncpp-0.6.0_rc2:0=',
            },
        }

        test_cases = (
            # Demonstrate bug 703440. It ignores cmake-bootstrap in order to eliminate redundant packages.
            #
            #  * Error: circular dependencies:
            #
            # (dev-libs/jsoncpp-1.9.2:0/0::test_repo, ebuild scheduled for merge) depends on
            #  (dev-util/cmake-3.16.2:0/0::test_repo, ebuild scheduled for merge) (buildtime)
            #    (dev-libs/jsoncpp-1.9.2:0/0::test_repo, ebuild scheduled for merge) (buildtime_slot_op)
            ResolverPlaygroundTestCase(
                ['dev-util/cmake'],
                circular_dependency_solutions={},
                success=False,
            ), )

        playground = ResolverPlayground(ebuilds=ebuilds)
        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True,
                                 test_case.fail_msg)
        finally:
            playground.cleanup()
Example #54
0
	def testDepcleanWithDeps(self):
		ebuilds = {
			"dev-libs/A-1": { "RDEPEND": "dev-libs/C" },
			"dev-libs/B-1": { "RDEPEND": "dev-libs/D" },
			"dev-libs/C-1": {},
			"dev-libs/D-1": { "RDEPEND": "dev-libs/E" },
			"dev-libs/E-1": { "RDEPEND": "dev-libs/F" },
			"dev-libs/F-1": {},
			}
		installed = {
			"dev-libs/A-1": { "RDEPEND": "dev-libs/C" },
			"dev-libs/B-1": { "RDEPEND": "dev-libs/D" },
			"dev-libs/C-1": {},
			"dev-libs/D-1": { "RDEPEND": "dev-libs/E" },
			"dev-libs/E-1": { "RDEPEND": "dev-libs/F" },
			"dev-libs/F-1": {},
			}

		world = (
			"dev-libs/A",
			)

		test_cases = (
			ResolverPlaygroundTestCase(
				[],
				options={"--depclean": True},
				success=True,
				cleanlist=["dev-libs/B-1", "dev-libs/D-1",
					"dev-libs/E-1", "dev-libs/F-1"]),
			)

		playground = ResolverPlayground(ebuilds=ebuilds, installed=installed, world=world)
		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
		finally:
			playground.cleanup()
	def testRequiredUseOrDeps(self):
		
		ebuilds = {
			"dev-libs/A-1": { "IUSE": "+x +y", "REQUIRED_USE": "^^ ( x y )", "EAPI": "4" },
			"dev-libs/B-1": { "IUSE": "+x +y", "REQUIRED_USE": "",           "EAPI": "4" },
			"app-misc/p-1": { "RDEPEND": "|| ( =dev-libs/A-1 =dev-libs/B-1 )" },
			}

		test_cases = (
				# This should fail and show a REQUIRED_USE error for
				# dev-libs/A-1, since this choice it preferred.
				ResolverPlaygroundTestCase(
					["=app-misc/p-1"],
					success = False),
			)

		playground = ResolverPlayground(ebuilds=ebuilds)
		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
		finally:
			playground.cleanup()
Example #56
0
	def testDepcleanWithInstalledMasked(self):
		"""
		Test case for bug 332719.
		emerge --declean ignores that B is masked by license and removes C.
		The next emerge -uDN world doesn't take B and installs C again.
		"""
		ebuilds = {
			"dev-libs/A-1": { "RDEPEND": "|| ( dev-libs/B dev-libs/C )" },
			"dev-libs/B-1": { "LICENSE": "TEST", "KEYWORDS": "x86" },
			"dev-libs/C-1": { "KEYWORDS": "x86" },
			}
		installed = {
			"dev-libs/A-1": { "RDEPEND": "|| ( dev-libs/B dev-libs/C )" },
			"dev-libs/B-1": { "LICENSE": "TEST", "KEYWORDS": "x86" },
			"dev-libs/C-1": { "KEYWORDS": "x86" },
			}

		world = (
			"dev-libs/A",
			)

		test_cases = (
			ResolverPlaygroundTestCase(
				[],
				options={"--depclean": True},
				success=True,
				#cleanlist=["dev-libs/C-1"]),
				cleanlist=["dev-libs/B-1"]),
			)

		playground = ResolverPlayground(ebuilds=ebuilds, installed=installed, world=world)
		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
		finally:
			playground.cleanup()
Example #57
0
	def testDepcleanWithExcludeAndSlots(self):

		installed = {
			"dev-libs/Z-1": { "SLOT": 1},
			"dev-libs/Z-2": { "SLOT": 2},
			"dev-libs/Y-1": { "RDEPEND": "=dev-libs/Z-1", "SLOT": 1 },
			"dev-libs/Y-2": { "RDEPEND": "=dev-libs/Z-2", "SLOT": 2 },
			}

		world=["dev-libs/Y"]

		test_cases = (
			#Without --exclude.
			ResolverPlaygroundTestCase(
				[],
				options={"--depclean": True},
				success=True,
				cleanlist=["dev-libs/Y-1", "dev-libs/Z-1"]),
			ResolverPlaygroundTestCase(
				[],
				options={"--depclean": True, "--exclude": ["dev-libs/Z"]},
				success=True,
				cleanlist=["dev-libs/Y-1"]),
			ResolverPlaygroundTestCase(
				[],
				options={"--depclean": True, "--exclude": ["dev-libs/Y"]},
				success=True,
				cleanlist=[]),
			)

		playground = ResolverPlayground(installed=installed, world=world)
		try:
			for test_case in test_cases:
				playground.run_TestCase(test_case)
				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
		finally:
			playground.cleanup()
Example #58
0
    def testAutounmaskKeepMasks(self):

        ebuilds = {
            "app-text/A-1": {},
        }

        test_cases = (
            #Test mask and keyword changes.
            ResolverPlaygroundTestCase(["app-text/A"],
                                       options={
                                           "--autounmask": True,
                                           "--autounmask-keep-masks": "y"
                                       },
                                       success=False),
            ResolverPlaygroundTestCase(["app-text/A"],
                                       options={
                                           "--autounmask": True,
                                           "--autounmask-keep-masks": "n"
                                       },
                                       success=False,
                                       mergelist=["app-text/A-1"],
                                       needed_p_mask_changes=["app-text/A-1"]),
        )

        profile = {
            "package.mask": ("app-text/A", ),
        }

        playground = ResolverPlayground(ebuilds=ebuilds, profile=profile)

        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True,
                                 test_case.fail_msg)
        finally:
            playground.cleanup()
    def testWithTestDeps(self):
        ebuilds = {
            "app-misc/A-0": {
                "EAPI": "5",
                "IUSE": "test",
                "DEPEND": "test? ( app-misc/B )"
            },
            "app-misc/B-0": {
                "EAPI": "5",
                "IUSE": "test",
                "DEPEND": "test? ( app-misc/C )"
            },
            "app-misc/C-0": {
                "EAPI": "5",
            }
        }

        test_cases = (
            # Test that --with-test-deps only pulls in direct
            # test deps of packages matched by arguments.
            ResolverPlaygroundTestCase(["app-misc/A"],
                                       success=True,
                                       options={
                                           "--onlydeps": True,
                                           "--with-test-deps": True
                                       },
                                       mergelist=["app-misc/B-0"]), )

        playground = ResolverPlayground(ebuilds=ebuilds, debug=False)
        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True,
                                 test_case.fail_msg)
        finally:
            playground.cleanup()
    def testBacktracking(self):
        ebuilds = {
            "dev-libs/A-1": {},
            "dev-libs/A-2": {},
            "dev-libs/B-1": {
                "DEPEND": "dev-libs/A"
            },
        }

        test_cases = (ResolverPlaygroundTestCase(
            ["=dev-libs/A-1", "dev-libs/B"],
            all_permutations=True,
            mergelist=["dev-libs/A-1", "dev-libs/B-1"],
            success=True), )

        playground = ResolverPlayground(ebuilds=ebuilds)

        try:
            for test_case in test_cases:
                playground.run_TestCase(test_case)
                self.assertEqual(test_case.test_success, True,
                                 test_case.fail_msg)
        finally:
            playground.cleanup()