commit: c5f9cbdc45be302a04bda52612d12a891667103c
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 16 09:53:05 2019 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Nov 16 09:53:56 2019 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=c5f9cbdc
ResolverPlayground: create installed ebuild + environment.bz2
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
lib/portage/tests/resolver/ResolverPlayground.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/lib/portage/tests/resolver/ResolverPlayground.py
b/lib/portage/tests/resolver/ResolverPlayground.py
index 22d54e251..3d48c244f 100644
--- a/lib/portage/tests/resolver/ResolverPlayground.py
+++ b/lib/portage/tests/resolver/ResolverPlayground.py
@@ -1,6 +1,7 @@
# Copyright 2010-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
+import bz2
from itertools import permutations
import fnmatch
import sys
@@ -332,6 +333,17 @@ class ResolverPlayground(object):
with open(os.path.join(vdb_pkg_dir, k), "w") as
f:
f.write("%s\n" % v)
+ ebuild_path = os.path.join(vdb_pkg_dir,
a.cpv.split("/")[1] + ".ebuild")
+ with open(ebuild_path, "w") as f:
+ f.write('EAPI="%s"\n' % metadata.pop('EAPI',
'0'))
+ for k, v in metadata.items():
+ f.write('%s="%s"\n' % (k, v))
+
+ env_path = os.path.join(vdb_pkg_dir, 'environment.bz2')
+ with bz2.BZ2File(env_path, mode='w') as f:
+ with open(ebuild_path, 'rb') as inputfile:
+ f.write(inputfile.read())
+
def _create_profile(self, ebuilds, installed, profile, repo_configs,
user_config, sets):
user_config_dir = os.path.join(self.eroot, USER_CONFIG_PATH)