From: Arfrever Frehtes Taifersar Arahesis Date: Tue, 7 Jan 2014 21:38:29 +0000 (+0100) Subject: Use empty value of masters attribute in test suite when possible. X-Git-Tag: fetch-refactor-v1~8 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c980aac3ed85d63f5e3fa96db249cd5076c50cbc;p=portage.git Use empty value of masters attribute in test suite when possible. --- diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py index 0d6edf4e3..71b75fb5f 100644 --- a/pym/portage/repository/config.py +++ b/pym/portage/repository/config.py @@ -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") % diff --git a/pym/portage/tests/ebuild/test_config.py b/pym/portage/tests/ebuild/test_config.py index 7941bf21f..08e0a5dcf 100644 --- a/pym/portage/tests/ebuild/test_config.py +++ b/pym/portage/tests/ebuild/test_config.py @@ -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" ), } } diff --git a/pym/portage/tests/resolver/ResolverPlayground.py b/pym/portage/tests/resolver/ResolverPlayground.py index 957774328..fabdefec2 100644 --- a/pym/portage/tests/resolver/ResolverPlayground.py +++ b/pym/portage/tests/resolver/ResolverPlayground.py @@ -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