Fixed blacklist

This commit is contained in:
Dimitris Zlatanidis 2022-06-01 23:41:59 +03:00
parent a62fef31d3
commit 1531b7d6dc
9 changed files with 21 additions and 17 deletions

View file

@ -35,7 +35,7 @@ class Dependencies:
""" """
def __init__(self, repo): def __init__(self, repo):
self.repo = repo self.repo = repo
self.black = BlackList().get_black() self.black = BlackList().get()
self.dep_results = [] self.dep_results = []
self.meta = _meta_ self.meta = _meta_

View file

@ -48,7 +48,7 @@ from slpkg.binary.repo_init import RepoInit
from slpkg.binary.dependency import Dependencies from slpkg.binary.dependency import Dependencies
class BinaryInstall(BlackList, Utils): class BinaryInstall(Utils):
"""Installs binaries packages with all dependencies from """Installs binaries packages with all dependencies from
repository repository
""" """
@ -83,7 +83,7 @@ class BinaryInstall(BlackList, Utils):
for name in self.data[0]: for name in self.data[0]:
self.repo_pkg_names.append(split_package(name)[0]) self.repo_pkg_names.append(split_package(name)[0])
self.blacklist = list(self.get_black()) self.blacklist = BlackList().get()
self.matching = False self.matching = False
def init_flags(self): def init_flags(self):

View file

@ -37,7 +37,7 @@ def search_pkg(name, repo):
text = utils.read_file(_meta_.lib_path + f"{repo}_repo/PACKAGES.TXT") text = utils.read_file(_meta_.lib_path + f"{repo}_repo/PACKAGES.TXT")
PACKAGES_TXT = list(utils.package_name(text)) PACKAGES_TXT = list(utils.package_name(text))
blacklist = list(black.get_black()) blacklist = black.get()
if name in PACKAGES_TXT and name not in blacklist: if name in PACKAGES_TXT and name not in blacklist:
return name return name

View file

@ -66,13 +66,14 @@ from slpkg.binary.check import pkg_upgrade
from slpkg.binary.install import BinaryInstall from slpkg.binary.install import BinaryInstall
class ArgParse(BlackList): class ArgParse:
def __init__(self, args): def __init__(self, args):
super().__init__() super().__init__()
self.args = args self.args = args
self.meta = _meta_ self.meta = _meta_
self.msg = Msg() self.msg = Msg()
self.blacklist = BlackList().get()
self.commands = [ self.commands = [
"update", "update",
"upgrade", "upgrade",
@ -584,7 +585,7 @@ class ArgParse(BlackList):
elif (len(self.args) == 2 and self.args[0] in options and elif (len(self.args) == 2 and self.args[0] in options and
flag[1] in self.args): flag[1] in self.args):
self.args.remove(flag[1]) self.args.remove(flag[1])
self.black_remove(list(self.get_black())) self.black_remove(self.blacklist)
elif (len(self.args) > 2 and self.args[0] in options and elif (len(self.args) > 2 and self.args[0] in options and
flag[1] in self.args): flag[1] in self.args):

View file

@ -42,7 +42,7 @@ def sbo_upgrade(skip, flag):
msg.checking() msg.checking()
upgrade_names = [] upgrade_names = []
data = SboQuery(name="").names() data = SboQuery(name="").names()
blacklist = list(black.get_black()) blacklist = black.get()
for pkg in sbo_list(): for pkg in sbo_list():
name = split_package(pkg)[0] name = split_package(pkg)[0]

View file

@ -48,7 +48,7 @@ from slpkg.sbo.slack_find import slack_package
from slpkg.slack.slack_version import slack_ver from slpkg.slack.slack_version import slack_ver
class SBoNetwork(BlackList, Utils): class SBoNetwork(Utils):
"""View SBo site in the terminal and also read, build or """View SBo site in the terminal and also read, build or
install packages install packages
""" """
@ -103,7 +103,7 @@ class SBoNetwork(BlackList, Utils):
"""View SlackBuild package, read or install them """View SlackBuild package, read or install them
from slackbuilds.org from slackbuilds.org
""" """
if self.sbo_url and self.name not in self.get_black(): if self.sbo_url and self.name not in BlackList().get():
self.prgnam = f"{self.name}-{self.sbo_version}" self.prgnam = f"{self.name}-{self.sbo_version}"
self.view_sbo() self.view_sbo()

View file

@ -47,7 +47,7 @@ from slpkg.sbo.dependencies import Requires
from slpkg.sbo.slack_find import slack_package from slpkg.sbo.slack_find import slack_package
class SBoInstall(BlackList, Utils): class SBoInstall(Utils):
"""Build and install SBo packages with all dependencies """Build and install SBo packages with all dependencies
""" """
def __init__(self, slackbuilds, flag): def __init__(self, slackbuilds, flag):
@ -80,7 +80,7 @@ class SBoInstall(BlackList, Utils):
self.count_uni = 0 self.count_uni = 0
self.msg.reading() self.msg.reading()
self.data = SboQuery(name="").names() self.data = SboQuery(name="").names()
self.blacklist = list(self.get()) self.blacklist = BlackList().get()
def init_flags(self): def init_flags(self):
"""Flags initialization """Flags initialization

View file

@ -52,7 +52,7 @@ from slpkg.slack.mirrors import mirrors
from slpkg.slack.slack_version import slack_ver from slpkg.slack.slack_version import slack_ver
class Patches(BlackList, Utils): class Patches(Utils):
"""Upgrades distribution from the official Slackware mirrors """Upgrades distribution from the official Slackware mirrors
""" """
def __init__(self, skip, flag): def __init__(self, skip, flag):
@ -78,6 +78,7 @@ class Patches(BlackList, Utils):
self.comp_sum = [] self.comp_sum = []
self.uncomp_sum = [] self.uncomp_sum = []
self.msg.checking() self.msg.checking()
self.blacklist = BlackList().get()
if self.version == "stable": if self.version == "stable":
self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT",
@ -153,7 +154,7 @@ class Patches(BlackList, Utils):
"""Stores and returns packages for upgrading """Stores and returns packages for upgrading
""" """
data = repo_data(self.PACKAGES_TXT, "slack", self.flag) data = repo_data(self.PACKAGES_TXT, "slack", self.flag)
black = list(self.get_black())
for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]): for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]):
repo_pkg_name = split_package(name)[0] repo_pkg_name = split_package(name)[0]
@ -162,7 +163,7 @@ class Patches(BlackList, Utils):
pkg_ver = split_package(name)[1] pkg_ver = split_package(name)[1]
if (GetFromInstalled(pkg_name).name() and if (GetFromInstalled(pkg_name).name() and
repo_pkg_name not in black and repo_pkg_name not in self.blacklist and
repo_pkg_name not in self.skip and repo_pkg_name not in self.skip and
parse_version(pkg_ver) > parse_version( parse_version(pkg_ver) > parse_version(
GetFromInstalled(pkg_name).version())): GetFromInstalled(pkg_name).version())):
@ -178,7 +179,7 @@ class Patches(BlackList, Utils):
self.count_upg -= 1 self.count_upg -= 1
elif (not os.path.isfile(self.meta.pkg_path + name[:-4]) and elif (not os.path.isfile(self.meta.pkg_path + name[:-4]) and
repo_pkg_name not in black and repo_pkg_name not in self.blacklist and
repo_pkg_name not in self.skip): repo_pkg_name not in self.skip):
self.dwn_links.append(f"{mirrors('', '')}{loc}/{name}") self.dwn_links.append(f"{mirrors('', '')}{loc}/{name}")
self.comp_sum.append(comp) self.comp_sum.append(comp)

View file

@ -37,12 +37,13 @@ from slpkg.binary.search import search_pkg
from slpkg.binary.dependency import Dependencies from slpkg.binary.dependency import Dependencies
class TrackingDeps(BlackList): class TrackingDeps:
"""Views tree of dependencies and also """Views tree of dependencies and also
highlights packages with the colour green highlights packages with the colour green
if already installed and the colour red if already installed and the colour red
if not installed. if not installed.
""" """
def __init__(self, name, repo, flag): def __init__(self, name, repo, flag):
super().__init__() super().__init__()
self.name = name self.name = name
@ -57,6 +58,7 @@ class TrackingDeps(BlackList):
self.endc = self.meta.color["ENDC"] self.endc = self.meta.color["ENDC"]
self.requires = [] self.requires = []
self.deps_dict = {} self.deps_dict = {}
self.blacklist = BlackList()
self.init_flags() self.init_flags()
def init_flags(self): def init_flags(self):
@ -156,7 +158,7 @@ class TrackingDeps(BlackList):
self.find_pkg = search_pkg(self.name, self.repo) self.find_pkg = search_pkg(self.name, self.repo)
if self.find_pkg: if self.find_pkg:
self.black = list(self.get_black()) self.black = list(self.blacklist.get())
self.dependencies = Dependencies( self.dependencies = Dependencies(
self.repo, self.black).binary(self.name, self.flag) self.repo, self.black).binary(self.name, self.flag)