mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-18 10:26:29 +01:00
Updated for upgrade packages
This commit is contained in:
parent
5f872f0ea1
commit
ca1934be26
2 changed files with 21 additions and 9 deletions
|
@ -1,9 +1,12 @@
|
||||||
## slpkg - ChangeLog
|
## slpkg - ChangeLog
|
||||||
|
|
||||||
### 5.0.1 - 28/03/2024
|
### 5.0.1 - 29/03/2024
|
||||||
- Updated:
|
- Updated:
|
||||||
* Updated to check upgrade packages against all repositories (slpkg upgrade --repository='*' --check)
|
* Updated to check upgrade packages against all repositories (slpkg upgrade --repository='*' --check)
|
||||||
|
|
||||||
|
- Bugfixes:
|
||||||
|
* Upgrade packages for -current version (Thanks to Marav)
|
||||||
|
|
||||||
### 5.0.0 - 24/03/2024
|
### 5.0.0 - 24/03/2024
|
||||||
- Updated:
|
- Updated:
|
||||||
* Blacklist using regex pattern
|
* Blacklist using regex pattern
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Generator
|
from typing import Generator
|
||||||
from pkg_resources import parse_version
|
from packaging.version import parse
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from slpkg.configs import Configs
|
from slpkg.configs import Configs
|
||||||
|
@ -62,31 +62,40 @@ class Upgrade(Configs):
|
||||||
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):
|
||||||
repo_package: str = self.data[inst_name]['package'][:-4]
|
repo_version: str = self.data[inst_name]['version']
|
||||||
|
repo_build: str = self.data[inst_name]['build']
|
||||||
|
inst_version: str = self.utils.split_package(installed)['version']
|
||||||
|
inst_build: str = self.utils.split_package(installed)['build']
|
||||||
try:
|
try:
|
||||||
if parse_version(repo_package) > parse_version(installed):
|
if parse(repo_version) > parse(inst_version):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
if parse(repo_version) == parse(inst_version):
|
||||||
|
if repo_build > inst_build:
|
||||||
|
return True
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return False
|
return False
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def check_packages(self) -> None:
|
def check_packages(self) -> None:
|
||||||
|
repo_data: dict = {}
|
||||||
found_packages: dict = {}
|
found_packages: dict = {}
|
||||||
|
|
||||||
if self.repository == '*':
|
if self.repository == '*':
|
||||||
|
repo_data: dict = self.data
|
||||||
self.installed_packages: list = list(self.log_packages.glob('*'))
|
self.installed_packages: list = list(self.log_packages.glob('*'))
|
||||||
else:
|
else:
|
||||||
self.load_installed_packages()
|
self.load_installed_packages()
|
||||||
self.data[self.repository] = self.data
|
repo_data[self.repository] = self.data
|
||||||
|
|
||||||
for repo, data in self.data.items():
|
|
||||||
|
|
||||||
|
for repo, data in repo_data.items():
|
||||||
for installed in self.installed_packages:
|
for installed in self.installed_packages:
|
||||||
name: str = self.utils.split_package(installed.name)['name']
|
name: str = self.utils.split_package(installed.name)['name']
|
||||||
|
|
||||||
if data.get(name):
|
if data.get(name):
|
||||||
repo_package: str = data[name]['package'][:-4]
|
self.data: dict = data
|
||||||
|
|
||||||
if parse_version(repo_package) > parse_version(installed.name):
|
if self.is_package_upgradeable(installed.name):
|
||||||
self.id += 1
|
self.id += 1
|
||||||
self.sum_upgrade += 1
|
self.sum_upgrade += 1
|
||||||
inst_version: str = self.utils.split_package(installed.name)['version']
|
inst_version: str = self.utils.split_package(installed.name)['version']
|
||||||
|
|
Loading…
Reference in a new issue