multilib: Remove FileMultilibMethod class

In order to do something meaningful, the class needs to be instantiated
with arguments pointing the blacklist and whitelist.

The `file` multilib method used via `pungi-koji` or `pungi` directly has
no way to pass those in.

The only way this class can be useful would be if someone actually
imported the class directly in their own code. Pungi is not meant to be
used as a library though, so this is not really a supported use case.

Not to mention that the `select` method always returned `False`.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2017-02-10 12:29:21 +01:00
parent c3cf09a2f7
commit e00776a413
2 changed files with 1 additions and 30 deletions

View File

@ -547,7 +547,6 @@ Options
* ``none``
* ``all``
* ``runtime``
* ``file``
* ``kernel``
* ``yaboot``

View File

@ -185,34 +185,6 @@ class RuntimeMultilibMethod(MultilibMethodBase):
return False
class FileMultilibMethod(MultilibMethodBase):
"""explicitely defined whitelist and blacklist"""
name = "file"
def __init__(self, *args, **kwargs):
super(FileMultilibMethod, self).__init__(*args, **kwargs)
whitelist = kwargs.pop("whitelist", None)
blacklist = kwargs.pop("blacklist", None)
self.whitelist = self.read_file(whitelist)
self.blacklist = self.read_file(blacklist)
@staticmethod
def read_file(path):
if not path:
return []
result = [ i.strip() for i in open(path, "r") if not i.strip().startswith("#") ]
return result
def select(self, po):
for pattern in self.blacklist:
if fnmatch.fnmatch(po.name, pattern):
return False
for pattern in self.whitelist:
if fnmatch.fnmatch(po.name, pattern):
return False
return False
class KernelMultilibMethod(MultilibMethodBase):
"""kernel and kernel-devel"""
name = "kernel"
@ -282,7 +254,7 @@ def init(config_path="/usr/share/pungi/multilib/"):
if not config_path.endswith("/"):
config_path += "/"
for cls in (AllMultilibMethod, DevelMultilibMethod, FileMultilibMethod, KernelMultilibMethod,
for cls in (AllMultilibMethod, DevelMultilibMethod, KernelMultilibMethod,
NoneMultilibMethod, RuntimeMultilibMethod, YabootMultilibMethod):
method = cls(config_path)
METHOD_MAP[method.name] = method