public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/tests/emerge/, pym/portage/tests/resolver/, ...
Date: Sat,  3 Sep 2011 18:08:14 +0000 (UTC)	[thread overview]
Message-ID: <3f9239de54cc90972750f673102f88b824e500ba.zmedico@gentoo> (raw)

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:



                 reply	other threads:[~2011-09-03 18:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3f9239de54cc90972750f673102f88b824e500ba.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox