* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/resolver/, pym/portage/tests/ebuild/
@ 2011-09-15 4:15 Zac Medico
0 siblings, 0 replies; 2+ messages in thread
From: Zac Medico @ 2011-09-15 4:15 UTC (permalink / raw
To: gentoo-commits
commit: a5e7c15b03a9c6982f28ad2460261c98fe35889b
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 15 04:15:39 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Sep 15 04:15:39 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a5e7c15b
Test non-empty thin manifests.
---
pym/portage/tests/ebuild/test_config.py | 21 ++++++++++++++++++++-
pym/portage/tests/resolver/ResolverPlayground.py | 14 +++++++++++++-
2 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/pym/portage/tests/ebuild/test_config.py b/pym/portage/tests/ebuild/test_config.py
index 3d0be19..f4869c6 100644
--- a/pym/portage/tests/ebuild/test_config.py
+++ b/pym/portage/tests/ebuild/test_config.py
@@ -200,9 +200,17 @@ class ConfigTestCase(TestCase):
def testManifest(self):
+ distfiles = {
+ 'B-2.tar.bz2': b'binary\0content',
+ 'C-2.zip': b'binary\0content',
+ 'C-2.tar.bz2': b'binary\0content',
+ }
+
ebuilds = {
"dev-libs/A-1::old_repo": { },
"dev-libs/A-2::new_repo": { },
+ "dev-libs/B-2::new_repo": {"SRC_URI" : "B-2.tar.bz2"},
+ "dev-libs/C-2::new_repo": {"SRC_URI" : "C-2.zip C-2.tar.bz2"},
}
repo_configs = {
@@ -226,11 +234,22 @@ class ConfigTestCase(TestCase):
success = True),
)
- playground = ResolverPlayground(ebuilds=ebuilds, repo_configs=repo_configs)
+ playground = ResolverPlayground(ebuilds=ebuilds,
+ repo_configs=repo_configs, distfiles=distfiles)
new_manifest_file = os.path.join(playground.repo_dirs["new_repo"], "dev-libs", "A", "Manifest")
self.assertEqual(os.path.exists(new_manifest_file), False)
+ new_manifest_file = os.path.join(playground.repo_dirs["new_repo"], "dev-libs", "B", "Manifest")
+ f = open(new_manifest_file)
+ self.assertEqual(len(list(f)), 1)
+ f.close()
+
+ new_manifest_file = os.path.join(playground.repo_dirs["new_repo"], "dev-libs", "C", "Manifest")
+ f = open(new_manifest_file)
+ self.assertEqual(len(list(f)), 2)
+ 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)
diff --git a/pym/portage/tests/resolver/ResolverPlayground.py b/pym/portage/tests/resolver/ResolverPlayground.py
index e22121d..5fb64cf 100644
--- a/pym/portage/tests/resolver/ResolverPlayground.py
+++ b/pym/portage/tests/resolver/ResolverPlayground.py
@@ -57,7 +57,7 @@ class ResolverPlayground(object):
"""
def __init__(self, ebuilds={}, installed={}, profile={}, repo_configs={}, \
- user_config={}, sets={}, world=[], debug=False):
+ user_config={}, sets={}, world=[], distfiles={}, debug=False):
"""
ebuilds: cpv -> metadata mapping simulating available ebuilds.
installed: cpv -> metadata mapping simulating installed packages.
@@ -68,6 +68,7 @@ class ResolverPlayground(object):
self.root = "/"
self.eprefix = tempfile.mkdtemp()
self.eroot = self.root + self.eprefix.lstrip(os.sep) + os.sep
+ self.distdir = os.path.join(self.eroot, "var", "portage", "distfiles")
self.portdir = os.path.join(self.eroot, "usr/portage")
self.vdbdir = os.path.join(self.eroot, "var/db/pkg")
os.makedirs(self.portdir)
@@ -80,6 +81,7 @@ class ResolverPlayground(object):
#Make sure the main repo is always created
self._get_repo_dir("test_repo")
+ self._create_distfiles(distfiles)
self._create_ebuilds(ebuilds)
self._create_installed(installed)
self._create_profile(ebuilds, installed, profile, repo_configs, user_config, sets)
@@ -116,6 +118,12 @@ class ResolverPlayground(object):
return self.repo_dirs[repo]
+ def _create_distfiles(self, distfiles):
+ os.makedirs(self.distdir)
+ for k, v in distfiles.items():
+ with open(os.path.join(self.distdir, k), 'wb') as f:
+ f.write(v)
+
def _create_ebuilds(self, ebuilds):
for cpv in ebuilds:
a = Atom("=" + cpv, allow_repo=True)
@@ -132,6 +140,7 @@ class ResolverPlayground(object):
slot = metadata.pop("SLOT", 0)
keywords = metadata.pop("KEYWORDS", "x86")
homepage = metadata.pop("HOMEPAGE", None)
+ src_uri = metadata.pop("SRC_URI", None)
iuse = metadata.pop("IUSE", "")
depend = metadata.pop("DEPEND", "")
rdepend = metadata.pop("RDEPEND", None)
@@ -158,6 +167,8 @@ class ResolverPlayground(object):
f.write('DESCRIPTION="%s"\n' % desc)
if homepage is not None:
f.write('HOMEPAGE="%s"\n' % homepage)
+ if src_uri is not None:
+ f.write('SRC_URI="%s"\n' % src_uri)
f.write('LICENSE="' + str(lic) + '"\n')
f.write('PROPERTIES="' + str(properties) + '"\n')
f.write('SLOT="' + str(slot) + '"\n')
@@ -454,6 +465,7 @@ class ResolverPlayground(object):
env = {
"ACCEPT_KEYWORDS": "x86",
+ "DISTDIR" : self.distdir,
"PORTDIR": self.portdir,
"PORTDIR_OVERLAY": " ".join(portdir_overlay),
'PORTAGE_TMPDIR' : os.path.join(self.eroot, 'var/tmp'),
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/resolver/, pym/portage/tests/ebuild/
@ 2011-09-12 21:45 Zac Medico
0 siblings, 0 replies; 2+ messages in thread
From: Zac Medico @ 2011-09-12 21:45 UTC (permalink / raw
To: gentoo-commits
commit: 732fe15bde15f537df3c867f1d93744b792472b5
Author: Sebastian Luther <SebastianLuther <AT> gmx <DOT> de>
AuthorDate: Wed Sep 7 06:13:59 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Sep 12 21:41:00 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=732fe15b
Add tests for thin manifests
---
pym/portage/tests/ebuild/test_config.py | 48 ++++++++++++++++++++++
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 7bec8c6..ff3935b 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 5d7c316..e22121d 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" ?>
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-09-15 4:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-15 4:15 [gentoo-commits] proj/portage:master commit in: pym/portage/tests/resolver/, pym/portage/tests/ebuild/ Zac Medico
-- strict thread matches above, loose matches on Subject: below --
2011-09-12 21:45 Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox