[entropy.client.package] add support for package.splitdebug.mask, see bug 3707
This commit is contained in:
25
conf/packages/package.splitdebug.mask.example
Normal file
25
conf/packages/package.splitdebug.mask.example
Normal file
@@ -0,0 +1,25 @@
|
||||
# package.splitdebug example file
|
||||
#
|
||||
# In this file you can specify dependencies, one per line, for which you
|
||||
# would like to have the splitdebug feature turned off. This means that
|
||||
# if at least one valid entry is listed here, the installation of
|
||||
# /usr/lib/debug files will be disabled only for it.
|
||||
# These entries take the precedence over package.splitdebug. This
|
||||
# configuration file can be used to create a blacklist (while
|
||||
# package.splitdebug can be used to create a whitelist).
|
||||
|
||||
# LINE CONSTRUCTION:
|
||||
# <dependency to match>
|
||||
# See examples below
|
||||
# NOTE: for inline comments, please use "##" instead of "#"
|
||||
|
||||
# EXAMPLES:
|
||||
# >=media-libs/foo-1.2.3
|
||||
# media-libs/foo
|
||||
# <media-libs/foo-1.2.3
|
||||
# media-libs/foo:1
|
||||
# >=media-libs/foo-1.2.3#2.6.23-sabayon-r1
|
||||
# media-libs/foo::sabayon-repo
|
||||
#
|
||||
# :1 means package with SLOT="1"
|
||||
# #2.6.23-sabayon-r1 means package with kernel tag = 2.6.23-sabayon-r1
|
||||
@@ -4297,24 +4297,20 @@ class Package:
|
||||
# generate metadata dictionary
|
||||
self._generate_metadata()
|
||||
|
||||
@staticmethod
|
||||
def splitdebug_enabled(entropy_client, pkg_match):
|
||||
@classmethod
|
||||
def splitdebug_enabled(cls, entropy_client, pkg_match):
|
||||
"""
|
||||
Return whether splitdebug is enabled for package.
|
||||
"""
|
||||
settings = entropy_client.Settings()
|
||||
# this is a SystemSettings.CachingList object
|
||||
split_data = settings['splitdebug']
|
||||
if not split_data:
|
||||
# no entries, consider splitdebug always enabled
|
||||
return True
|
||||
splitdebug = settings['splitdebug']
|
||||
splitdebug_mask = settings['splitdebug_mask']
|
||||
|
||||
pkg_id, pkg_repo = pkg_match
|
||||
pkg_matches = split_data.get()
|
||||
if pkg_matches is None:
|
||||
def _generate_cache(lst_obj):
|
||||
# compute the package matching then
|
||||
pkg_matches = set()
|
||||
for dep in settings['splitdebug']:
|
||||
for dep in lst_obj:
|
||||
dep, repo_ids = entropy.dep.dep_get_match_in_repos(dep)
|
||||
if repo_ids is not None:
|
||||
if pkg_repo not in repo_ids:
|
||||
@@ -4323,10 +4319,38 @@ class Package:
|
||||
dep_matches, rc = entropy_client.atom_match(
|
||||
dep, multi_match=True, multi_repo=True)
|
||||
pkg_matches |= dep_matches
|
||||
|
||||
# set cache back
|
||||
split_data.set(pkg_matches)
|
||||
# determine if it's enabled then
|
||||
enabled = pkg_match in pkg_matches
|
||||
lst_obj.set(pkg_matches)
|
||||
return pkg_matches
|
||||
|
||||
enabled = False
|
||||
if not splitdebug:
|
||||
# no entries, consider splitdebug always enabled
|
||||
enabled = True
|
||||
else:
|
||||
# whitelist support
|
||||
pkg_id, pkg_repo = pkg_match
|
||||
pkg_matches = splitdebug.get()
|
||||
|
||||
if pkg_matches is None:
|
||||
pkg_matches = _generate_cache(splitdebug)
|
||||
|
||||
# determine if it's enabled then
|
||||
enabled = pkg_match in pkg_matches
|
||||
|
||||
# if it's enabled, check whether it's blacklisted
|
||||
if enabled:
|
||||
# blacklist support
|
||||
pkg_id, pkg_repo = pkg_match
|
||||
pkg_matches = splitdebug_mask.get()
|
||||
|
||||
if pkg_matches is None:
|
||||
# compute the package matching
|
||||
pkg_matches = _generate_cache(splitdebug_mask)
|
||||
|
||||
enabled = pkg_match not in pkg_matches
|
||||
|
||||
return enabled
|
||||
|
||||
def _package_splitdebug_enabled(self, pkg_match):
|
||||
|
||||
@@ -298,6 +298,8 @@ class SystemSettings(Singleton, EntropyPluginStore):
|
||||
# selectively enable splitdebug for packages
|
||||
'splitdebug': os.path.join(
|
||||
packages_dir, "package.splitdebug"),
|
||||
'splitdebug_mask': os.path.join(
|
||||
packages_dir, "package.splitdebug.mask"),
|
||||
# masking configuration files
|
||||
'license_mask': os.path.join(
|
||||
packages_dir, "license.mask"),
|
||||
@@ -328,8 +330,9 @@ class SystemSettings(Singleton, EntropyPluginStore):
|
||||
'keywords', 'unmask', 'mask', 'license_mask',
|
||||
'license_accept', 'system_mask', 'system_package_sets',
|
||||
'system_dirs', 'system_dirs_mask', 'extra_ldpaths',
|
||||
'splitdebug', 'system', 'system_rev_symlinks', 'hw_hash',
|
||||
'broken_syms', 'broken_libs_mask', 'broken_links_mask'
|
||||
'splitdebug', 'splitdebug_mask', 'system',
|
||||
'system_rev_symlinks', 'hw_hash', 'broken_syms',
|
||||
'broken_libs_mask', 'broken_links_mask'
|
||||
])
|
||||
self.__setting_files_pre_run.extend(['repositories'])
|
||||
|
||||
@@ -931,7 +934,7 @@ class SystemSettings(Singleton, EntropyPluginStore):
|
||||
"""
|
||||
Parser returning packages for which the splitdebug feature
|
||||
should be enabled. Splitdebug is about installing /usr/lib/debug
|
||||
files into system. If no entries are listed in here and
|
||||
files into the system. If no entries are listed in here and
|
||||
splitdebug is enabled in client.conf, the feature will be considered
|
||||
enabled for any package.
|
||||
|
||||
@@ -941,6 +944,21 @@ class SystemSettings(Singleton, EntropyPluginStore):
|
||||
return self.__generic_parser(self.__setting_files['splitdebug'],
|
||||
comment_tag = self.__pkg_comment_tag)
|
||||
|
||||
def _splitdebug_mask_parser(self):
|
||||
"""
|
||||
Parser returning packages for which the splitdebug feature
|
||||
should be always disabled. This takes the precedence over
|
||||
package.splitdebug.
|
||||
Splitdebug is about installing /usr/lib/debug files into the system.
|
||||
If no entries are listed in here and splitdebug is enabled in
|
||||
client.conf, the feature will be considered enabled for any package.
|
||||
|
||||
@return: parsed metadata
|
||||
@rtype: dict
|
||||
"""
|
||||
return self.__generic_parser(self.__setting_files['splitdebug_mask'],
|
||||
comment_tag = self.__pkg_comment_tag)
|
||||
|
||||
def _license_mask_parser(self):
|
||||
"""
|
||||
Parser returning packages masked by license metadata read from
|
||||
|
||||
Reference in New Issue
Block a user