public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/emerge/, pym/portage/tests/resolver/, ...
@ 2011-09-03 18:08 Zac Medico
  0 siblings, 0 replies; only message in thread
From: Zac Medico @ 2011-09-03 18:08 UTC (permalink / raw
  To: gentoo-commits

commit:     3f9239de54cc90972750f673102f88b824e500ba
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  3 18:05:57 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Sep  3 18:05:57 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3f9239de

tests/emerge: add minimal herds.xml

This will allow src_test to trigger issues like bug #381657.

---
 pym/portage/tests/emerge/test_simple.py          |   20 +++++++++++
 pym/portage/tests/repoman/test_simple.py         |   19 +----------
 pym/portage/tests/resolver/ResolverPlayground.py |   38 ++++++++++++++++++++++
 3 files changed, 60 insertions(+), 17 deletions(-)

diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py
index acd97eb..038192e 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" : "<flag name='flag'>Description of how USE='flag' affects this package</flag>",
+				},
+			),
+			(
+				"dev-libs/B",
+				{
+					"herd" : "no-herd",
+					"flags" : "<flag name='flag'>Description of how USE='flag' affects this package</flag>",
+				},
+			),
+		)
+
 		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 35290f6..27e7d0e 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 = """<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
-<pkgmetadata>
-<herd>%(herd)s</herd>
-<maintainer>
-<email>maintainer-needed@gentoo.org</email>
-<description>Description of the maintainership</description>
-</maintainer>
-<longdescription>Long description of the package</longdescription>
-<use>
-%(flags)s
-</use>
-</pkgmetadata>
-"""
-
 		metadata_xml_files = (
 			(
 				"dev-libs/A",
 				{
-					"herd" : "no-herd",
+					"herd" : "base-system",
 					"flags" : "<flag name='flag'>Description of how USE='flag' affects this package</flag>",
 				},
 			),
@@ -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 28567b3..67c4e5c 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 = """<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>%(herd)s</herd>
+<maintainer>
+<email>maintainer-needed@gentoo.org</email>
+<description>Description of the maintainership</description>
+</maintainer>
+<longdescription>Long description of the package</longdescription>
+<use>
+%(flags)s
+</use>
+</pkgmetadata>
+"""
+
 	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 = """<?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" ?>
+<?xml-stylesheet href="/xsl/guide.xsl" type="text/xsl" ?>
+<herds>
+<herd>
+  <name>base-system</name>
+  <email>base-system@gentoo.org</email>
+  <description>Core system utilities and libraries.</description>
+  <maintainer>
+    <email>base-system@gentoo.orgg</email>
+    <name>Base System</name>
+    <role>Base System Maintainer</role>
+  </maintainer>
+</herd>
+</herds>
+"""
+				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:



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-09-03 18:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-03 18:08 [gentoo-commits] proj/portage:master commit in: pym/portage/tests/emerge/, pym/portage/tests/resolver/, Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox