mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-02-07 08:46:21 +01:00
Updated for -current users
This commit is contained in:
parent
5900a24966
commit
0aacf595cd
3 changed files with 16 additions and 0 deletions
|
@ -33,6 +33,11 @@ CHECKSUM_MD5 = true
|
||||||
# Default is true. [true/false]
|
# Default is true. [true/false]
|
||||||
DIALOG = true
|
DIALOG = true
|
||||||
|
|
||||||
|
# This config is useful only for -current users. Adds and the new packages
|
||||||
|
# for installation when you run the upgrade command.
|
||||||
|
# Default is false. [true/false]
|
||||||
|
NEW_PACKAGES = false
|
||||||
|
|
||||||
# Choose ascii printable characters.
|
# Choose ascii printable characters.
|
||||||
# If true, it uses the extended characters, otherwise the basic ones.
|
# If true, it uses the extended characters, otherwise the basic ones.
|
||||||
# Default is true. [true/false].
|
# Default is true. [true/false].
|
||||||
|
|
|
@ -38,6 +38,7 @@ class Configs:
|
||||||
gpg_verification: bool = False
|
gpg_verification: bool = False
|
||||||
checksum_md5: bool = True
|
checksum_md5: bool = True
|
||||||
dialog: bool = True
|
dialog: bool = True
|
||||||
|
new_packages: bool = False
|
||||||
downloader: str = 'wget'
|
downloader: str = 'wget'
|
||||||
wget_options: str = '--c -q --progress=bar:force:noscroll --show-progress'
|
wget_options: str = '--c -q --progress=bar:force:noscroll --show-progress'
|
||||||
curl_options: str = ''
|
curl_options: str = ''
|
||||||
|
@ -82,6 +83,7 @@ class Configs:
|
||||||
gpg_verification: bool = config['GPG_VERIFICATION']
|
gpg_verification: bool = config['GPG_VERIFICATION']
|
||||||
checksum_md5: bool = config['CHECKSUM_MD5']
|
checksum_md5: bool = config['CHECKSUM_MD5']
|
||||||
dialog: str = config['DIALOG']
|
dialog: str = config['DIALOG']
|
||||||
|
new_packages: bool = config['NEW_PACKAGES']
|
||||||
downloader: str = config['DOWNLOADER']
|
downloader: str = config['DOWNLOADER']
|
||||||
wget_options: str = config['WGET_OPTIONS']
|
wget_options: str = config['WGET_OPTIONS']
|
||||||
curl_options: str = config['CURL_OPTIONS']
|
curl_options: str = config['CURL_OPTIONS']
|
||||||
|
|
|
@ -7,6 +7,7 @@ from pkg_resources import parse_version
|
||||||
from slpkg.configs import Configs
|
from slpkg.configs import Configs
|
||||||
from slpkg.utilities import Utilities
|
from slpkg.utilities import Utilities
|
||||||
from slpkg.repositories import Repositories
|
from slpkg.repositories import Repositories
|
||||||
|
from slpkg.views.asciibox import AsciiBox
|
||||||
|
|
||||||
|
|
||||||
class Upgrade(Configs):
|
class Upgrade(Configs):
|
||||||
|
@ -19,11 +20,13 @@ class Upgrade(Configs):
|
||||||
|
|
||||||
self.utils = Utilities()
|
self.utils = Utilities()
|
||||||
self.repos = Repositories()
|
self.repos = Repositories()
|
||||||
|
self.ascii = AsciiBox()
|
||||||
self.count_packages: int = 0
|
self.count_packages: int = 0
|
||||||
self.count_repos: list = []
|
self.count_repos: list = []
|
||||||
|
|
||||||
def packages(self) -> Generator:
|
def packages(self) -> Generator:
|
||||||
""" Returns the upgradable packages. """
|
""" Returns the upgradable packages. """
|
||||||
|
print('\rRetrieving packages... ', end='')
|
||||||
if self.repository in [self.repos.slack_repo_name, self.repos.salixos_repo_name]:
|
if self.repository in [self.repos.slack_repo_name, self.repos.salixos_repo_name]:
|
||||||
installed_packages: list = []
|
installed_packages: list = []
|
||||||
installed: Generator = self.log_packages.glob('*')
|
installed: Generator = self.log_packages.glob('*')
|
||||||
|
@ -40,6 +43,12 @@ class Upgrade(Configs):
|
||||||
if self.is_package_upgradeable(inst.name):
|
if self.is_package_upgradeable(inst.name):
|
||||||
yield name
|
yield name
|
||||||
|
|
||||||
|
if self.repository == self.repos.slack_repo_name and self.new_packages:
|
||||||
|
for name in self.data.keys():
|
||||||
|
if not self.utils.is_package_installed(name):
|
||||||
|
yield name
|
||||||
|
print(f'{self.bgreen}{self.ascii.done}{self.endc}')
|
||||||
|
|
||||||
def is_package_upgradeable(self, installed: str) -> bool:
|
def is_package_upgradeable(self, installed: str) -> bool:
|
||||||
inst_name: str = self.utils.split_package(installed)['name']
|
inst_name: str = self.utils.split_package(installed)['name']
|
||||||
if self.data.get(inst_name):
|
if self.data.get(inst_name):
|
||||||
|
|
Loading…
Add table
Reference in a new issue