Use empty value of masters attribute in test suite when possible.
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Tue, 7 Jan 2014 21:38:29 +0000 (22:38 +0100)
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Tue, 7 Jan 2014 21:38:29 +0000 (22:38 +0100)
pym/portage/repository/config.py
pym/portage/tests/ebuild/test_config.py
pym/portage/tests/resolver/ResolverPlayground.py

index 0d6edf4e3e6dcffb0758caf859a597a8f0996bc0..71b75fb5f3b780be7f6edd3540dacca3210a8275 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 __future__ import unicode_literals
@@ -814,6 +814,7 @@ class RepoConfigLoader(object):
 
                        if repo._masters_orig is None and self.mainRepo() and \
                                repo.name != self.mainRepo().name and not portage._sync_disabled_warnings:
+                               # TODO: Delete masters code in pym/portage/tests/resolver/ResolverPlayground.py when deleting this warning.
                                writemsg_level("!!! %s\n" % _("Repository '%s' is missing masters attribute in '%s'") %
                                        (repo.name, os.path.join(repo.location, "metadata", "layout.conf")) +
                                        "!!! %s\n" % _("Set 'masters = %s' in this file for future compatibility") %
index 7941bf21f3cd5044ac1d89cc162f8f783cc7fe07..08e0a5dcf8d1b4f1d22421befe260c23b580ca63 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
 
 import portage
@@ -221,6 +221,7 @@ class ConfigTestCase(TestCase):
                                                "profile-formats = pms",
                                                "thin-manifests = true",
                                                "manifest-hashes = SHA256 SHA512 WHIRLPOOL",
+                                               "# use implicit masters"
                                        ),
                        }
                }
index 9577743286e6a6eb0b8f2ede5176422f1e62ba00..fabdefec22ceb5f283711108c939ac2b189cadb3 100644 (file)
@@ -293,15 +293,19 @@ class ResolverPlayground(object):
                                        with open(file_name, "w") as f:
                                                for line in lines:
                                                        f.write("%s\n" % line)
+                                               # Temporarily write empty value of masters until it becomes default.
+                                               # TODO: Delete all references to "# use implicit masters" when empty value becomes default.
+                                               if config_file == "layout.conf" and not any(line.startswith(("masters =", "# use implicit masters")) for line in lines):
+                                                       f.write("masters =\n")
 
                        #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):
+                       # Temporarily write empty value of masters until it becomes default.
+                       if 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")
+                                       f.write("masters =\n")
 
                        if repo == "test_repo":
                                #Create a minimal profile in /usr/portage