From: Zac Medico Date: Sat, 3 Sep 2011 18:05:57 +0000 (-0700) Subject: tests/emerge: add minimal herds.xml X-Git-Tag: v2.2.0_alpha53~8 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3f9239de54cc90972750f673102f88b824e500ba;p=portage.git tests/emerge: add minimal herds.xml This will allow src_test to trigger issues like bug #381657. --- diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py index acd97eb36..038192e01 100644 --- a/pym/portage/tests/emerge/test_simple.py +++ b/pym/portage/tests/emerge/test_simple.py @@ -79,6 +79,23 @@ src_install() { }, } + metadata_xml_files = ( + ( + "dev-libs/A", + { + "herd" : "base-system", + "flags" : "Description of how USE='flag' affects this package", + }, + ), + ( + "dev-libs/B", + { + "herd" : "no-herd", + "flags" : "Description of how USE='flag' affects this package", + }, + ), + ) + portage_python = portage._python_interpreter emerge_cmd = (portage_python, "-Wd", os.path.join(PORTAGE_BIN_PATH, "emerge")) @@ -176,6 +193,9 @@ src_install() { # non-empty system set keeps --depclean quiet 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: + f.write(playground.metadata_xml_template % xml_data) for args in test_commands: proc = subprocess.Popen(args, env=env, stdout=subprocess.PIPE) diff --git a/pym/portage/tests/repoman/test_simple.py b/pym/portage/tests/repoman/test_simple.py index 35290f6f3..27e7d0e6d 100644 --- a/pym/portage/tests/repoman/test_simple.py +++ b/pym/portage/tests/repoman/test_simple.py @@ -69,26 +69,11 @@ class SimpleRepomanTestCase(TestCase): licenses = ["GPL-2"] arch_list = ["x86"] metadata_dtd = os.path.join(PORTAGE_BASE_PATH, "cnf/metadata.dtd") - metadata_xml_template = """ - - -%(herd)s - -maintainer-needed@gentoo.org -Description of the maintainership - -Long description of the package - -%(flags)s - - -""" - metadata_xml_files = ( ( "dev-libs/A", { - "herd" : "no-herd", + "herd" : "base-system", "flags" : "Description of how USE='flag' affects this package", }, ), @@ -153,7 +138,7 @@ class SimpleRepomanTestCase(TestCase): 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: - f.write(metadata_xml_template % xml_data) + f.write(playground.metadata_xml_template % xml_data) # 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")) diff --git a/pym/portage/tests/resolver/ResolverPlayground.py b/pym/portage/tests/resolver/ResolverPlayground.py index 28567b3d7..67c4e5c53 100644 --- a/pym/portage/tests/resolver/ResolverPlayground.py +++ b/pym/portage/tests/resolver/ResolverPlayground.py @@ -39,6 +39,21 @@ class ResolverPlayground(object): config_files = frozenset(("package.use", "package.mask", "package.keywords", \ "package.unmask", "package.properties", "package.license", "use.mask", "use.force")) + metadata_xml_template = """ + + +%(herd)s + +maintainer-needed@gentoo.org +Description of the maintainership + +Long description of the package + +%(flags)s + + +""" + def __init__(self, ebuilds={}, installed={}, profile={}, repo_configs={}, \ user_config={}, sets={}, world=[], debug=False): """ @@ -311,6 +326,29 @@ class ResolverPlayground(object): os.makedirs(os.path.join(self.eroot, "etc")) os.symlink(sub_profile_dir, os.path.join(self.eroot, "etc", "make.profile")) + #Create minimal herds.xml + metadata_dir = os.path.join(repo_dir, "metadata") + os.makedirs(metadata_dir) + herds_xml = """ + + + + + + base-system + base-system@gentoo.org + Core system utilities and libraries. + + base-system@gentoo.orgg + Base System + Base System Maintainer + + + +""" + with open(os.path.join(metadata_dir, "metadata.xml"), 'w') as f: + f.write(herds_xml) + user_config_dir = os.path.join(self.eroot, "etc", "portage") try: