Fix avoid add null packages

This commit is contained in:
Dimitris Zlatanidis 2015-06-25 06:07:01 +03:00
parent 51e8a40162
commit 11853cebf7

View file

@ -101,42 +101,34 @@ class BlackList(object):
# blacklist packages by repository priority
if (pr[0] == repo and pr[1].startswith("*") and
pr[1].endswith("*")):
black.append(self.__add(1, repo, pkg, pr[1][1:-1]))
if pr[1][1:-1] in pkg:
black.append(self.__add(repo, pkg))
elif pr[0] == repo and pr[1].endswith("*"):
black.append(self.__add(2, repo, pkg, pr[1][:-1]))
if pkg.startswith(pr[1][:-1]):
black.append(self.__add(repo, pkg))
elif pr[0] == repo and pr[1].startswith("*"):
black.append(self.__add(3, repo, pkg, pr[1][1:]))
if pkg.endswith(pr[1][1:]):
black.append(self.__add(repo, pkg))
elif pr[0] == repo and "*" not in pr[1]:
if repo == "sbo":
black.append(pr[1])
else:
black.append(split_package(pkg)[0])
black.append(self.__add(repo, pkg))
# normal blacklist packages
if bl.startswith("*") and bl.endswith("*"):
black.append(self.__add(1, repo, pkg, bl[1:-1]))
if bl[1:-1] in pkg:
black.append(self.__add(repo, pkg))
elif bl.endswith("*"):
black.append(self.__add(2, repo, pkg, bl[:-1]))
if pkg.startswith(bl[:-1]):
black.append(self.__add(repo, pkg))
elif bl.startswith("*"):
black.append(self.__add(3, repo, pkg, bl[1:]))
if pkg.endswith(bl[1:]):
black.append(self.__add(repo, pkg))
if bl not in black and "*" not in bl:
black.append(bl)
return black
def __add(self, mode, repo, pkg, bl):
def __add(self, repo, pkg):
"""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]
if repo == "sbo":
return pkg
else:
return split_package(pkg)[0]