mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-18 10:26:29 +01:00
Updated managed blacklist
Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
parent
b74569bd02
commit
2bcaab8f18
12 changed files with 11 additions and 69 deletions
|
@ -5,6 +5,7 @@ Fixed:
|
||||||
Updated:
|
Updated:
|
||||||
- Removed status progress bar
|
- Removed status progress bar
|
||||||
- Setup and installing
|
- Setup and installing
|
||||||
|
- Managed blacklit in the simple way
|
||||||
|
|
||||||
3.8.0 - 05/02/2020
|
3.8.0 - 05/02/2020
|
||||||
Added:
|
Added:
|
||||||
|
|
|
@ -1202,14 +1202,7 @@ Packages in blacklist:
|
||||||
live555
|
live555
|
||||||
faac
|
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:
|
Print a package description:
|
||||||
|
|
|
@ -79,7 +79,7 @@ class BinaryInstall:
|
||||||
self.repo_pkg_names = []
|
self.repo_pkg_names = []
|
||||||
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 = BlackList().packages(self.data[0], self.repo)
|
self.blacklist = BlackList().get_black()
|
||||||
self.matching = False
|
self.matching = False
|
||||||
|
|
||||||
def init_flags(self):
|
def init_flags(self):
|
||||||
|
|
|
@ -33,6 +33,6 @@ def search_pkg(name, repo):
|
||||||
"""
|
"""
|
||||||
PACKAGES_TXT = Utils().read_file(_meta_.lib_path + f"{repo}_repo/PACKAGES.TXT")
|
PACKAGES_TXT = Utils().read_file(_meta_.lib_path + f"{repo}_repo/PACKAGES.TXT")
|
||||||
names = list(Utils().package_name(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:
|
if name in names and name not in blacklist:
|
||||||
return name
|
return name
|
|
@ -25,7 +25,6 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from slpkg.utils import Utils
|
from slpkg.utils import Utils
|
||||||
from slpkg.splitting import split_package
|
|
||||||
from slpkg.__metadata__ import MetaData as _meta_
|
from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,54 +89,4 @@ class BlackList:
|
||||||
print(f"{self.red}{line}{self.endc}")
|
print(f"{self.red}{line}{self.endc}")
|
||||||
self.quit = True
|
self.quit = True
|
||||||
if self.quit:
|
if self.quit:
|
||||||
print() # new line at exit
|
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)
|
|
|
@ -32,7 +32,7 @@ def searching(find_pkg, directory):
|
||||||
"""
|
"""
|
||||||
if os.path.isdir(directory):
|
if os.path.isdir(directory):
|
||||||
installed = os.listdir(directory)
|
installed = os.listdir(directory)
|
||||||
blacklist = BlackList().packages(pkgs=installed, repo="local")
|
blacklist = BlackList().get_black()
|
||||||
if os.path.exists(directory):
|
if os.path.exists(directory):
|
||||||
for pkg in installed:
|
for pkg in installed:
|
||||||
if (not pkg.startswith(".") and pkg.startswith(find_pkg) and
|
if (not pkg.startswith(".") and pkg.startswith(find_pkg) and
|
||||||
|
|
|
@ -40,7 +40,7 @@ def sbo_upgrade(skip, flag):
|
||||||
Msg().checking()
|
Msg().checking()
|
||||||
upgrade_names = []
|
upgrade_names = []
|
||||||
data = SBoGrep(name="").names()
|
data = SBoGrep(name="").names()
|
||||||
blacklist = BlackList().packages(pkgs=data, repo="sbo")
|
blacklist = BlackList().get_black()
|
||||||
for pkg in sbo_list():
|
for pkg in sbo_list():
|
||||||
name = split_package(pkg)[0]
|
name = split_package(pkg)[0]
|
||||||
ver = split_package(pkg)[1]
|
ver = split_package(pkg)[1]
|
||||||
|
|
|
@ -37,8 +37,7 @@ class Requires:
|
||||||
self.flag = flag
|
self.flag = flag
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
self.SLACKBUILDS_TXT = SBoGrep(name="").names()
|
self.SLACKBUILDS_TXT = SBoGrep(name="").names()
|
||||||
self.blacklist = BlackList().packages(pkgs=self.SLACKBUILDS_TXT,
|
self.blacklist = BlackList().get_black()
|
||||||
repo="sbo")
|
|
||||||
self.dep_results = []
|
self.dep_results = []
|
||||||
|
|
||||||
def sbo(self, name):
|
def sbo(self, name):
|
||||||
|
|
|
@ -76,7 +76,7 @@ class SBoNetwork:
|
||||||
self.with_checklist()
|
self.with_checklist()
|
||||||
grep = SBoGrep(self.name)
|
grep = SBoGrep(self.name)
|
||||||
self.sbo_files = grep.files()
|
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)
|
self.sbo_url = sbo_search_pkg(self.name)
|
||||||
if self.sbo_url:
|
if self.sbo_url:
|
||||||
self.sbo_desc = grep.description()[len(self.name) + 2:-1]
|
self.sbo_desc = grep.description()[len(self.name) + 2:-1]
|
||||||
|
|
|
@ -80,7 +80,7 @@ class SBoInstall:
|
||||||
self.count_uni = 0
|
self.count_uni = 0
|
||||||
self.msg.reading()
|
self.msg.reading()
|
||||||
self.data = SBoGrep(name="").names()
|
self.data = SBoGrep(name="").names()
|
||||||
self.blacklist = BlackList().packages(pkgs=self.data, repo="sbo")
|
self.blacklist = BlackList().get_black()
|
||||||
|
|
||||||
def init_flags(self):
|
def init_flags(self):
|
||||||
"""Flags initialization
|
"""Flags initialization
|
||||||
|
|
|
@ -135,7 +135,7 @@ class Patches:
|
||||||
Store and return packages for upgrading
|
Store and return packages for upgrading
|
||||||
"""
|
"""
|
||||||
data = repo_data(self.PACKAGES_TXT, "slack", self.flag)
|
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]):
|
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]
|
||||||
if (not os.path.isfile(self.meta.pkg_path + name[:-4]) and
|
if (not os.path.isfile(self.meta.pkg_path + name[:-4]) and
|
||||||
|
|
|
@ -129,7 +129,7 @@ class TrackingDeps:
|
||||||
self.bin_case_insensitive()
|
self.bin_case_insensitive()
|
||||||
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 = BlackList().packages(self.names, self.repo)
|
self.black = BlackList().get_black()
|
||||||
self.dependencies_list = Dependencies(
|
self.dependencies_list = Dependencies(
|
||||||
self.repo, self.black).binary(self.name, self.flag)
|
self.repo, self.black).binary(self.name, self.flag)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue