mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-18 10:26:29 +01:00
Updated for -current users
This commit is contained in:
parent
43841a24f9
commit
9d5d981f81
5 changed files with 26 additions and 1 deletions
|
@ -21,7 +21,8 @@
|
||||||
* Check for upgrade packages using the option --check
|
* Check for upgrade packages using the option --check
|
||||||
* MAKEFLAGS config to specify the number of jobs
|
* MAKEFLAGS config to specify the number of jobs
|
||||||
* Support GPG verification
|
* 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:
|
- Bugfixes:
|
||||||
* Double view message when update repositories
|
* Double view message when update repositories
|
||||||
|
|
|
@ -38,6 +38,11 @@ DIALOG = true
|
||||||
# Default is false. [true/false]
|
# Default is false. [true/false]
|
||||||
NEW_PACKAGES = 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.
|
# 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].
|
||||||
|
|
|
@ -39,6 +39,7 @@ class Configs:
|
||||||
checksum_md5: bool = True
|
checksum_md5: bool = True
|
||||||
dialog: bool = True
|
dialog: bool = True
|
||||||
new_packages: bool = False
|
new_packages: bool = False
|
||||||
|
removed_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 = ''
|
||||||
|
@ -84,6 +85,7 @@ class Configs:
|
||||||
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']
|
new_packages: bool = config['NEW_PACKAGES']
|
||||||
|
removed_packages: bool = config['REMOVED_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']
|
||||||
|
|
|
@ -428,6 +428,7 @@ class Menu(Configs):
|
||||||
|
|
||||||
def upgrade(self) -> None:
|
def upgrade(self) -> None:
|
||||||
command: str = Menu.upgrade.__name__
|
command: str = Menu.upgrade.__name__
|
||||||
|
removed: list = []
|
||||||
|
|
||||||
if len(self.args) == 1:
|
if len(self.args) == 1:
|
||||||
|
|
||||||
|
@ -443,6 +444,16 @@ class Menu(Configs):
|
||||||
upgrade = Upgrade(self.repository, self.data)
|
upgrade = Upgrade(self.repository, self.data)
|
||||||
packages: list = list(upgrade.packages())
|
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)
|
packages: list = self.choose.packages(self.data, packages, command)
|
||||||
|
|
||||||
if not packages:
|
if not packages:
|
||||||
|
|
|
@ -27,6 +27,7 @@ class Upgrade(Configs):
|
||||||
def packages(self) -> Generator:
|
def packages(self) -> Generator:
|
||||||
""" Returns the upgradable packages. """
|
""" Returns the upgradable packages. """
|
||||||
print('\rRetrieving packages... ', end='')
|
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('*')
|
||||||
|
@ -43,10 +44,15 @@ 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.removed_packages:
|
||||||
|
if name not in self.data.keys():
|
||||||
|
yield name + '_Removed.'
|
||||||
|
|
||||||
if self.repository == self.repos.slack_repo_name and self.new_packages:
|
if self.repository == self.repos.slack_repo_name and self.new_packages:
|
||||||
for name in self.data.keys():
|
for name in self.data.keys():
|
||||||
if not self.utils.is_package_installed(name):
|
if not self.utils.is_package_installed(name):
|
||||||
yield name
|
yield name
|
||||||
|
|
||||||
print(f'{self.bgreen}{self.ascii.done}{self.endc}')
|
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:
|
||||||
|
|
Loading…
Reference in a new issue