Improve allowing of directories on profile level and repository level in EAPI="4...
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Fri, 21 Sep 2012 06:31:13 +0000 (08:31 +0200)
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Fri, 21 Sep 2012 06:31:13 +0000 (08:31 +0200)
doc/package/ebuild/eapi/4-python.docbook
pym/portage/eapi.py
pym/portage/package/ebuild/_config/LocationsManager.py
pym/portage/repository/config.py

index ec5fd83c44e2c8823232ef8fcc11d18235cda72a..c49033023d5ba5ed2ddf709134086cebb574239c 100644 (file)
@@ -97,7 +97,7 @@
        <section id='package-ebuild-eapi-4-python-repo-level-config'>
                <title>Extended Repository-Level Configuration</title>
                <para>
-                       Repository-level configuration in ${repository}/profiles is supported for the following files:
+                       Repository-level configuration in ${repository_path}/profiles is supported for the following files:
                        <itemizedlist>
                                <listitem><para>make.defaults</para></listitem>
                                <listitem><para>package.use</para></listitem>
                                <listitem><para>use.mask</para></listitem>
                        </itemizedlist>
                </para>
+       </section>
+       <section id='package-ebuild-eapi-4-python-directories'>
+               <title>Directories Allowed for Profile-Level and Repository-Level Configuration</title>
                <para>
-                       By default, the following files in ${repository}/profiles can be also directories:
+                       The following files can be directories:
                        <itemizedlist>
                                <listitem><para>package.mask</para></listitem>
                                <listitem><para>package.use</para></listitem>
index 4efd4eac1094b4cbcab8a1254bc586512ee232e6..42c108b2e6b3150af1cdcf61fec4fd8b5b8007d8 100644 (file)
@@ -80,6 +80,9 @@ def eapi_allows_dots_in_use_flags(eapi):
 def eapi_supports_stable_use_forcing_and_masking(eapi):
        return eapi not in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi")
 
+def eapi_allows_directories_on_profile_level_and_repository_level(eapi):
+       return eapi in ("4-python",)
+
 _eapi_attrs = collections.namedtuple('_eapi_attrs',
        'dots_in_PN dots_in_use_flags exports_EBUILD_PHASE_FUNC '
        'iuse_defaults iuse_effective '
index 2200be694f2458c87505bb9a3c8cf6722679cbcb..0149ad8ec3a275afb92d375aea0ccce619820031 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Gentoo Foundation
+# Copyright 2010-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 __all__ = (
@@ -13,6 +13,7 @@ import portage
 from portage import os, eapi_is_supported, _encodings, _unicode_encode
 from portage.const import CUSTOM_PROFILE_PATH, GLOBAL_CONFIG_PATH, \
        PROFILE_PATH, USER_CONFIG_PATH
+from portage.eapi import eapi_allows_directories_on_profile_level_and_repository_level
 from portage.exception import DirectoryNotFound, ParseError
 from portage.localization import _
 from portage.util import ensure_dirs, grabfile, \
@@ -132,6 +133,7 @@ class LocationsManager(object):
                compat_mode = False
 
                eapi_file = os.path.join(currentPath, "eapi")
+               eapi = "0"
                f = None
                try:
                        f = io.open(_unicode_encode(eapi_file,
@@ -155,9 +157,10 @@ class LocationsManager(object):
                        # protect against nested repositories.  Insane configuration, but the longest
                        # path will be the correct one.
                        repo_loc, layout_data = max(intersecting_repos, key=lambda x:len(x[0]))
-                       allow_directories = any(x in _portage1_profiles_allow_directories
-                               for x in layout_data['profile-formats'])
-                       compat_mode = layout_data['profile-formats'] == ('portage-1-compat',)
+                       allow_directories = eapi_allows_directories_on_profile_level_and_repository_level(eapi) or \
+                               any(x in _portage1_profiles_allow_directories for x in layout_data['profile-formats'])
+                       compat_mode = not eapi_allows_directories_on_profile_level_and_repository_level(eapi) and \
+                               layout_data['profile-formats'] == ('portage-1-compat',)
                        allow_parent_colon = any(x in _allow_parent_colon
                                for x in layout_data['profile-formats'])
 
index 4de49f0ceebff673179b014abd4b4f2bdd15985e..77b016d0cc9430c1cc878decd4316a2cbde2041d 100644 (file)
@@ -18,6 +18,7 @@ except ImportError:
 from portage import eclass_cache, os
 from portage.const import (MANIFEST2_HASH_FUNCTIONS, MANIFEST2_REQUIRED_HASH,
        REPO_NAME_LOC, USER_CONFIG_PATH)
+from portage.eapi import eapi_allows_directories_on_profile_level_and_repository_level
 from portage.env.loaders import KeyValuePairFileLoader
 from portage.util import (normalize_path, read_corresponding_eapi_file, shlex_split,
        stack_lists, writemsg, writemsg_level)
@@ -163,9 +164,10 @@ class RepoConfig(object):
                                'sign-commit', 'sign-manifest', 'thin-manifest', 'update-changelog'):
                                setattr(self, value.lower().replace("-", "_"), layout_data[value])
 
-                       self.portage1_profiles = any(x in _portage1_profiles_allow_directories
-                               for x in layout_data['profile-formats'])
-                       self.portage1_profiles_compat = layout_data['profile-formats'] == ('portage-1-compat',)
+                       self.portage1_profiles = eapi_allows_directories_on_profile_level_and_repository_level(eapi) or \
+                               any(x in _portage1_profiles_allow_directories for x in layout_data['profile-formats'])
+                       self.portage1_profiles_compat = not eapi_allows_directories_on_profile_level_and_repository_level(eapi) and \
+                               layout_data['profile-formats'] == ('portage-1-compat',)
 
        def iter_pregenerated_caches(self, auxdbkeys, readonly=True, force=False):
                """
@@ -760,7 +762,7 @@ def parse_layout_conf(repo_location, repo_name=None):
 
        raw_formats = layout_data.get('profile-formats')
        if raw_formats is None:
-               if eapi in ('4-python',):
+               if eapi_allows_directories_on_profile_level_and_repository_level(eapi):
                        raw_formats = ('portage-1',)
                else:
                        raw_formats = ('portage-1-compat',)