mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-29 20:34:22 +01:00
Update blacklist options
This commit is contained in:
parent
15baa7b7be
commit
78e9ecda3b
5 changed files with 48 additions and 19 deletions
|
@ -2,14 +2,18 @@
|
||||||
# installed be upgraded be find or deleted.
|
# installed be upgraded be find or deleted.
|
||||||
# NOTE: The settings here affect all repositories.
|
# NOTE: The settings here affect all repositories.
|
||||||
#
|
#
|
||||||
# An example syntax is as follows:
|
# To blacklist the package 'wicd-1.7.2.4-x86_64-4.txz' the line will be:
|
||||||
# add a package from SBo repository:
|
|
||||||
# brasero
|
|
||||||
#
|
|
||||||
# Add package from slackware repository:
|
|
||||||
# example add package 'wicd-1.7.2.4-x86_64-4.txz':
|
|
||||||
# wicd
|
# wicd
|
||||||
#
|
#
|
||||||
|
# This one will blacklist all packages include string "lib" in package name:
|
||||||
|
# *lib*
|
||||||
|
#
|
||||||
|
# Exclude packages with repository priority:
|
||||||
|
# sbo:py* `excluded all packages from sbo starts with 'py'`
|
||||||
|
# sbo:jdk `excluded jdk package from sbo repository`
|
||||||
|
# slack:*multi* `excluded packages include string 'multi' from slack`
|
||||||
|
# msb:*.txz `excluded packages ends with '.txz' from msb repository`
|
||||||
|
#
|
||||||
# Sometimes the automatic kernel update creates problems because you
|
# Sometimes the automatic kernel update creates problems because you
|
||||||
# may need to file intervention 'lilo'. The slpkg automatically detects
|
# may need to file intervention 'lilo'. The slpkg automatically detects
|
||||||
# if the core has been upgraded and running 'lilo'. If you want to avoid
|
# if the core has been upgraded and running 'lilo'. If you want to avoid
|
||||||
|
|
|
@ -27,6 +27,7 @@ from distutils.version import LooseVersion
|
||||||
|
|
||||||
from slpkg.messages import Msg
|
from slpkg.messages import Msg
|
||||||
from slpkg.toolbar import status
|
from slpkg.toolbar import status
|
||||||
|
from slpkg.blacklist import BlackList
|
||||||
from slpkg.splitting import split_package
|
from slpkg.splitting import split_package
|
||||||
from slpkg.__metadata__ import MetaData as _meta_
|
from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
@ -49,6 +50,7 @@ def pkg_upgrade(repo, skip):
|
||||||
# size = data[2]
|
# size = data[2]
|
||||||
# unsize = data[3]
|
# unsize = data[3]
|
||||||
data = repo_data(PACKAGES_TXT, 2000, repo, flag="")
|
data = repo_data(PACKAGES_TXT, 2000, repo, flag="")
|
||||||
|
blacklist = BlackList().packages(data[0], repo)
|
||||||
index, toolbar_width = 0, 1000
|
index, toolbar_width = 0, 1000
|
||||||
for pkg in installed():
|
for pkg in installed():
|
||||||
index += 1
|
index += 1
|
||||||
|
@ -60,6 +62,7 @@ def pkg_upgrade(repo, skip):
|
||||||
if (repo_pkg[0] == inst_pkg[0] and
|
if (repo_pkg[0] == inst_pkg[0] and
|
||||||
LooseVersion(repo_pkg[1]) > LooseVersion(inst_pkg[1]) and
|
LooseVersion(repo_pkg[1]) > LooseVersion(inst_pkg[1]) and
|
||||||
repo_pkg[3] >= inst_pkg[3] and
|
repo_pkg[3] >= inst_pkg[3] and
|
||||||
|
inst_pkg[0] not in blacklist and
|
||||||
inst_pkg[0] not in skip):
|
inst_pkg[0] not in skip):
|
||||||
pkgs_for_upgrade.append(repo_pkg[0])
|
pkgs_for_upgrade.append(repo_pkg[0])
|
||||||
Msg().done()
|
Msg().done()
|
||||||
|
|
|
@ -255,22 +255,23 @@ class BinaryInstall(object):
|
||||||
# size = data[2]
|
# size = data[2]
|
||||||
# unsize = data[3]
|
# unsize = data[3]
|
||||||
for pkg in packages:
|
for pkg in packages:
|
||||||
for name, loc, comp, uncomp in zip(self.data[0], self.data[1],
|
for pk, loc, comp, uncomp in zip(self.data[0], self.data[1],
|
||||||
self.data[2], self.data[3]):
|
self.data[2], self.data[3]):
|
||||||
if (name and name.startswith(pkg + self.meta.sp) and
|
if (pk and pk.startswith(pkg + self.meta.sp) and
|
||||||
name not in install and pkg not in self.blacklist):
|
pk not in install and
|
||||||
dwn.append("{0}{1}/{2}".format(self.mirror, loc, name))
|
split_package(pk)[0] not in self.blacklist):
|
||||||
install.append(name)
|
dwn.append("{0}{1}/{2}".format(self.mirror, loc, pk))
|
||||||
|
install.append(pk)
|
||||||
comp_sum.append(comp)
|
comp_sum.append(comp)
|
||||||
uncomp_sum.append(uncomp)
|
uncomp_sum.append(uncomp)
|
||||||
if not install:
|
if not install:
|
||||||
for pkg in packages:
|
for pkg in packages:
|
||||||
for name, loc, comp, uncomp in zip(self.data[0], self.data[1],
|
for pk, loc, comp, uncomp in zip(self.data[0], self.data[1],
|
||||||
self.data[2], self.data[3]):
|
self.data[2], self.data[3]):
|
||||||
if (name and pkg in split_package(name)[0] and
|
name = split_package(pk)[0]
|
||||||
pkg not in self.blacklist):
|
if (pk and pkg in name and name not in self.blacklist):
|
||||||
dwn.append("{0}{1}/{2}".format(self.mirror, loc, name))
|
dwn.append("{0}{1}/{2}".format(self.mirror, loc, pk))
|
||||||
install.append(name)
|
install.append(pk)
|
||||||
comp_sum.append(comp)
|
comp_sum.append(comp)
|
||||||
uncomp_sum.append(uncomp)
|
uncomp_sum.append(uncomp)
|
||||||
dwn.reverse()
|
dwn.reverse()
|
||||||
|
|
|
@ -98,6 +98,7 @@ class BlackList(object):
|
||||||
for bl in self.get_black():
|
for bl in self.get_black():
|
||||||
pr = bl.split(":")
|
pr = bl.split(":")
|
||||||
for pkg in pkgs:
|
for pkg in pkgs:
|
||||||
|
# blacklist packages by repository priority
|
||||||
if (pr[0] == repo and pr[1].startswith("*") and
|
if (pr[0] == repo and pr[1].startswith("*") and
|
||||||
pr[1].endswith("*")):
|
pr[1].endswith("*")):
|
||||||
if repo == "sbo" and pr[1][1:-1] in pkg:
|
if repo == "sbo" and pr[1][1:-1] in pkg:
|
||||||
|
@ -109,6 +110,17 @@ class BlackList(object):
|
||||||
black.append(pkg)
|
black.append(pkg)
|
||||||
elif pkg.startswith(pr[1][:-1]):
|
elif pkg.startswith(pr[1][:-1]):
|
||||||
black.append(split_package(pkg)[0])
|
black.append(split_package(pkg)[0])
|
||||||
|
elif pr[0] == repo and pr[1].startswith("*"):
|
||||||
|
if repo == "sbo" and pkg.endswith(pr[1][1:]):
|
||||||
|
black.append(pkg)
|
||||||
|
elif pkg.endswith(pr[1][1:]):
|
||||||
|
black.append(split_package(pkg)[0])
|
||||||
|
elif pr[0] == repo and "*" not in pr[1]:
|
||||||
|
if repo == "sbo":
|
||||||
|
black.append(pr[1])
|
||||||
|
else:
|
||||||
|
black.append(split_package(pkg)[0])
|
||||||
|
# normal blacklist packages
|
||||||
if bl.startswith("*") and bl.endswith("*"):
|
if bl.startswith("*") and bl.endswith("*"):
|
||||||
if repo == "sbo" and bl[1:-1] in pkg:
|
if repo == "sbo" and bl[1:-1] in pkg:
|
||||||
black.append(pkg)
|
black.append(pkg)
|
||||||
|
@ -119,6 +131,11 @@ class BlackList(object):
|
||||||
black.append(pkg)
|
black.append(pkg)
|
||||||
elif pkg.startswith(bl[:-1]):
|
elif pkg.startswith(bl[:-1]):
|
||||||
black.append(split_package(pkg)[0])
|
black.append(split_package(pkg)[0])
|
||||||
|
elif bl.startswith("*"):
|
||||||
|
if repo == "sbo" and pkg.endswith(bl[1:]):
|
||||||
|
black.append(pkg)
|
||||||
|
elif pkg.endswith(bl[1:]):
|
||||||
|
black.append(split_package(pkg)[0])
|
||||||
if bl not in black and "*" not in bl:
|
if bl not in black and "*" not in bl:
|
||||||
black.append(bl)
|
black.append(bl)
|
||||||
return black
|
return black
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from slpkg.blacklist import BlackList
|
||||||
|
from slpkg.splitting import split_package
|
||||||
|
|
||||||
|
|
||||||
def find_package(find_pkg, directory):
|
def find_package(find_pkg, directory):
|
||||||
|
@ -31,8 +33,10 @@ def find_package(find_pkg, directory):
|
||||||
"""
|
"""
|
||||||
pkgs = []
|
pkgs = []
|
||||||
installed = sorted(os.listdir(directory))
|
installed = sorted(os.listdir(directory))
|
||||||
|
blacklist = BlackList().packages(pkgs=installed, repo="local")
|
||||||
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):
|
if (not pkg.startswith(".") and pkg.startswith(find_pkg) and
|
||||||
|
split_package(pkg)[0] not in blacklist):
|
||||||
pkgs.append(pkg)
|
pkgs.append(pkg)
|
||||||
return pkgs
|
return pkgs
|
||||||
|
|
Loading…
Add table
Reference in a new issue