Updated for -current users

This commit is contained in:
Dimitris Zlatanidis 2024-03-25 00:34:27 +02:00
parent 43841a24f9
commit 9d5d981f81
5 changed files with 26 additions and 1 deletions

View file

@ -21,7 +21,8 @@
* Check for upgrade packages using the option --check
* MAKEFLAGS config to specify the number of jobs
* Support GPG verification
* Config NEW_PACKAGES for -current users
* Config NEW_PACKAGES for -current users and upgrade command
* Config REMOVED_PACKAGES for -current users upgrade command
- Bugfixes:
* Double view message when update repositories

View file

@ -38,6 +38,11 @@ DIALOG = true
# Default is false. [true/false]
NEW_PACKAGES = false
# This config is also for -current users and remove packages that are no longer
# exist in the repository when you run the upgrade command.
# Default is false. [true/false]
REMOVED_PACKAGES = false
# Choose ascii printable characters.
# If true, it uses the extended characters, otherwise the basic ones.
# Default is true. [true/false].

View file

@ -39,6 +39,7 @@ class Configs:
checksum_md5: bool = True
dialog: bool = True
new_packages: bool = False
removed_packages: bool = False
downloader: str = 'wget'
wget_options: str = '--c -q --progress=bar:force:noscroll --show-progress'
curl_options: str = ''
@ -84,6 +85,7 @@ class Configs:
checksum_md5: bool = config['CHECKSUM_MD5']
dialog: str = config['DIALOG']
new_packages: bool = config['NEW_PACKAGES']
removed_packages: bool = config['REMOVED_PACKAGES']
downloader: str = config['DOWNLOADER']
wget_options: str = config['WGET_OPTIONS']
curl_options: str = config['CURL_OPTIONS']

View file

@ -428,6 +428,7 @@ class Menu(Configs):
def upgrade(self) -> None:
command: str = Menu.upgrade.__name__
removed: list = []
if len(self.args) == 1:
@ -443,6 +444,16 @@ class Menu(Configs):
upgrade = Upgrade(self.repository, self.data)
packages: list = list(upgrade.packages())
for package in packages:
if package.endswith('_Removed.'):
removed.append(package.replace('_Removed.', ''))
if removed:
print('\nFound packages that are not existing in the repository:')
packages = [pkg for pkg in packages if not pkg.endswith('_Removed.')]
remove = RemovePackages(removed, self.flags)
remove.remove()
packages: list = self.choose.packages(self.data, packages, command)
if not packages:

View file

@ -27,6 +27,7 @@ class Upgrade(Configs):
def packages(self) -> Generator:
""" Returns the upgradable packages. """
print('\rRetrieving packages... ', end='')
if self.repository in [self.repos.slack_repo_name, self.repos.salixos_repo_name]:
installed_packages: list = []
installed: Generator = self.log_packages.glob('*')
@ -43,10 +44,15 @@ class Upgrade(Configs):
if self.is_package_upgradeable(inst.name):
yield name
if self.repository == self.repos.slack_repo_name and self.removed_packages:
if name not in self.data.keys():
yield name + '_Removed.'
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: