mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-16 03:41:11 +01:00
Merge branch 'develop' into 'master'
update man FR See merge request dslackw/slpkg!118
This commit is contained in:
commit
b5039466e2
35 changed files with 476 additions and 376 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
4.7.8 - 12/04/203
|
||||||
|
Added:
|
||||||
|
- Module to support for Unix shell-style wildcards for blacklist (Thanks yo marav)
|
||||||
|
- Supports proxies (Thanks to tpiszcze) #160
|
||||||
|
Updated:
|
||||||
|
- Config file for --reinstall option (Thanks to rizitis)
|
||||||
|
- Improve speed
|
||||||
|
|
||||||
4.7.7 - 07/04/2023
|
4.7.7 - 07/04/2023
|
||||||
Updated:
|
Updated:
|
||||||
- Improve speed (Replace multi SQL queries)
|
- Improve speed (Replace multi SQL queries)
|
||||||
|
|
72
README.rst
72
README.rst
|
@ -27,7 +27,7 @@ Requirements
|
||||||
Install
|
Install
|
||||||
-------
|
-------
|
||||||
|
|
||||||
Install from the official third-party `SBo repository <https://slackbuilds.org/repository/15.0/system/slpkg/>`_ or directly from source:
|
Install it from the official third-party `SlackBuilds.org <https://slackbuilds.org/repository/15.0/system/slpkg/>`_ repository or directly from source:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
|
@ -101,6 +101,71 @@ Usage
|
||||||
Edit the config file in the /etc/slpkg/slpkg.toml or 'slpkg configs'.
|
Edit the config file in the /etc/slpkg/slpkg.toml or 'slpkg configs'.
|
||||||
|
|
||||||
|
|
||||||
|
How to start
|
||||||
|
------------
|
||||||
|
|
||||||
|
If you are going to use only the `SlackBuilds.org <https://slackbuilds.org/>`_ repository, you don't need to edit the
|
||||||
|
:code:`/etc/slpkg/repositories.toml` file, otherwise edit the file and set :code:`true` the repositories you want.
|
||||||
|
|
||||||
|
The second step is to update the package lists and install the data to the database, just run:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ slpkg update
|
||||||
|
|
||||||
|
or for binary repositories:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ slpkg update --bin-repo='*'
|
||||||
|
|
||||||
|
Now you are ready to start!
|
||||||
|
|
||||||
|
To install a package from the `SlackBuilds.org <https://slackbuilds.org/>`_ or `Ponce <https://cgit.ponce.cc/slackbuilds/>`_ repository, run:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ slpkg install <package_name>
|
||||||
|
|
||||||
|
or from a binary repository:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ slpkg install <package_name> --bin-repo=<repo_name>
|
||||||
|
|
||||||
|
You can install a whole repository with the command:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ slpkg install '*' --bin-repo=gnome --resolve-off
|
||||||
|
|
||||||
|
Note: Apply the option '--resolve-off' to speed up the process because the gnome repository has no references to the dependencies.
|
||||||
|
|
||||||
|
To remove a package with the dependencies:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ slpkg remove <package_name>
|
||||||
|
|
||||||
|
If you wan to search a package from all binaries repositories, run:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ slpkg search libreoffice --bin-repo='*'
|
||||||
|
|
||||||
|
|
||||||
|
For further information, please read the manpage:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ man slpkg
|
||||||
|
|
||||||
|
Edit the configuration :code:`/etc/slpkg/slpkg.toml` file:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ slpkg configs
|
||||||
|
|
||||||
|
|
||||||
Configuration files
|
Configuration files
|
||||||
-------------------
|
-------------------
|
||||||
|
@ -157,6 +222,11 @@ If you feel satisfied with this project and want to thanks me make a donation.
|
||||||
.. image:: https://gitlab.com/dslackw/images/raw/master/donate/paypaldonate.png
|
.. image:: https://gitlab.com/dslackw/images/raw/master/donate/paypaldonate.png
|
||||||
:target: https://www.paypal.me/dslackw
|
:target: https://www.paypal.me/dslackw
|
||||||
|
|
||||||
|
Report bugs
|
||||||
|
-----------
|
||||||
|
|
||||||
|
Please report any issue here: `Issues <https://gitlab.com/dslackw/slpkg/-/issues>`_
|
||||||
|
|
||||||
|
|
||||||
Copyright
|
Copyright
|
||||||
---------
|
---------
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
[BLACKLIST]
|
[BLACKLIST]
|
||||||
|
|
||||||
# Add packages and separate them with commas.
|
# Add packages and separate them with commas.
|
||||||
# Example: ["package_1", "package_2", "package_3"].
|
|
||||||
# The "%README%" is part of REQUIRES indicating that important
|
# Support for Unix shell-style wildcards:
|
||||||
# informationabout dependencies is available in the README file.
|
# '*' matches everything
|
||||||
PACKAGES = ["%README%"]
|
# '?' matches any single character
|
||||||
|
# '[seq]' matches any character in seq
|
||||||
|
# '[!seq]' matches any character not in seq
|
||||||
|
# See: https://docs.python.org/3.9/library/fnmatch.html
|
||||||
|
|
||||||
|
# Example: PACKAGES = ["package", "package*", "[package]"].
|
||||||
|
|
||||||
|
PACKAGES = []
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
[CONFIGS]
|
[CONFIGS]
|
||||||
|
|
||||||
# OS architecture by default.
|
# OS architecture by default.
|
||||||
OS_ARCH = "x86_64"
|
OS_ARCH = "x86_64"
|
||||||
# Where the packages download.
|
# Where the packages download.
|
||||||
|
@ -36,9 +37,17 @@
|
||||||
SPINNER_COLOR = "green"
|
SPINNER_COLOR = "green"
|
||||||
|
|
||||||
# Slackware command for install packages, instead, you can use 'installpkg'.
|
# Slackware command for install packages, instead, you can use 'installpkg'.
|
||||||
|
# Normally upgradepkg only upgrades packages that are already installed
|
||||||
|
# on the system, and will skip any packages that do not already have a
|
||||||
|
# version installed. If --install- new is specified, the behavior is
|
||||||
|
# modified to install new packages in addition to upgrading existing ones.
|
||||||
INSTALLPKG = "upgradepkg --install-new"
|
INSTALLPKG = "upgradepkg --install-new"
|
||||||
# Slackware command to reinstall packages.
|
# Slackware command to reinstall packages.
|
||||||
REINSTALL = "upgradepkg --reinstall"
|
# Upgradepkg usually skips packages if the exact same package (matching name,
|
||||||
|
# version, arch, and build number) is already installed on the system. Use
|
||||||
|
# the --reinstall option if you want to upgrade all packages even if the same
|
||||||
|
# version is already installed.
|
||||||
|
REINSTALL = "upgradepkg --install-new --reinstall"
|
||||||
# Slackware command to remove packages.
|
# Slackware command to remove packages.
|
||||||
REMOVEPKG = "removepkg"
|
REMOVEPKG = "removepkg"
|
||||||
|
|
||||||
|
@ -56,3 +65,12 @@
|
||||||
LFTP_GET_OPTIONS = "-c get -e"
|
LFTP_GET_OPTIONS = "-c get -e"
|
||||||
# Lftp mirror options are used to synchronize with the repositories.
|
# Lftp mirror options are used to synchronize with the repositories.
|
||||||
LFTP_MIRROR_OPTIONS = "-c mirror --parallel=100 --only-newer"
|
LFTP_MIRROR_OPTIONS = "-c mirror --parallel=100 --only-newer"
|
||||||
|
|
||||||
|
# If you are going to use a proxy server, try to fill in these variables.
|
||||||
|
# Choose between http or socks proxy type, not both.
|
||||||
|
# For a socks proxy, you need to install the PySocks package.
|
||||||
|
# https://urllib3.readthedocs.io/en/stable/advanced-usage.html#socks-proxies
|
||||||
|
HTTP_PROXY_ADDRESS = ""
|
||||||
|
SOCKS_PROXY_ADDRESS = ""
|
||||||
|
PROXY_USERNAME = ""
|
||||||
|
PROXY_PASSWORD = ""
|
||||||
|
|
|
@ -210,6 +210,33 @@ En plus de la façon classique, vous pouvez mettre ensemble plusieurs options qu
|
||||||
Au lieu de paquets, vous pouvez passer un fichier texte avec le suffixe '.pkgs' et les noms des paquets. Exemple : 'slpkg install list.pkgs'.
|
Au lieu de paquets, vous pouvez passer un fichier texte avec le suffixe '.pkgs' et les noms des paquets. Exemple : 'slpkg install list.pkgs'.
|
||||||
Éditer la configuration '/etc/slpkg/slpkg.toml' pour changer le suffixe si vous le souhaitez. Vous pouvez utiliser des listes provenant d'autres sources, avec des fichiers '.sqf'.
|
Éditer la configuration '/etc/slpkg/slpkg.toml' pour changer le suffixe si vous le souhaitez. Vous pouvez utiliser des listes provenant d'autres sources, avec des fichiers '.sqf'.
|
||||||
.RE
|
.RE
|
||||||
|
.SH A SAVOIR
|
||||||
|
.P
|
||||||
|
Il y a cinq indicateurs lorsque certaines commandes sont utilisées, par exemple :
|
||||||
|
|
||||||
|
Cyan : Installer, Jaune : Pour construire, Gris : C'est installé, Violet : Pour la mise à jour, Rouge : Pour supprimer.
|
||||||
|
|
||||||
|
Lorsque vous utilisez les commandes install, build, upgrade ou remove, vous devez savoir que si le paquet est installé,
|
||||||
|
sa couleur passera au gris, si le paquet peut être mis à niveau, il devient violet. Et s'il n'est pas installé alors
|
||||||
|
sa couleur sera cyan. De même, si vous essayez de supprimer un paquet, la couleur du paquet devient rouge.
|
||||||
|
|
||||||
|
Exemple : Si le paquet est déjà installé, que la couleur de l'indicateur est grise et que l'option '\fB-r, --reinstall\fR' n'est pas appliquée,
|
||||||
|
le paquetage ne sera pas installé et le message "(already installed)" s'affichera.
|
||||||
|
Si le paquet peut être mis à niveau, l'installation se poursuivra et le paquet passera à la mise à niveau.
|
||||||
|
|
||||||
|
Pour la commande de mise à niveau, vous devez savoir que vous pouvez mettre à niveau des paquets provenant de différents dépôts, si vous éditez
|
||||||
|
le fichier '\fI/etc/slpkg/repositories.toml\fR' et supprimez la balise repository. Le slpkg ne peut alors pas reconnaître le dépôt des paquets.
|
||||||
|
|
||||||
|
Avec la commande remove, il va supprimer les dépendances si le paquet a été installé avec la commande '\fIslpkg install\fR',
|
||||||
|
sinon, le slpkg ne connaît pas les dépendances qui sont installées avec les paquets qu'il va supprimer.
|
||||||
|
|
||||||
|
Vous pouvez appliquer l'astérisque '*' à la place d'un paquet, pour faire correspondre tous les paquets d'un dépôt. Vous ne pouvez pas appliquer
|
||||||
|
un astérisque à l'option '\fB-B, --bin-repos=\fR', sauf pour les commandes '\fB-s, search\fR', '\fB-u, update\fR' et '\fB-c, check-updates\fR'.
|
||||||
|
|
||||||
|
La commande clean-data supprime les données du référentiel local et de la base de données.
|
||||||
|
|
||||||
|
Remarque : il n'existe actuellement aucune fonction permettant d'indiquer les paquets si les couleurs sont désactivées.
|
||||||
|
.RE
|
||||||
.SH FICHIERS DE CONFIGURATION
|
.SH FICHIERS DE CONFIGURATION
|
||||||
.P
|
.P
|
||||||
Fichier de \fBconfiguration\fP : /etc/slpkg/slpkg.toml
|
Fichier de \fBconfiguration\fP : /etc/slpkg/slpkg.toml
|
||||||
|
|
10
man/slpkg.1
10
man/slpkg.1
|
@ -1,4 +1,4 @@
|
||||||
.TH slpkg 1 "Orestiada, Greece" "slpkg 4.7.7" dslackw
|
.TH slpkg 1 "Orestiada, Greece" "slpkg 4.7.8" dslackw
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.P
|
.P
|
||||||
slpkg \- Package manager utility for Slackware.
|
slpkg \- Package manager utility for Slackware.
|
||||||
|
@ -225,18 +225,18 @@ When you use the install, build, upgrade or remove commands you should know that
|
||||||
color will change to gray, if the package is upgradeable then it will change to violet, and if it is not installed then
|
color will change to gray, if the package is upgradeable then it will change to violet, and if it is not installed then
|
||||||
its color will be cyan. Also, if you try to remove a package you will see the package color turns red.
|
its color will be cyan. Also, if you try to remove a package you will see the package color turns red.
|
||||||
|
|
||||||
Example: If the package is already installed and the indicator color is grey and the option '-r, --reinstall' is not applied,
|
Example: If the package is already installed and the indicator color is grey and the option '\fB-r, --reinstall\fR' is not applied,
|
||||||
the package will skip from the installation and you will see a message '(already installed)'.
|
the package will skip from the installation and you will see a message '(already installed)'.
|
||||||
If the package is upgradeable, the installation will continue and the package will go to upgrade.
|
If the package is upgradeable, the installation will continue and the package will go to upgrade.
|
||||||
|
|
||||||
For the upgrade command, you should know, that you can upgrade packages from different repositories, if you edit
|
For the upgrade command, you should know, that you can upgrade packages from different repositories, if you edit
|
||||||
the '/etc/slpkg/repositories.toml' file and remove the repository tag. Then the slpkg can't recognize the repository of the packages.
|
the '\fI/etc/slpkg/repositories.toml\fR' file and remove the repository tag. Then the slpkg can't recognize the repository of the packages.
|
||||||
|
|
||||||
With the remove command, it's going to remove the dependencies if the package had installed with the 'slpkg install' command,
|
With the remove command, it's going to remove the dependencies if the package had installed with the '\fIslpkg install\fR' command,
|
||||||
otherwise, the slpkg does not know the dependencies that are installed with the packages that going to remove.
|
otherwise, the slpkg does not know the dependencies that are installed with the packages that going to remove.
|
||||||
|
|
||||||
You can apply the asterisk '*' instead of a package, to matching all the packages from a repository. You can't apply
|
You can apply the asterisk '*' instead of a package, to matching all the packages from a repository. You can't apply
|
||||||
an asterisk to the '-B, --bin-repos=' option, except for the '-s, search', '-u, update' and '-c, check-updates' commands.
|
an asterisk to the '\fB-B, --bin-repos=\fR' option, except for the '\fB-s, search\fR', '\fB-u, update\fR' and '\fB-c, check-updates\fR' commands.
|
||||||
|
|
||||||
Command clean-data, removes the local repository data and the database data.
|
Command clean-data, removes the local repository data and the database data.
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
SQLAlchemy >= 1.4.46
|
SQLAlchemy >= 1.4.46
|
||||||
pythondialog >= 3.5.3
|
pythondialog >= 3.5.3
|
||||||
progress >= 1.6
|
progress >= 1.6
|
||||||
|
|
||||||
|
[socks]
|
||||||
|
PySocks >= 1.7.1
|
|
@ -1,6 +1,6 @@
|
||||||
[metadata]
|
[metadata]
|
||||||
name = slpkg
|
name = slpkg
|
||||||
version = 4.7.7
|
version = 4.7.8
|
||||||
license_file = LICENSE
|
license_file = LICENSE
|
||||||
author = Dimitris Zlatanidis
|
author = Dimitris Zlatanidis
|
||||||
author_email = d.zlatanidis@gmail.com
|
author_email = d.zlatanidis@gmail.com
|
||||||
|
@ -43,5 +43,9 @@ install_requires =
|
||||||
progress >= 1.6
|
progress >= 1.6
|
||||||
include_package_data = True
|
include_package_data = True
|
||||||
|
|
||||||
|
[options.extras_require]
|
||||||
|
socks =
|
||||||
|
PySocks >= 1.7.1
|
||||||
|
|
||||||
[options.packages.find]
|
[options.packages.find]
|
||||||
where = .
|
where = .
|
||||||
|
|
|
@ -253,6 +253,9 @@ class Packages(Configs):
|
||||||
if self.mode == 'install' and not installed:
|
if self.mode == 'install' and not installed:
|
||||||
status: bool = True
|
status: bool = True
|
||||||
|
|
||||||
|
if self.option_for_reinstall:
|
||||||
|
status: bool = True
|
||||||
|
|
||||||
choices += [(package, repo_ver, status, help_text)]
|
choices += [(package, repo_ver, status, help_text)]
|
||||||
|
|
||||||
text: str = f'There are {len(choices)} dependencies:'
|
text: str = f'There are {len(choices)} dependencies:'
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from slpkg.blacklist import Blacklist
|
from slpkg.utilities import Utilities
|
||||||
from slpkg.models.models import BinariesTable
|
from slpkg.models.models import BinariesTable
|
||||||
from slpkg.models.models import session as Session
|
from slpkg.models.models import session as Session
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ class BinQueries:
|
||||||
self.repo: str = repo
|
self.repo: str = repo
|
||||||
self.session = Session
|
self.session = Session
|
||||||
|
|
||||||
self.black = Blacklist()
|
self.utils = Utilities()
|
||||||
|
|
||||||
def repository_data(self) -> dict:
|
def repository_data(self) -> dict:
|
||||||
""" Returns a dictionary with the repository data. """
|
""" Returns a dictionary with the repository data. """
|
||||||
|
@ -36,7 +36,7 @@ class BinQueries:
|
||||||
data.checksum,
|
data.checksum,
|
||||||
data.repo)
|
data.repo)
|
||||||
for data in repository_data
|
for data in repository_data
|
||||||
if data.name not in self.black.packages()
|
if not self.utils.blacklist_pattern(data.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
return repos_dict
|
return repos_dict
|
||||||
|
@ -60,15 +60,7 @@ class BinQueries:
|
||||||
data.checksum,
|
data.checksum,
|
||||||
data.repo)
|
data.repo)
|
||||||
for data in repositories_data
|
for data in repositories_data
|
||||||
if data.name not in self.black.packages()
|
if not self.utils.blacklist_pattern(data.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
return repos_dict
|
return repos_dict
|
||||||
|
|
||||||
def count_packages(self) -> int:
|
|
||||||
""" Counts the number of the packages. """
|
|
||||||
count = self.session.query(
|
|
||||||
BinariesTable.id).where(
|
|
||||||
BinariesTable.repo == self.repo).count()
|
|
||||||
|
|
||||||
return count
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from slpkg.blacklist import Blacklist
|
from slpkg.utilities import Utilities
|
||||||
from slpkg.repositories import Repositories
|
from slpkg.repositories import Repositories
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ class Required:
|
||||||
self.name: str = name
|
self.name: str = name
|
||||||
self.repo: str = repo
|
self.repo: str = repo
|
||||||
self.repos = Repositories()
|
self.repos = Repositories()
|
||||||
self.black = Blacklist()
|
self.utils = Utilities()
|
||||||
|
|
||||||
self.special_repos: list = [
|
self.special_repos: list = [
|
||||||
self.repos.salixos_repo_name,
|
self.repos.salixos_repo_name,
|
||||||
|
@ -40,7 +40,7 @@ class Required:
|
||||||
|
|
||||||
# Remove requirements that are included as dependencies,
|
# Remove requirements that are included as dependencies,
|
||||||
# but are not included in the repository.
|
# but are not included in the repository.
|
||||||
if req not in list(self.data.keys()) or req in self.black.packages():
|
if req not in list(self.data.keys()) or self.utils.blacklist_pattern(req):
|
||||||
required.remove(req)
|
required.remove(req)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import urllib3
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from multiprocessing import Process
|
from multiprocessing import Process
|
||||||
|
from urllib3 import PoolManager, ProxyManager, make_headers
|
||||||
|
|
||||||
from slpkg.configs import Configs
|
from slpkg.configs import Configs
|
||||||
from slpkg.utilities import Utilities
|
from slpkg.utilities import Utilities
|
||||||
|
@ -168,7 +168,21 @@ class CheckUpdates(Configs):
|
||||||
def compare_dates(self) -> bool:
|
def compare_dates(self) -> bool:
|
||||||
local_date: int = 0
|
local_date: int = 0
|
||||||
try:
|
try:
|
||||||
http = urllib3.PoolManager()
|
http = PoolManager()
|
||||||
|
proxy_default_headers = make_headers(proxy_basic_auth=f'{self.proxy_username}:{self.proxy_password}')
|
||||||
|
|
||||||
|
if self.http_proxy_address:
|
||||||
|
http = ProxyManager(f'{self.http_proxy_address}', headers=proxy_default_headers)
|
||||||
|
|
||||||
|
elif self.socks_proxy_address:
|
||||||
|
# https://urllib3.readthedocs.io/en/stable/advanced-usage.html#socks-proxies
|
||||||
|
try: # Try to import PySocks if it's installed.
|
||||||
|
from urllib3.contrib.socks import SOCKSProxyManager
|
||||||
|
except (ModuleNotFoundError, ImportError):
|
||||||
|
raise SystemExit()
|
||||||
|
|
||||||
|
http = SOCKSProxyManager(f'{self.socks_proxy_address}', headers=proxy_default_headers)
|
||||||
|
|
||||||
repo = http.request('GET', self.repo_chg_txt)
|
repo = http.request('GET', self.repo_chg_txt)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from slpkg.configs import Configs
|
from slpkg.configs import Configs
|
||||||
from slpkg.blacklist import Blacklist
|
|
||||||
from slpkg.utilities import Utilities
|
from slpkg.utilities import Utilities
|
||||||
from slpkg.repositories import Repositories
|
from slpkg.repositories import Repositories
|
||||||
from slpkg.models.models import session as Session
|
from slpkg.models.models import session as Session
|
||||||
|
@ -21,7 +20,6 @@ class Check(Configs):
|
||||||
self.flags: list = flags
|
self.flags: list = flags
|
||||||
self.data: dict = data
|
self.data: dict = data
|
||||||
|
|
||||||
self.black = Blacklist()
|
|
||||||
self.utils = Utilities()
|
self.utils = Utilities()
|
||||||
self.repos = Repositories()
|
self.repos = Repositories()
|
||||||
|
|
||||||
|
@ -77,17 +75,6 @@ class Check(Configs):
|
||||||
if not_found:
|
if not_found:
|
||||||
self.utils.raise_error_message(f'Not found \'{", ".join(not_found)}\' installed packages')
|
self.utils.raise_error_message(f'Not found \'{", ".join(not_found)}\' installed packages')
|
||||||
|
|
||||||
def is_blacklist(self, package: list) -> None:
|
|
||||||
""" Checking if the packages are blacklisted. """
|
|
||||||
blacklist: list = []
|
|
||||||
|
|
||||||
for pkg in package:
|
|
||||||
if pkg in self.black.packages():
|
|
||||||
blacklist.append(pkg)
|
|
||||||
|
|
||||||
if blacklist:
|
|
||||||
self.utils.raise_error_message(f"The packages '{', '.join(blacklist)}' is blacklisted")
|
|
||||||
|
|
||||||
def is_empty_database(self) -> None:
|
def is_empty_database(self) -> None:
|
||||||
""" Checking for empty table and database file. """
|
""" Checking for empty table and database file. """
|
||||||
db = Path(self.db_path, self.database_name)
|
db = Path(self.db_path, self.database_name)
|
||||||
|
|
|
@ -77,6 +77,11 @@ class Configs:
|
||||||
progress_spinner: str = 'pixel'
|
progress_spinner: str = 'pixel'
|
||||||
spinner_color: str = 'green'
|
spinner_color: str = 'green'
|
||||||
|
|
||||||
|
http_proxy_address: str = ''
|
||||||
|
socks_proxy_address: str = ''
|
||||||
|
proxy_username: str = ''
|
||||||
|
proxy_password: str = ''
|
||||||
|
|
||||||
load = Load()
|
load = Load()
|
||||||
configs = load.config_file(etc_path, prog_name)
|
configs = load.config_file(etc_path, prog_name)
|
||||||
|
|
||||||
|
@ -104,6 +109,10 @@ class Configs:
|
||||||
file_pattern_conf: str = config['FILE_PATTERN']
|
file_pattern_conf: str = config['FILE_PATTERN']
|
||||||
progress_spinner: str = config['PROGRESS_SPINNER']
|
progress_spinner: str = config['PROGRESS_SPINNER']
|
||||||
spinner_color: str = config['SPINNER_COLOR']
|
spinner_color: str = config['SPINNER_COLOR']
|
||||||
|
http_proxy_address: str = config['HTTP_PROXY_ADDRESS']
|
||||||
|
socks_proxy_address: str = config['SOCKS_PROXY_ADDRESS']
|
||||||
|
proxy_username: str = config['PROXY_USERNAME']
|
||||||
|
proxy_password: str = config['PROXY_PASSWORD']
|
||||||
|
|
||||||
except KeyError as error:
|
except KeyError as error:
|
||||||
raise SystemExit(f"\n{prog_name}: {color['bold']}{color['red']}Error{color['endc']}: "
|
raise SystemExit(f"\n{prog_name}: {color['bold']}{color['red']}Error{color['endc']}: "
|
||||||
|
|
|
@ -51,7 +51,7 @@ class Dependees(Configs):
|
||||||
self.packages: list = self.utils.apply_package_pattern(self.data, self.packages)
|
self.packages: list = self.utils.apply_package_pattern(self.data, self.packages)
|
||||||
|
|
||||||
for pkg in self.packages:
|
for pkg in self.packages:
|
||||||
dependees: list = list(self.find_requires(pkg))
|
dependees: dict = dict(self.find_requires(pkg))
|
||||||
|
|
||||||
package: str = f'{self.byellow}{pkg}{self.endc}'
|
package: str = f'{self.byellow}{pkg}{self.endc}'
|
||||||
|
|
||||||
|
@ -71,17 +71,17 @@ class Dependees(Configs):
|
||||||
print(f'{self.cyan} No dependees{self.endc}')
|
print(f'{self.cyan} No dependees{self.endc}')
|
||||||
|
|
||||||
sp: str = ' ' * 4
|
sp: str = ' ' * 4
|
||||||
for i, dep in enumerate(dependees, start=1):
|
for i, (name, requires) in enumerate(dependees.items(), start=1):
|
||||||
dependency: str = f'{self.cyan}{dep[0]}{self.endc}'
|
dependency: str = f'{self.cyan}{name}{self.endc}'
|
||||||
|
|
||||||
if self.option_for_pkg_version:
|
if self.option_for_pkg_version:
|
||||||
|
|
||||||
if self.option_for_binaries:
|
if self.option_for_binaries:
|
||||||
version: str = self.data[dep[0]][0]
|
version: str = self.data[name][0]
|
||||||
else:
|
else:
|
||||||
version: str = self.data[dep[0]][2]
|
version: str = self.data[name][2]
|
||||||
|
|
||||||
dependency: str = (f'{self.cyan}{dep[0]}{self.endc} {self.yellow}'
|
dependency: str = (f'{self.cyan}{name}{self.endc} {self.yellow}'
|
||||||
f'{version}{self.endc}')
|
f'{version}{self.endc}')
|
||||||
|
|
||||||
if i == 1:
|
if i == 1:
|
||||||
|
@ -91,26 +91,21 @@ class Dependees(Configs):
|
||||||
|
|
||||||
if self.option_for_full_reverse:
|
if self.option_for_full_reverse:
|
||||||
if i == len(dependees):
|
if i == len(dependees):
|
||||||
print(' ' * 4 + f' {self.llc}{self.hl} {self.violet}{dep[1]}{self.endc}')
|
print(' ' * 4 + f' {self.llc}{self.hl} {self.violet}{requires}{self.endc}')
|
||||||
else:
|
else:
|
||||||
print(' ' * 4 + f' {self.var}{self.hl} {self.violet}{dep[1]}{self.endc}')
|
print(' ' * 4 + f' {self.var}{self.hl} {self.violet}{requires}{self.endc}')
|
||||||
|
|
||||||
print(f'\n{self.grey}{len(dependees)} dependees for {pkg}{self.endc}\n')
|
print(f'\n{self.grey}{len(dependees)} dependees for {pkg}{self.endc}\n')
|
||||||
|
|
||||||
def find_requires(self, pkg: str) -> Generator[str, None, None]:
|
def find_requires(self, pkg: str) -> Generator:
|
||||||
""" Find requires that package dependees. """
|
""" Find requires that package dependees. """
|
||||||
if self.option_for_binaries:
|
if self.option_for_binaries:
|
||||||
|
|
||||||
for name, data in self.data.items():
|
for name, data in self.data.items():
|
||||||
if name:
|
if pkg in data[6].split():
|
||||||
for req in data[6].split():
|
yield name, data[6]
|
||||||
if req == pkg:
|
|
||||||
|
|
||||||
yield [name, data[6]]
|
|
||||||
else:
|
else:
|
||||||
for name, data in self.data.items():
|
for name, data in self.data.items():
|
||||||
if name:
|
if pkg in data[7].split():
|
||||||
for req in data[7].split():
|
yield name, data[7]
|
||||||
if req == pkg:
|
|
||||||
|
|
||||||
yield [name, data[7]]
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ class FindInstalled(Configs):
|
||||||
self.endc: str = self.color['endc']
|
self.endc: str = self.color['endc']
|
||||||
self.grey: str = self.color['grey']
|
self.grey: str = self.color['grey']
|
||||||
|
|
||||||
self.installed: list = self.utils.installed_packages
|
self.installed: dict = self.utils.installed_packages
|
||||||
|
|
||||||
def find(self, packages: list) -> None:
|
def find(self, packages: list) -> None:
|
||||||
""" Find the packages. """
|
""" Find the packages. """
|
||||||
|
@ -31,7 +31,7 @@ class FindInstalled(Configs):
|
||||||
f'that contains \'{", ".join([p for p in packages])}\' files:\n')
|
f'that contains \'{", ".join([p for p in packages])}\' files:\n')
|
||||||
|
|
||||||
for pkg in packages:
|
for pkg in packages:
|
||||||
for package in self.installed:
|
for package in self.installed.values():
|
||||||
if pkg in package or pkg == '*':
|
if pkg in package or pkg == '*':
|
||||||
matching.append(package)
|
matching.append(package)
|
||||||
|
|
||||||
|
|
|
@ -290,7 +290,6 @@ class Argparse(Configs):
|
||||||
self.data: dict = SBoQueries().repository_data()
|
self.data: dict = SBoQueries().repository_data()
|
||||||
|
|
||||||
self.check = Check(self.flags, self.data)
|
self.check = Check(self.flags, self.data)
|
||||||
self.check.is_blacklist(self.args[1:])
|
|
||||||
|
|
||||||
logging.basicConfig(filename=LoggingConfig.log_file,
|
logging.basicConfig(filename=LoggingConfig.log_file,
|
||||||
filemode='w',
|
filemode='w',
|
||||||
|
@ -307,7 +306,10 @@ class Argparse(Configs):
|
||||||
'-c', 'check-updates',
|
'-c', 'check-updates',
|
||||||
]
|
]
|
||||||
|
|
||||||
if self.binary_repo == '*' and not self.utils.is_option(except_options, self.args):
|
if self.binary_repo in self.repos.bin_repos_names and self.binary_repo not in self.repos.bin_enabled_repos:
|
||||||
|
self.usage.help_minimal(f"{self.prog_name}: repository '{self.binary_repo}' is disabled")
|
||||||
|
|
||||||
|
elif self.binary_repo == '*' and not self.utils.is_option(except_options, self.args):
|
||||||
self.usage.help_minimal(f"{self.prog_name}: invalid binary repository '{self.binary_repo}'")
|
self.usage.help_minimal(f"{self.prog_name}: invalid binary repository '{self.binary_repo}'")
|
||||||
|
|
||||||
elif self.binary_repo not in self.repos.bin_repos_names and self.binary_repo != '*':
|
elif self.binary_repo not in self.repos.bin_repos_names and self.binary_repo != '*':
|
||||||
|
@ -435,9 +437,8 @@ class Argparse(Configs):
|
||||||
|
|
||||||
repo_packages: list = list(self.data.keys())
|
repo_packages: list = list(self.data.keys())
|
||||||
|
|
||||||
installed: list = self.utils.installed_packages
|
|
||||||
|
|
||||||
if method in ['remove', 'find']:
|
if method in ['remove', 'find']:
|
||||||
|
installed: list = list(self.utils.installed_packages.values())
|
||||||
|
|
||||||
for package in installed:
|
for package in installed:
|
||||||
split_package: list = self.utils.split_binary_pkg(package)
|
split_package: list = self.utils.split_binary_pkg(package)
|
||||||
|
|
|
@ -5,11 +5,9 @@ import shutil
|
||||||
|
|
||||||
from slpkg.configs import Configs
|
from slpkg.configs import Configs
|
||||||
from slpkg.utilities import Utilities
|
from slpkg.utilities import Utilities
|
||||||
from slpkg.sbos.queries import SBoQueries
|
|
||||||
from slpkg.repositories import Repositories
|
from slpkg.repositories import Repositories
|
||||||
from slpkg.binaries.queries import BinQueries
|
|
||||||
from slpkg.models.models import LastRepoUpdated
|
|
||||||
from slpkg.models.models import session as Session
|
from slpkg.models.models import session as Session
|
||||||
|
from slpkg.models.models import LastRepoUpdated, SBoTable, BinariesTable
|
||||||
|
|
||||||
|
|
||||||
class RepoInfo(Configs):
|
class RepoInfo(Configs):
|
||||||
|
@ -61,9 +59,9 @@ class RepoInfo(Configs):
|
||||||
|
|
||||||
if value[0]:
|
if value[0]:
|
||||||
if repo in [self.repos.sbo_repo_name, self.repos.ponce_repo_name]:
|
if repo in [self.repos.sbo_repo_name, self.repos.ponce_repo_name]:
|
||||||
count = int(SBoQueries().count_packages())
|
count = self.session.query(SBoTable.id).count()
|
||||||
else:
|
else:
|
||||||
count = int(BinQueries(repo).count_packages())
|
count = self.session.query(BinariesTable).where(BinariesTable.repo == repo).count()
|
||||||
|
|
||||||
total_packages += count
|
total_packages += count
|
||||||
|
|
||||||
|
|
|
@ -471,7 +471,4 @@ class Repositories:
|
||||||
bin_repos_names = list(repositories.keys())[2:]
|
bin_repos_names = list(repositories.keys())[2:]
|
||||||
|
|
||||||
# All the enabled binary repositories names.
|
# All the enabled binary repositories names.
|
||||||
for repo, enabled in repositories.items():
|
bin_enabled_repos = list(repositories.keys())[2:]
|
||||||
if repo not in [sbo_repo_name, ponce_repo_name]:
|
|
||||||
if enabled[0]:
|
|
||||||
bin_enabled_repos.append(repo)
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from slpkg.blacklist import Blacklist
|
from slpkg.utilities import Utilities
|
||||||
|
|
||||||
|
|
||||||
class Requires:
|
class Requires:
|
||||||
|
@ -13,7 +13,7 @@ class Requires:
|
||||||
self.data: dict = data
|
self.data: dict = data
|
||||||
self.name: str = name
|
self.name: str = name
|
||||||
|
|
||||||
self.black = Blacklist()
|
self.utils = Utilities()
|
||||||
|
|
||||||
def resolve(self) -> list:
|
def resolve(self) -> list:
|
||||||
""" Resolve the dependencies. """
|
""" Resolve the dependencies. """
|
||||||
|
@ -23,7 +23,7 @@ class Requires:
|
||||||
|
|
||||||
# Remove requirements that are included as dependencies,
|
# Remove requirements that are included as dependencies,
|
||||||
# but are not included in the repository.
|
# but are not included in the repository.
|
||||||
if req not in list(self.data.keys()) or req in self.black.packages():
|
if req not in list(self.data.keys()) or self.utils.blacklist_pattern(req):
|
||||||
requires.remove(req)
|
requires.remove(req)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from sqlalchemy import inspect
|
|
||||||
|
|
||||||
from slpkg.configs import Configs
|
from slpkg.configs import Configs
|
||||||
from slpkg.blacklist import Blacklist
|
from slpkg.utilities import Utilities
|
||||||
from slpkg.repositories import Repositories
|
from slpkg.repositories import Repositories
|
||||||
from slpkg.models.models import session as Session
|
from slpkg.models.models import session as Session
|
||||||
from slpkg.models.models import SBoTable, PonceTable
|
from slpkg.models.models import SBoTable, PonceTable
|
||||||
|
@ -18,7 +16,7 @@ class SBoQueries(Configs):
|
||||||
self.session = Session
|
self.session = Session
|
||||||
|
|
||||||
self.repos = Repositories()
|
self.repos = Repositories()
|
||||||
self.black = Blacklist()
|
self.utils = Utilities()
|
||||||
|
|
||||||
# Switch between sbo and ponce repository.
|
# Switch between sbo and ponce repository.
|
||||||
self.sbo_table = SBoTable
|
self.sbo_table = SBoTable
|
||||||
|
@ -40,23 +38,7 @@ class SBoQueries(Configs):
|
||||||
data.requires,
|
data.requires,
|
||||||
data.short_description)
|
data.short_description)
|
||||||
for data in repository_data
|
for data in repository_data
|
||||||
if data.name not in self.black.packages()
|
if not self.utils.blacklist_pattern(data.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
return repos_dict
|
return repos_dict
|
||||||
|
|
||||||
def count_packages(self) -> int:
|
|
||||||
""" Counts the number of the packages. """
|
|
||||||
count = self.session.query(
|
|
||||||
self.sbo_table.id).count()
|
|
||||||
|
|
||||||
return count
|
|
||||||
|
|
||||||
def repo_name(self) -> str:
|
|
||||||
""" Returns the repo name by the table. """
|
|
||||||
table = inspect(self.sbo_table)
|
|
||||||
repo = self.repos.sbo_repo_name
|
|
||||||
if table.tables[0].name == 'poncetable':
|
|
||||||
repo = self.repos.ponce_repo_name
|
|
||||||
|
|
||||||
return repo
|
|
||||||
|
|
|
@ -378,7 +378,7 @@ class Slackbuilds(Configs):
|
||||||
for package in dependencies:
|
for package in dependencies:
|
||||||
status: bool = False
|
status: bool = False
|
||||||
|
|
||||||
repo_ver: str = self.data[package][0]
|
repo_ver: str = self.data[package][2]
|
||||||
description: str = self.data[package][8]
|
description: str = self.data[package][8]
|
||||||
help_text: str = f'Description: {description}'
|
help_text: str = f'Description: {description}'
|
||||||
upgradable: bool = self.upgrade.is_package_upgradeable(package)
|
upgradable: bool = self.upgrade.is_package_upgradeable(package)
|
||||||
|
@ -396,6 +396,9 @@ class Slackbuilds(Configs):
|
||||||
if self.mode == 'install' and not installed:
|
if self.mode == 'install' and not installed:
|
||||||
status: bool = True
|
status: bool = True
|
||||||
|
|
||||||
|
if self.option_for_reinstall:
|
||||||
|
status: bool = True
|
||||||
|
|
||||||
choices += [(package, repo_ver, status, help_text)]
|
choices += [(package, repo_ver, status, help_text)]
|
||||||
|
|
||||||
text: str = f'There are {len(choices)} dependencies:'
|
text: str = f'There are {len(choices)} dependencies:'
|
||||||
|
|
|
@ -43,7 +43,7 @@ class SearchPackage(Configs):
|
||||||
for package in packages:
|
for package in packages:
|
||||||
for data_pkg in data.values():
|
for data_pkg in data.values():
|
||||||
|
|
||||||
if package in data_pkg[1] or package == '*':
|
if package in data_pkg[0] or package == '*':
|
||||||
matching += 1
|
matching += 1
|
||||||
|
|
||||||
print(f'{data_pkg[12]}: {self.cyan}{data_pkg[0]}{self.endc} '
|
print(f'{data_pkg[12]}: {self.cyan}{data_pkg[0]}{self.endc} '
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
from slpkg.configs import Configs
|
from slpkg.configs import Configs
|
||||||
from slpkg.views.ascii import Ascii
|
from slpkg.views.ascii import Ascii
|
||||||
from slpkg.utilities import Utilities
|
from slpkg.utilities import Utilities
|
||||||
from slpkg.blacklist import Blacklist
|
|
||||||
|
|
||||||
|
|
||||||
class Tracking(Configs):
|
class Tracking(Configs):
|
||||||
|
@ -18,7 +17,6 @@ class Tracking(Configs):
|
||||||
self.ascii = Ascii()
|
self.ascii = Ascii()
|
||||||
self.color = self.colour()
|
self.color = self.colour()
|
||||||
self.utils = Utilities()
|
self.utils = Utilities()
|
||||||
self.black = Blacklist()
|
|
||||||
|
|
||||||
self.llc: str = self.ascii.lower_left_corner
|
self.llc: str = self.ascii.lower_left_corner
|
||||||
self.hl: str = self.ascii.horizontal_line
|
self.hl: str = self.ascii.horizontal_line
|
||||||
|
@ -69,7 +67,7 @@ class Tracking(Configs):
|
||||||
print(f' {self.cyan}No dependencies{self.endc}')
|
print(f' {self.cyan}No dependencies{self.endc}')
|
||||||
else:
|
else:
|
||||||
for i, req in enumerate(requires, start=1):
|
for i, req in enumerate(requires, start=1):
|
||||||
if req not in self.black.packages():
|
if not self.utils.blacklist_pattern(req):
|
||||||
|
|
||||||
require: str = f'{self.cyan}{req}{self.endc}'
|
require: str = f'{self.cyan}{req}{self.endc}'
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ class Upgrade(Configs):
|
||||||
""" Returns the upgradable packages. """
|
""" Returns the upgradable packages. """
|
||||||
|
|
||||||
# Returns the matched packages between two lists.
|
# Returns the matched packages between two lists.
|
||||||
packages: list = list(set(self.utils.installed_package_names) & set(list(self.data.keys())))
|
packages: list = list(set(self.utils.installed_packages.keys()) & set(list(self.data.keys())))
|
||||||
|
|
||||||
for pkg in packages:
|
for pkg in packages:
|
||||||
if self.is_package_upgradeable(pkg):
|
if self.is_package_upgradeable(pkg):
|
||||||
|
|
|
@ -5,6 +5,7 @@ import re
|
||||||
import time
|
import time
|
||||||
import shutil
|
import shutil
|
||||||
import logging
|
import logging
|
||||||
|
import fnmatch
|
||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Generator, Union
|
from typing import Generator, Union
|
||||||
|
@ -31,8 +32,7 @@ class Utilities:
|
||||||
self.endc: str = self.color['endc']
|
self.endc: str = self.color['endc']
|
||||||
self.bred: str = f'{self.bold}{self.red}'
|
self.bred: str = f'{self.bold}{self.red}'
|
||||||
|
|
||||||
self.installed_packages: list = list(self.all_installed())
|
self.installed_packages: dict = dict(self.all_installed())
|
||||||
self.installed_package_names: list = list(self.all_installed_names())
|
|
||||||
|
|
||||||
logging.basicConfig(filename=LoggingConfig.log_file,
|
logging.basicConfig(filename=LoggingConfig.log_file,
|
||||||
filemode='w',
|
filemode='w',
|
||||||
|
@ -40,35 +40,29 @@ class Utilities:
|
||||||
level=logging.INFO)
|
level=logging.INFO)
|
||||||
|
|
||||||
def is_package_installed(self, name: str) -> str:
|
def is_package_installed(self, name: str) -> str:
|
||||||
""" Returns the installed package name. """
|
""" Returns the installed package binary. """
|
||||||
for package in self.installed_packages:
|
try:
|
||||||
pkg_name: str = self.split_binary_pkg(package)[0]
|
return self.installed_packages[name]
|
||||||
|
except KeyError:
|
||||||
if pkg_name == name:
|
|
||||||
return package
|
|
||||||
|
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
def all_installed(self) -> Generator:
|
def all_installed(self) -> dict:
|
||||||
""" Return all installed packages from /val/log/packages folder. """
|
""" Return all installed packages from /val/log/packages folder. """
|
||||||
var_log_packages: Path = Path(self.configs.log_packages)
|
var_log_packages: Path = Path(self.configs.log_packages)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for file in var_log_packages.glob(self.configs.file_pattern):
|
for file in var_log_packages.glob(self.configs.file_pattern):
|
||||||
name = self.split_binary_pkg(file.name)[0]
|
name = self.split_binary_pkg(file.name)[0]
|
||||||
|
|
||||||
if not name.startswith('.') and name not in self.black.packages():
|
if not name.startswith('.') and not self.blacklist_pattern(name):
|
||||||
yield file.name
|
yield name, file.name
|
||||||
|
|
||||||
except ValueError as err:
|
except ValueError as err:
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
logger.info('%s: %s: %s', self.__class__.__name__,
|
logger.info('%s: %s: %s', self.__class__.__name__,
|
||||||
Utilities.all_installed.__name__,
|
Utilities.all_installed.__name__,
|
||||||
err)
|
err)
|
||||||
|
|
||||||
def all_installed_names(self) -> Generator:
|
|
||||||
""" Return all installed packages names from /val/log/packages folder. """
|
|
||||||
for package in self.installed_packages:
|
|
||||||
yield self.split_binary_pkg(package)[0]
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def remove_file_if_exists(path: Path, file: str) -> None:
|
def remove_file_if_exists(path: Path, file: str) -> None:
|
||||||
""" Clean the old files. """
|
""" Clean the old files. """
|
||||||
|
@ -196,3 +190,8 @@ class Utilities:
|
||||||
packages += list(data.keys())
|
packages += list(data.keys())
|
||||||
|
|
||||||
return packages
|
return packages
|
||||||
|
|
||||||
|
def blacklist_pattern(self, name):
|
||||||
|
""" This module provides support for Unix shell-style wildcards. """
|
||||||
|
if [black for black in self.black.packages() if fnmatch.fnmatch(name, black)]:
|
||||||
|
return True
|
||||||
|
|
|
@ -5,7 +5,7 @@ class Version:
|
||||||
""" Print the version. """
|
""" Print the version. """
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.version_info: tuple = (4, 7, 7)
|
self.version_info: tuple = (4, 7, 8)
|
||||||
self.version: str = '{0}.{1}.{2}'.format(*self.version_info)
|
self.version: str = '{0}.{1}.{2}'.format(*self.version_info)
|
||||||
self.license: str = 'MIT License'
|
self.license: str = 'MIT License'
|
||||||
self.author: str = 'Dimitris Zlatanidis (dslackw)'
|
self.author: str = 'Dimitris Zlatanidis (dslackw)'
|
||||||
|
|
|
@ -10,7 +10,6 @@ from slpkg.upgrade import Upgrade
|
||||||
from slpkg.views.ascii import Ascii
|
from slpkg.views.ascii import Ascii
|
||||||
from slpkg.utilities import Utilities
|
from slpkg.utilities import Utilities
|
||||||
from slpkg.dialog_box import DialogBox
|
from slpkg.dialog_box import DialogBox
|
||||||
from slpkg.sbos.queries import SBoQueries
|
|
||||||
from slpkg.repositories import Repositories
|
from slpkg.repositories import Repositories
|
||||||
from slpkg.models.models import LogsDependencies
|
from slpkg.models.models import LogsDependencies
|
||||||
from slpkg.models.models import session as Session
|
from slpkg.models.models import session as Session
|
||||||
|
@ -65,7 +64,7 @@ class ViewMessage(Configs):
|
||||||
repo: str = self.repo
|
repo: str = self.repo
|
||||||
else:
|
else:
|
||||||
version: str = self.data[package][2]
|
version: str = self.data[package][2]
|
||||||
repo: str = SBoQueries().repo_name()
|
repo: str = self.repos.sbo_enabled_repository
|
||||||
|
|
||||||
if mode in ['install', 'download']:
|
if mode in ['install', 'download']:
|
||||||
color: str = self.cyan
|
color: str = self.cyan
|
||||||
|
@ -75,13 +74,13 @@ class ViewMessage(Configs):
|
||||||
color: str = self.violet
|
color: str = self.violet
|
||||||
|
|
||||||
# If the package is installed and change the color to gray.
|
# If the package is installed and change the color to gray.
|
||||||
if package in self.utils.installed_package_names and mode == 'install':
|
if package in self.utils.installed_packages.keys() and mode == 'install':
|
||||||
color: str = self.grey
|
color: str = self.grey
|
||||||
|
|
||||||
if self.upgrade.is_package_upgradeable(package) and mode == 'install':
|
if self.upgrade.is_package_upgradeable(package) and mode == 'install':
|
||||||
color: str = self.violet
|
color: str = self.violet
|
||||||
|
|
||||||
if (package in self.utils.installed_package_names and mode == 'install'
|
if (package in self.utils.installed_packages.keys() and mode == 'install'
|
||||||
and self.option_for_reinstall):
|
and self.option_for_reinstall):
|
||||||
color: str = self.violet
|
color: str = self.violet
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,6 @@ class TestBinQueries(unittest.TestCase):
|
||||||
self.repo_data = self.bin_queries.repository_data()
|
self.repo_data = self.bin_queries.repository_data()
|
||||||
self.repos_data = self.bin_queries.repositories_data()
|
self.repos_data = self.bin_queries.repositories_data()
|
||||||
|
|
||||||
def test_count_packages(self):
|
|
||||||
self.assertGreater(self.bin_queries.count_packages(), 1)
|
|
||||||
|
|
||||||
def test_repository_data(self):
|
def test_repository_data(self):
|
||||||
self.assertGreater(len(list(self.repo_data.keys())), 1)
|
self.assertGreater(len(list(self.repo_data.keys())), 1)
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ class TestBlacklist(unittest.TestCase):
|
||||||
|
|
||||||
def test_blacklist(self):
|
def test_blacklist(self):
|
||||||
black = Blacklist()
|
black = Blacklist()
|
||||||
self.assertListEqual(['%README%'], black.packages())
|
self.assertListEqual([], black.packages())
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -20,12 +20,6 @@ class TestPkgInstalled(unittest.TestCase):
|
||||||
def test_check_is_installed(self):
|
def test_check_is_installed(self):
|
||||||
self.assertIsNone(self.check.is_package_unsupported(self.packages))
|
self.assertIsNone(self.check.is_package_unsupported(self.packages))
|
||||||
|
|
||||||
def test_check_blacklist(self):
|
|
||||||
self.assertIsNone(self.check.is_blacklist(self.packages))
|
|
||||||
|
|
||||||
def test_check_is_empty(self):
|
|
||||||
self.assertIsNone(self.check.is_blacklist(self.packages))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
@ -38,6 +38,10 @@ class TestConfigs(unittest.TestCase):
|
||||||
self.assertEqual('*', self.configs.file_pattern)
|
self.assertEqual('*', self.configs.file_pattern)
|
||||||
self.assertEqual('pixel', self.configs.progress_spinner)
|
self.assertEqual('pixel', self.configs.progress_spinner)
|
||||||
self.assertEqual('green', self.configs.spinner_color)
|
self.assertEqual('green', self.configs.spinner_color)
|
||||||
|
self.assertEqual('', self.configs.http_proxy_address)
|
||||||
|
self.assertEqual('', self.configs.socks_proxy_address)
|
||||||
|
self.assertEqual('', self.configs.proxy_username)
|
||||||
|
self.assertEqual('', self.configs.proxy_password)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -36,14 +36,6 @@ class TestUtilities(unittest.TestCase):
|
||||||
def test_all_installed(self):
|
def test_all_installed(self):
|
||||||
self.assertIn(self.package, self.utils.all_installed())
|
self.assertIn(self.package, self.utils.all_installed())
|
||||||
|
|
||||||
def test_all_installed_names(self):
|
|
||||||
self.assertIn('aaa_base', self.utils.all_installed_names())
|
|
||||||
self.assertIn('vim', self.utils.all_installed_names())
|
|
||||||
self.assertIn('nano', self.utils.all_installed_names())
|
|
||||||
self.assertIn('wget', self.utils.all_installed_names())
|
|
||||||
self.assertIn('curl', self.utils.all_installed_names())
|
|
||||||
self.assertIn('lftp', self.utils.all_installed_names())
|
|
||||||
|
|
||||||
def test_read_build_tag(self):
|
def test_read_build_tag(self):
|
||||||
self.assertEqual('1', self.utils.read_sbo_build_tag('slpkg', 'system'))
|
self.assertEqual('1', self.utils.read_sbo_build_tag('slpkg', 'system'))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue