ResolverPlayground: Write layout.conf if needed
authorSebastian Luther <SebastianLuther@gmx.de>
Tue, 7 Jan 2014 19:06:20 +0000 (20:06 +0100)
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Tue, 7 Jan 2014 19:06:20 +0000 (20:06 +0100)
pym/portage/tests/resolver/ResolverPlayground.py

index e09e2653570b63b68bbf3fecf022f7691b20f809..99c66cd70b0fb5f482af96e2bba88e3c57fbe0a0 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2010-2013 Gentoo Foundation
+# Copyright 2010-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from itertools import permutations
@@ -302,6 +302,12 @@ class ResolverPlayground(object):
                        #Create $profile_dir/eclass (we fail to digest the ebuilds if it's not there)
                        os.makedirs(os.path.join(repo_dir, "eclass"))
 
+                       # Set masters key in layout.conf for all repos except 'main-repo'
+                       if repo != "test_repo" and (not repo_config or "layout.conf" not in repo_config):
+                               layout_conf_path = os.path.join(repo_dir, "metadata", "layout.conf")
+                               with open(layout_conf_path, "w") as f:
+                                       f.write("masters = test_repo\n")
+
                        if repo == "test_repo":
                                #Create a minimal profile in /usr/portage
                                sub_profile_dir = os.path.join(profile_dir, "default", "linux", "x86", "test_profile")