Added support special packages who need attention

This commit is contained in:
Dimitris Zlatanidis 2017-02-22 22:12:49 +02:00
parent 8afcc1fb4a
commit 7ff62d7ca7
7 changed files with 105 additions and 1 deletions

View file

@ -1,3 +1,11 @@
3.2.6 - 22/02/2017
Updated:
- Pattern for configuration file
Added:
- Support the special packages who need attention (OpenGL 32-Bits Libs after
upgrade #81) Thanks to Edward W. Koenig and Inukaze for the report
3.2.5 - 17/02/2017
Updated:
- Url for mles/mled repository (Thanks Kiki Novak for the report)

34
conf/pkg_security Normal file
View file

@ -0,0 +1,34 @@
# Security file:
#
# pkg_security file is part of slpkg.
#
# Copyright 2014-2017 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
#
# Slpkg is a user-friendly package manager for Slackware installations.
#
# https://github.com/dslackw/slpkg
#
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# END OF LEGAL NOTICE
#
# ----------------------------------------------------------------------------
# For some reasons some packages need extra management and attention before
# build, install or upgrade. So this list of packages will produce one warning
# message before action.
# You can add the packages you that believe need attention or please mention
# to me in the email dslackw@gmail.com
# ----------------------------------------------------------------------------
#
nvidia-kernel
nvidia-driver

View file

@ -126,7 +126,8 @@ if "install" in sys.argv:
"conf/slackware-mirrors",
"conf/default-repositories",
"conf/custom-repositories",
"conf/rlworkman.deps"
"conf/rlworkman.deps",
"conf/pkg_security"
]
if not os.path.exists(_meta_.conf_path):
os.makedirs(_meta_.conf_path)

View file

@ -25,6 +25,8 @@
import os
from distutils.version import LooseVersion
from slpkg.security import pkg_security
from slpkg.utils import Utils
from slpkg.sizes import units
from slpkg.messages import Msg
@ -53,6 +55,7 @@ class BinaryInstall(object):
"""
def __init__(self, packages, repo, flag):
self.packages = packages
pkg_security(packages)
self.repo = repo
self.flag = flag
self.meta = _meta_

View file

@ -131,6 +131,18 @@ class Msg(object):
raise SystemExit()
return answer
def security_pkg(self, pkg):
"""Warning message for some special reasons
"""
self.template(78)
print("| {0}{1} *** WARNING ***{2}\n"
"| Before proceed with package '{3}' will you must read the\n"
"| README file. You can use command 'slpkg -n {4}'").format(
" " * 20, self.meta.color["RED"], self.meta.color["ENDC"],
pkg, pkg)
self.template(78)
print("")
def reference(self, install, upgrade):
"""Reference list with packages installed
and upgraded

View file

@ -25,6 +25,8 @@
import os
from distutils.version import LooseVersion
from slpkg.security import pkg_security
from slpkg.utils import Utils
from slpkg.messages import Msg
from slpkg.toolbar import status
@ -52,6 +54,7 @@ class SBoInstall(object):
"""
def __init__(self, slackbuilds, flag):
self.slackbuilds = slackbuilds
pkg_security(self.slackbuilds)
self.flag = flag
self.meta = _meta_
self.msg = Msg()

43
slpkg/security.py Normal file
View file

@ -0,0 +1,43 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# security.py file is part of slpkg.
# Copyright 2014-2017 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://github.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from slpkg.utils import Utils
from slpkg.messages import Msg
def pkg_security(pkgs):
"""Check packages before install or upgrade for security
reasons"""
security_packages = Utils().read_file("/etc/slpkg/pkg_security")
packages = []
for read in security_packages.splitlines():
read = read.lstrip()
if not read.startswith("#"):
packages.append(read.replace("\n", ""))
for p in pkgs:
for pkg in packages:
if p == pkg:
Msg().security_pkg(p)
if not Msg().answer() in ["y", "Y"]:
raise SystemExit()