[entropy.client.misc] FileUpdates: make possible to provide arbitrary EntropyRepositoryBase objects
This commit is contained in:
@@ -27,11 +27,14 @@ class FileUpdates:
|
||||
|
||||
CACHE_ID = "conf/scanfs"
|
||||
|
||||
def __init__(self, entropy_client):
|
||||
def __init__(self, entropy_client, entropy_repository = None):
|
||||
if not isinstance(entropy_client, Client):
|
||||
mytxt = "A valid Client instance or subclass is needed"
|
||||
raise AttributeError(mytxt)
|
||||
self._entropy = entropy_client
|
||||
if entropy_repository is None:
|
||||
entropy_repository = self._entropy.installed_repository()
|
||||
self._repo = entropy_repository
|
||||
self._settings = SystemSettings()
|
||||
self._cacher = EntropyCacher()
|
||||
self._scandata = None
|
||||
@@ -77,18 +80,17 @@ class FileUpdates:
|
||||
|
||||
def _get_system_config_protect(self, mask = False):
|
||||
|
||||
inst_repo = self._entropy.installed_repository()
|
||||
if inst_repo is None:
|
||||
if self._repo is None:
|
||||
return []
|
||||
|
||||
cl_id = etpConst['system_settings_plugins_ids']['client_plugin']
|
||||
misc_data = self._settings[cl_id]['misc']
|
||||
if mask:
|
||||
_pmask = inst_repo.listConfigProtectEntries(mask = True)
|
||||
_pmask = self._repo.listConfigProtectEntries(mask = True)
|
||||
config_protect = set(_pmask)
|
||||
config_protect |= set(misc_data['configprotectmask'])
|
||||
else:
|
||||
_protect = inst_repo.listConfigProtectEntries()
|
||||
_protect = self._repo.listConfigProtectEntries()
|
||||
config_protect = set(_protect)
|
||||
config_protect |= set(misc_data['configprotect'])
|
||||
config_protect = [etpConst['systemroot']+x for x in config_protect]
|
||||
|
||||
Reference in New Issue
Block a user