mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-02-10 20:48:40 +01:00
Improve blacklist
This commit is contained in:
parent
f84bef54a3
commit
51e8a40162
1 changed files with 25 additions and 24 deletions
|
@ -101,20 +101,11 @@ class BlackList(object):
|
||||||
# blacklist packages by repository priority
|
# blacklist packages by repository priority
|
||||||
if (pr[0] == repo and pr[1].startswith("*") and
|
if (pr[0] == repo and pr[1].startswith("*") and
|
||||||
pr[1].endswith("*")):
|
pr[1].endswith("*")):
|
||||||
if repo == "sbo" and pr[1][1:-1] in pkg:
|
black.append(self.__add(1, repo, pkg, pr[1][1:-1]))
|
||||||
black.append(pkg)
|
|
||||||
elif pr[1][1:-1] in pkg:
|
|
||||||
black.append(split_package(pkg)[0])
|
|
||||||
elif pr[0] == repo and pr[1].endswith("*"):
|
elif pr[0] == repo and pr[1].endswith("*"):
|
||||||
if repo == "sbo" and pkg.startswith(pr[1][:-1]):
|
black.append(self.__add(2, repo, pkg, pr[1][:-1]))
|
||||||
black.append(pkg)
|
|
||||||
elif pkg.startswith(pr[1][:-1]):
|
|
||||||
black.append(split_package(pkg)[0])
|
|
||||||
elif pr[0] == repo and pr[1].startswith("*"):
|
elif pr[0] == repo and pr[1].startswith("*"):
|
||||||
if repo == "sbo" and pkg.endswith(pr[1][1:]):
|
black.append(self.__add(3, repo, pkg, pr[1][1:]))
|
||||||
black.append(pkg)
|
|
||||||
elif pkg.endswith(pr[1][1:]):
|
|
||||||
black.append(split_package(pkg)[0])
|
|
||||||
elif pr[0] == repo and "*" not in pr[1]:
|
elif pr[0] == repo and "*" not in pr[1]:
|
||||||
if repo == "sbo":
|
if repo == "sbo":
|
||||||
black.append(pr[1])
|
black.append(pr[1])
|
||||||
|
@ -122,20 +113,30 @@ class BlackList(object):
|
||||||
black.append(split_package(pkg)[0])
|
black.append(split_package(pkg)[0])
|
||||||
# normal blacklist packages
|
# normal blacklist packages
|
||||||
if bl.startswith("*") and bl.endswith("*"):
|
if bl.startswith("*") and bl.endswith("*"):
|
||||||
if repo == "sbo" and bl[1:-1] in pkg:
|
black.append(self.__add(1, repo, pkg, bl[1:-1]))
|
||||||
black.append(pkg)
|
|
||||||
elif bl[1:-1] in pkg:
|
|
||||||
black.append(split_package(pkg)[0])
|
|
||||||
elif bl.endswith("*"):
|
elif bl.endswith("*"):
|
||||||
if repo == "sbo" and pkg.startswith(bl[:-1]):
|
black.append(self.__add(2, repo, pkg, bl[:-1]))
|
||||||
black.append(pkg)
|
|
||||||
elif pkg.startswith(bl[:-1]):
|
|
||||||
black.append(split_package(pkg)[0])
|
|
||||||
elif bl.startswith("*"):
|
elif bl.startswith("*"):
|
||||||
if repo == "sbo" and pkg.endswith(bl[1:]):
|
black.append(self.__add(3, repo, pkg, bl[1:]))
|
||||||
black.append(pkg)
|
|
||||||
elif pkg.endswith(bl[1:]):
|
|
||||||
black.append(split_package(pkg)[0])
|
|
||||||
if bl not in black and "*" not in bl:
|
if bl not in black and "*" not in bl:
|
||||||
black.append(bl)
|
black.append(bl)
|
||||||
return black
|
return black
|
||||||
|
|
||||||
|
def __add(self, mode, repo, pkg, bl):
|
||||||
|
"""Split packages by repository
|
||||||
|
"""
|
||||||
|
if mode == 1:
|
||||||
|
if repo == "sbo" and bl in pkg:
|
||||||
|
return pkg
|
||||||
|
elif bl in pkg:
|
||||||
|
return split_package(pkg)[0]
|
||||||
|
if mode == 2:
|
||||||
|
if repo == "sbo" and pkg.startswith(bl):
|
||||||
|
return pkg
|
||||||
|
elif pkg.startswith(bl):
|
||||||
|
return split_package(pkg)[0]
|
||||||
|
if mode == 3:
|
||||||
|
if repo == "sbo" and pkg.endswith(bl):
|
||||||
|
return pkg
|
||||||
|
elif pkg.endswith(bl):
|
||||||
|
return split_package(pkg)[0]
|
||||||
|
|
Loading…
Add table
Reference in a new issue