Added blacklist multi packages

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2020-02-16 14:29:11 +01:00
parent e227d0cd46
commit fa0cca538e
5 changed files with 30 additions and 6 deletions

View file

@ -4,6 +4,8 @@ Fixed:
- msb repository PACKAGES.txt file
BugFix:
- Upgrade distribution with option -c, --check
Added:
- Managing multi packages in blacklist file
3.8.1 - 13/02/2020
Fixed:

View file

@ -1175,8 +1175,7 @@ $ slpkg -q install (install packages from queue)
$ slpkg -q build-install (build and install)
```
Add or remove the packages in blacklist file manually from '`/etc/slpkg/blacklist`' or
with the following options:
Add or remove packages in blacklist file manually from the '`/etc/slpkg/blacklist`' file or with the following options:
```
$ slpkg -b live555 speex faac --add

View file

@ -10,6 +10,9 @@
# To blacklist the package 'wicd-1.7.2.4-x86_64-4.txz' the line will be:
# wicd
#
# To blacklist packages that start with name add * the end of the name:
# kernel*
#
#
# Sometimes the automatic kernel update creates problems because you
# may need to file intervention 'lilo'. The slpkg automatically detects

View file

@ -25,6 +25,7 @@
import os
from slpkg.utils import Utils
from slpkg.splitting import split_package
from slpkg.__metadata__ import MetaData as _meta_
@ -43,12 +44,30 @@ class BlackList:
def get_black(self):
"""Return blacklist packages from /etc/slpkg/blacklist
configuration file."""
blacklist = []
blacklist = list(self.black_filter())
lenght = len(blacklist)
installed = os.listdir("/var/log/packages/")
for b in blacklist:
if b.endswith("*"):
for i in installed:
if i.startswith(b[:-1]):
blacklist.append(split_package(i)[0])
# Cleaning the first packages that contain * in the end
# of the package name
blacklist = blacklist[lenght:]
return blacklist
def black_filter(self):
"""Return all the installed files that start
by the name*
"""
for read in self.black_conf.splitlines():
read = read.lstrip()
if not read.startswith("#"):
blacklist.append(read.replace("\n", ""))
return blacklist
yield read.replace("\n", "")
def listed(self):
"""Print blacklist packages

View file

@ -133,7 +133,8 @@ class Patches:
"""Store and return packages for upgrading
"""
data = repo_data(self.PACKAGES_TXT, "slack", self.flag)
black = BlackList().get_black()
b = BlackList()
black = b.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