From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/tests/resolver/
Date: Tue, 25 Sep 2012 03:30:20 +0000 (UTC) [thread overview]
Message-ID: <1348543805.673be9159fcc94da719496f6b2049548efeeb1db.zmedico@gentoo> (raw)
commit: 673be9159fcc94da719496f6b2049548efeeb1db
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 25 03:30:05 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Sep 25 03:30:05 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=673be915
ResolverPlayground: simplify vdb/portdb creation
This enables automatic handling of HDEPEND.
---
pym/portage/tests/resolver/ResolverPlayground.py | 112 ++++++---------------
1 files changed, 32 insertions(+), 80 deletions(-)
diff --git a/pym/portage/tests/resolver/ResolverPlayground.py b/pym/portage/tests/resolver/ResolverPlayground.py
index 3bda607..c7c9be9 100644
--- a/pym/portage/tests/resolver/ResolverPlayground.py
+++ b/pym/portage/tests/resolver/ResolverPlayground.py
@@ -132,24 +132,18 @@ class ResolverPlayground(object):
metadata = ebuilds[cpv].copy()
copyright_header = metadata.pop("COPYRIGHT_HEADER", None)
- desc = metadata.pop("DESCRIPTION", None)
- eapi = metadata.pop("EAPI", 0)
- lic = metadata.pop("LICENSE", "")
- properties = metadata.pop("PROPERTIES", "")
- 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", "")
- provide = metadata.pop("PROVIDE", None)
- depend = metadata.pop("DEPEND", "")
- rdepend = metadata.pop("RDEPEND", None)
- pdepend = metadata.pop("PDEPEND", None)
- required_use = metadata.pop("REQUIRED_USE", None)
+ eapi = metadata.pop("EAPI", "0")
misc_content = metadata.pop("MISC_CONTENT", None)
+ metadata.setdefault("DEPEND", "")
+ metadata.setdefault("SLOT", "0")
+ metadata.setdefault("KEYWORDS", "x86")
+ metadata.setdefault("IUSE", "")
- if metadata:
- raise ValueError("metadata of ebuild '%s' contains unknown keys: %s" % (cpv, metadata.keys()))
+ unknown_keys = set(metadata).difference(
+ portage.dbapi.dbapi._known_keys)
+ if unknown_keys:
+ raise ValueError("metadata of ebuild '%s' contains unknown keys: %s" %
+ (cpv, sorted(unknown_keys)))
repo_dir = self._get_repo_dir(repo)
ebuild_dir = os.path.join(repo_dir, a.cp)
@@ -162,27 +156,9 @@ class ResolverPlayground(object):
f = open(ebuild_path, "w")
if copyright_header is not None:
f.write(copyright_header)
- f.write('EAPI="' + str(eapi) + '"\n')
- if desc is not None:
- 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')
- f.write('KEYWORDS="' + str(keywords) + '"\n')
- f.write('IUSE="' + str(iuse) + '"\n')
- if provide is not None:
- f.write('PROVIDE="%s"\n' % provide)
- f.write('DEPEND="' + str(depend) + '"\n')
- if rdepend is not None:
- f.write('RDEPEND="' + str(rdepend) + '"\n')
- if pdepend is not None:
- f.write('PDEPEND="' + str(pdepend) + '"\n')
- if required_use is not None:
- f.write('REQUIRED_USE="' + str(required_use) + '"\n')
+ f.write('EAPI="%s"\n' % eapi)
+ for k, v in metadata.items():
+ f.write('%s="%s"\n' % (k, v))
if misc_content is not None:
f.write(misc_content)
f.close()
@@ -242,49 +218,25 @@ class ResolverPlayground(object):
pass
metadata = installed[cpv].copy()
- eapi = metadata.pop("EAPI", 0)
- lic = metadata.pop("LICENSE", "")
- properties = metadata.pop("PROPERTIES", "")
- slot = metadata.pop("SLOT", 0)
- build_time = metadata.pop("BUILD_TIME", "0")
- keywords = metadata.pop("KEYWORDS", "~x86")
- iuse = metadata.pop("IUSE", "")
- use = metadata.pop("USE", "")
- provide = metadata.pop("PROVIDE", None)
- depend = metadata.pop("DEPEND", "")
- rdepend = metadata.pop("RDEPEND", None)
- pdepend = metadata.pop("PDEPEND", None)
- required_use = metadata.pop("REQUIRED_USE", None)
-
- if metadata:
- raise ValueError("metadata of installed '%s' contains unknown keys: %s" % (cpv, metadata.keys()))
-
- def write_key(key, value):
- f = open(os.path.join(vdb_pkg_dir, key), "w")
- f.write(str(value) + "\n")
- f.close()
-
- write_key("EAPI", eapi)
- write_key("BUILD_TIME", build_time)
- write_key("COUNTER", "0")
- write_key("LICENSE", lic)
- write_key("PROPERTIES", properties)
- write_key("SLOT", slot)
- write_key("LICENSE", lic)
- write_key("PROPERTIES", properties)
- write_key("repository", repo)
- write_key("KEYWORDS", keywords)
- write_key("IUSE", iuse)
- write_key("USE", use)
- if provide is not None:
- write_key("PROVIDE", provide)
- write_key("DEPEND", depend)
- if rdepend is not None:
- write_key("RDEPEND", rdepend)
- if pdepend is not None:
- write_key("PDEPEND", pdepend)
- if required_use is not None:
- write_key("REQUIRED_USE", required_use)
+ metadata.setdefault("SLOT", "0")
+ metadata.setdefault("BUILD_TIME", "0")
+ metadata.setdefault("COUNTER", "0")
+ metadata.setdefault("KEYWORDS", "~x86")
+
+ unknown_keys = set(metadata).difference(
+ portage.dbapi.dbapi._known_keys)
+ unknown_keys.discard("BUILD_TIME")
+ unknown_keys.discard("COUNTER")
+ unknown_keys.discard("repository")
+ unknown_keys.discard("USE")
+ if unknown_keys:
+ raise ValueError("metadata of installed '%s' contains unknown keys: %s" %
+ (cpv, sorted(unknown_keys)))
+
+ metadata["repository"] = repo
+ for k, v in metadata.items():
+ with open(os.path.join(vdb_pkg_dir, k), "w") as f:
+ f.write("%s\n" % v)
def _create_profile(self, ebuilds, installed, profile, repo_configs, user_config, sets):
next reply other threads:[~2012-09-25 3:30 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-25 3:30 Zac Medico [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-03-04 21:05 [gentoo-commits] proj/portage:master commit in: pym/portage/tests/resolver/ Michał Górny
2018-02-26 22:07 Michał Górny
2017-12-16 3:16 Zac Medico
2016-06-26 23:51 Zac Medico
2016-04-29 17:24 Brian Dolbec
2014-09-19 8:52 Zac Medico
2014-09-16 6:35 Brian Dolbec
2014-02-24 20:03 Sebastian Luther
2014-01-07 20:40 Arfrever Frehtes Taifersar Arahesis
2014-01-07 19:06 Arfrever Frehtes Taifersar Arahesis
2013-12-05 21:51 Arfrever Frehtes Taifersar Arahesis
2013-11-27 7:44 Mike Frysinger
2013-11-27 3:24 Mike Frysinger
2013-11-26 15:11 Brian Dolbec
2013-11-26 13:50 Brian Dolbec
2013-08-22 0:46 Zac Medico
2013-07-30 2:13 Zac Medico
2013-03-04 23:37 Zac Medico
2013-02-14 1:20 Zac Medico
2013-02-12 3:03 Zac Medico
2013-02-12 1:36 Zac Medico
2012-10-26 17:25 Zac Medico
2012-10-26 6:31 Zac Medico
2012-10-26 3:44 Zac Medico
2012-09-26 2:38 Zac Medico
2012-09-26 2:36 Zac Medico
2012-09-26 0:52 Zac Medico
2012-06-23 21:53 Zac Medico
2012-06-21 22:32 Zac Medico
2012-06-20 10:06 Zac Medico
2012-06-20 9:53 Zac Medico
2012-06-14 0:24 Zac Medico
2012-05-13 6:23 Zac Medico
2011-12-11 0:22 Zac Medico
2011-11-07 21:38 Zac Medico
2011-10-02 2:14 Zac Medico
2011-09-22 19:07 Zac Medico
2011-09-22 18:19 Zac Medico
2011-09-18 20:08 Zac Medico
2011-09-11 18:50 Zac Medico
2011-09-05 22:44 Zac Medico
2011-08-29 6:19 Zac Medico
2011-06-04 3:08 Zac Medico
2011-05-30 23:44 Zac Medico
2011-05-30 22:58 Zac Medico
2011-05-23 5:59 Zac Medico
2011-05-23 0:46 Zac Medico
2011-05-22 22:01 Zac Medico
2011-05-22 21:01 Zac Medico
2011-05-22 20:36 Zac Medico
2011-05-22 20:03 Zac Medico
2011-05-22 19:44 Zac Medico
2011-05-22 17:03 Zac Medico
2011-05-22 9:05 Zac Medico
2011-05-21 22:37 Zac Medico
2011-05-21 22:17 Zac Medico
2011-05-21 10:34 Zac Medico
2011-05-21 10:30 Zac Medico
2011-05-21 9:21 Zac Medico
2011-05-21 9:11 Zac Medico
2011-05-21 8:47 Zac Medico
2011-05-21 4:15 Zac Medico
2011-05-21 4:02 Zac Medico
2011-05-21 3:30 Zac Medico
2011-05-21 1:17 Zac Medico
2011-05-21 1:13 Zac Medico
2011-05-21 1:01 Zac Medico
2011-05-21 0:51 Zac Medico
2011-05-17 20:34 Zac Medico
2011-05-04 17:36 Zac Medico
2011-02-17 10:43 Zac Medico
2011-02-13 17:35 Zac Medico
2011-02-13 13:01 Zac Medico
2011-02-13 11:35 Zac Medico
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=1348543805.673be9159fcc94da719496f6b2049548efeeb1db.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