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