ResolverPlayground: fix to make emerge happy
authorZac Medico <zmedico@gentoo.org>
Mon, 29 Aug 2011 06:18:08 +0000 (23:18 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 29 Aug 2011 06:18:08 +0000 (23:18 -0700)
pym/portage/tests/resolver/ResolverPlayground.py

index dd014140441e1672fe05af5c40b15781854e95ba..f41126bb79d6ffc6124046ce237864d6980476a7 100644 (file)
@@ -7,7 +7,7 @@ import sys
 import tempfile
 import portage
 from portage import os
-from portage.const import PORTAGE_BASE_PATH
+from portage.const import GLOBAL_CONFIG_PATH, PORTAGE_BASE_PATH
 from portage.dbapi.vartree import vartree
 from portage.dbapi.porttree import portagetree
 from portage.dbapi.bintree import binarytree
@@ -16,6 +16,7 @@ from portage.package.ebuild.config import config
 from portage.package.ebuild.digestgen import digestgen
 from portage._sets import load_default_config
 from portage._sets.base import InternalPackageSet
+from portage.util import ensure_dirs
 from portage.versions import catsplit
 
 import _emerge
@@ -206,6 +207,7 @@ class ResolverPlayground(object):
                                f.close()
                        
                        write_key("EAPI", eapi)
+                       write_key("COUNTER", "0")
                        write_key("LICENSE", lic)
                        write_key("PROPERTIES", properties)
                        write_key("SLOT", slot)
@@ -286,6 +288,11 @@ class ResolverPlayground(object):
                                f.write("x86\n")
                                f.close()
 
+                               parent_file = os.path.join(sub_profile_dir, "parent")
+                               f = open(parent_file, "w")
+                               f.write("..\n")
+                               f.close()
+
                                if profile:
                                        for config_file, lines in profile.items():
                                                if config_file not in self.config_files:
@@ -331,6 +338,13 @@ class ResolverPlayground(object):
                                f.write("%s\n" % line)
                        f.close()
 
+               #Create /usr/share/portage/config/make.globals
+               make_globals_path = os.path.join(self.eroot,
+                       GLOBAL_CONFIG_PATH.lstrip(os.sep), "make.globals")
+               ensure_dirs(os.path.dirname(make_globals_path))
+               os.symlink(os.path.join(PORTAGE_BASE_PATH, "cnf", "make.globals"),
+                       make_globals_path)
+
                #Create /usr/share/portage/config/sets/portage.conf
                default_sets_conf_dir = os.path.join(self.eroot, "usr/share/portage/config/sets")