diff options
Diffstat (limited to 'pym/portage')
-rw-r--r-- | pym/portage/tests/ebuild/test_config.py | 48 | ||||
-rw-r--r-- | pym/portage/tests/resolver/ResolverPlayground.py | 14 |
2 files changed, 57 insertions, 5 deletions
diff --git a/pym/portage/tests/ebuild/test_config.py b/pym/portage/tests/ebuild/test_config.py index 7bec8c6df..ff3935b29 100644 --- a/pym/portage/tests/ebuild/test_config.py +++ b/pym/portage/tests/ebuild/test_config.py @@ -196,3 +196,51 @@ class ConfigTestCase(TestCase): self.assertEqual(test_case.test_success, True, test_case.fail_msg) finally: playground.cleanup() + + + def testManifest(self): + + ebuilds = { + "dev-libs/A-1::old_repo": { }, + "dev-libs/A-2::new_repo": { }, + } + + repo_configs = { + "new_repo": { + "layout.conf": + ( + "thin-manifests = true", + ), + } + } + + test_cases = ( + ResolverPlaygroundTestCase( + ["=dev-libs/A-1"], + mergelist= ["dev-libs/A-1"], + success = True), + + ResolverPlaygroundTestCase( + ["=dev-libs/A-2"], + mergelist= ["dev-libs/A-2"], + success = True), + ) + + playground = ResolverPlayground(ebuilds=ebuilds, repo_configs=repo_configs) + + new_manifest_file = os.path.join(playground.repo_dirs["new_repo"], "dev-libs", "A", "Manifest") + f = open(new_manifest_file) + self.assertEqual(len(list(f)), 0) + f.close() + + old_manifest_file = os.path.join(playground.repo_dirs["old_repo"], "dev-libs", "A", "Manifest") + f = open(old_manifest_file) + self.assertEqual(len(list(f)), 1) + f.close() + + 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() diff --git a/pym/portage/tests/resolver/ResolverPlayground.py b/pym/portage/tests/resolver/ResolverPlayground.py index 5d7c3160c..e22121db7 100644 --- a/pym/portage/tests/resolver/ResolverPlayground.py +++ b/pym/portage/tests/resolver/ResolverPlayground.py @@ -38,7 +38,8 @@ class ResolverPlayground(object): """ config_files = frozenset(("package.use", "package.mask", "package.keywords", \ - "package.unmask", "package.properties", "package.license", "use.mask", "use.force")) + "package.unmask", "package.properties", "package.license", "use.mask", "use.force", + "layout.conf",)) metadata_xml_template = """<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> @@ -256,6 +257,8 @@ class ResolverPlayground(object): for repo in self.repo_dirs: repo_dir = self._get_repo_dir(repo) profile_dir = os.path.join(self._get_repo_dir(repo), "profiles") + metadata_dir = os.path.join(repo_dir, "metadata") + os.makedirs(metadata_dir) #Create $REPO/profiles/categories categories = set() @@ -283,8 +286,11 @@ class ResolverPlayground(object): for config_file, lines in repo_config.items(): if config_file not in self.config_files: raise ValueError("Unknown config file: '%s'" % config_file) - - file_name = os.path.join(profile_dir, config_file) + + if config_file in ("layout.conf",): + file_name = os.path.join(repo_dir, "metadata", config_file) + else: + file_name = os.path.join(profile_dir, config_file) f = open(file_name, "w") for line in lines: f.write("%s\n" % line) @@ -334,8 +340,6 @@ class ResolverPlayground(object): os.symlink(sub_profile_dir, os.path.join(user_config_dir, "make.profile")) #Create minimal herds.xml - metadata_dir = os.path.join(repo_dir, "metadata") - os.makedirs(metadata_dir) herds_xml = """<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE herds SYSTEM "http://www.gentoo.org/dtd/herds.dtd"> <?xml-stylesheet href="/xsl/herds.xsl" type="text/xsl" ?> |