diff --git a/ChangeLog.txt b/ChangeLog.txt index 40f86511..06f10479 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -5,6 +5,7 @@ Fixed: Updated: - Removed status progress bar - Setup and installing +- Managed blacklit in the simple way 3.8.0 - 05/02/2020 Added: diff --git a/EXAMPLES.md b/EXAMPLES.md index b8181bd1..04c0797b 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -1202,14 +1202,7 @@ Packages in blacklist: live555 faac -Note: you can use asterisk "*" to match more packages like: -*lib* \\ Add all packages inlcude string "lib" -*lib \\ Add all packages ends with string "lib" -lib* \\ Add all packages starts with string "lib" - -multi:*multilib* \\ Add all packages include string "multilib" from "multi" - \\ repository. ``` Print a package description: diff --git a/slpkg/binary/install.py b/slpkg/binary/install.py index c85a58ac..9852d432 100644 --- a/slpkg/binary/install.py +++ b/slpkg/binary/install.py @@ -79,7 +79,7 @@ class BinaryInstall: self.repo_pkg_names = [] for name in self.data[0]: self.repo_pkg_names.append(split_package(name)[0]) - self.blacklist = BlackList().packages(self.data[0], self.repo) + self.blacklist = BlackList().get_black() self.matching = False def init_flags(self): diff --git a/slpkg/binary/search.py b/slpkg/binary/search.py index 548c8565..4aa548d5 100644 --- a/slpkg/binary/search.py +++ b/slpkg/binary/search.py @@ -33,6 +33,6 @@ def search_pkg(name, repo): """ PACKAGES_TXT = Utils().read_file(_meta_.lib_path + f"{repo}_repo/PACKAGES.TXT") names = list(Utils().package_name(PACKAGES_TXT)) - blacklist = BlackList().packages(pkgs=names, repo=repo) + blacklist = BlackList().get_black() if name in names and name not in blacklist: return name \ No newline at end of file diff --git a/slpkg/blacklist.py b/slpkg/blacklist.py index 284a9221..0bc45868 100644 --- a/slpkg/blacklist.py +++ b/slpkg/blacklist.py @@ -25,7 +25,6 @@ import os from slpkg.utils import Utils -from slpkg.splitting import split_package from slpkg.__metadata__ import MetaData as _meta_ @@ -90,54 +89,4 @@ class BlackList: print(f"{self.red}{line}{self.endc}") self.quit = True if self.quit: - print() # new line at exit - - def packages(self, pkgs, repo): - """Return packages in blacklist or by repository - """ - self.black = [] - for bl in self.get_black(): - pr = bl.split(":") - for pkg in pkgs: - self.__priority(pr, repo, pkg) - self.__blackpkg(bl, repo, pkg) - return self.black - - def __add(self, repo, pkg): - """Split packages by repository - """ - if repo == "sbo": - return pkg - else: - return split_package(pkg)[0] - - def __priority(self, pr, repo, pkg): - """Add packages in blacklist by priority - """ - if (pr[0] == repo and pr[1].startswith("*") and - pr[1].endswith("*")): - if pr[1][1:-1] in pkg: - self.black.append(self.__add(repo, pkg)) - elif pr[0] == repo and pr[1].endswith("*"): - if pkg.startswith(pr[1][:-1]): - self.black.append(self.__add(repo, pkg)) - elif pr[0] == repo and pr[1].startswith("*"): - if pkg.endswith(pr[1][1:]): - self.black.append(self.__add(repo, pkg)) - elif pr[0] == repo and "*" not in pr[1]: - self.black.append(self.__add(repo, pkg)) - - def __blackpkg(self, bl, repo, pkg): - """Add packages in blacklist - """ - if bl.startswith("*") and bl.endswith("*"): - if bl[1:-1] in pkg: - self.black.append(self.__add(repo, pkg)) - elif bl.endswith("*"): - if pkg.startswith(bl[:-1]): - self.black.append(self.__add(repo, pkg)) - elif bl.startswith("*"): - if pkg.endswith(bl[1:]): - self.black.append(self.__add(repo, pkg)) - if bl not in self.black and "*" not in bl: - self.black.append(bl) + print() # new line at exit \ No newline at end of file diff --git a/slpkg/pkg/find.py b/slpkg/pkg/find.py index 3133257b..8dffd840 100644 --- a/slpkg/pkg/find.py +++ b/slpkg/pkg/find.py @@ -32,7 +32,7 @@ def searching(find_pkg, directory): """ if os.path.isdir(directory): installed = os.listdir(directory) - blacklist = BlackList().packages(pkgs=installed, repo="local") + blacklist = BlackList().get_black() if os.path.exists(directory): for pkg in installed: if (not pkg.startswith(".") and pkg.startswith(find_pkg) and diff --git a/slpkg/sbo/check.py b/slpkg/sbo/check.py index 37688e36..3f84a33d 100644 --- a/slpkg/sbo/check.py +++ b/slpkg/sbo/check.py @@ -40,7 +40,7 @@ def sbo_upgrade(skip, flag): Msg().checking() upgrade_names = [] data = SBoGrep(name="").names() - blacklist = BlackList().packages(pkgs=data, repo="sbo") + blacklist = BlackList().get_black() for pkg in sbo_list(): name = split_package(pkg)[0] ver = split_package(pkg)[1] diff --git a/slpkg/sbo/dependency.py b/slpkg/sbo/dependency.py index e996a08f..c06a14e4 100644 --- a/slpkg/sbo/dependency.py +++ b/slpkg/sbo/dependency.py @@ -37,8 +37,7 @@ class Requires: self.flag = flag self.meta = _meta_ self.SLACKBUILDS_TXT = SBoGrep(name="").names() - self.blacklist = BlackList().packages(pkgs=self.SLACKBUILDS_TXT, - repo="sbo") + self.blacklist = BlackList().get_black() self.dep_results = [] def sbo(self, name): diff --git a/slpkg/sbo/network.py b/slpkg/sbo/network.py index 411b8580..75385c1f 100644 --- a/slpkg/sbo/network.py +++ b/slpkg/sbo/network.py @@ -76,7 +76,7 @@ class SBoNetwork: self.with_checklist() grep = SBoGrep(self.name) self.sbo_files = grep.files() - self.blacklist = BlackList().packages(pkgs=self.data, repo="sbo") + self.blacklist = BlackList().get_black() self.sbo_url = sbo_search_pkg(self.name) if self.sbo_url: self.sbo_desc = grep.description()[len(self.name) + 2:-1] diff --git a/slpkg/sbo/slackbuild.py b/slpkg/sbo/slackbuild.py index 7e862a92..0e887f84 100644 --- a/slpkg/sbo/slackbuild.py +++ b/slpkg/sbo/slackbuild.py @@ -80,7 +80,7 @@ class SBoInstall: self.count_uni = 0 self.msg.reading() self.data = SBoGrep(name="").names() - self.blacklist = BlackList().packages(pkgs=self.data, repo="sbo") + self.blacklist = BlackList().get_black() def init_flags(self): """Flags initialization diff --git a/slpkg/slack/patches.py b/slpkg/slack/patches.py index f2850673..fe3d959d 100644 --- a/slpkg/slack/patches.py +++ b/slpkg/slack/patches.py @@ -135,7 +135,7 @@ class Patches: Store and return packages for upgrading """ data = repo_data(self.PACKAGES_TXT, "slack", self.flag) - black = BlackList().packages(pkgs=data[0], repo="slack") + black = BlackList().get_black() for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]): repo_pkg_name = split_package(name)[0] if (not os.path.isfile(self.meta.pkg_path + name[:-4]) and diff --git a/slpkg/tracking.py b/slpkg/tracking.py index 6457ba8a..414daf39 100644 --- a/slpkg/tracking.py +++ b/slpkg/tracking.py @@ -129,7 +129,7 @@ class TrackingDeps: self.bin_case_insensitive() self.find_pkg = search_pkg(self.name, self.repo) if self.find_pkg: - self.black = BlackList().packages(self.names, self.repo) + self.black = BlackList().get_black() self.dependencies_list = Dependencies( self.repo, self.black).binary(self.name, self.flag)