mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 00:04:15 +02:00
[aur] fix update version check | [table] not showing update versions for some scenarios
This commit is contained in:
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
|
## [0.6.3] 2019-10-11
|
||||||
|
### Fixes
|
||||||
|
- AUR update check for some scenarios
|
||||||
|
- table not showing some update versions due to a strange Python String comparison behavior ( e.g: the string version '0.1.90' is being handled as higher than '0.1.120' )
|
||||||
|
|
||||||
## [0.6.2] 2019-10-02
|
## [0.6.2] 2019-10-02
|
||||||
### Improvements
|
### Improvements
|
||||||
- Update notifications showing the number of updates by type as well ( if they are from more than one packaging type )
|
- Update notifications showing the number of updates by type as well ( if they are from more than one packaging type )
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
__version__ = '0.6.2'
|
__version__ = '0.6.3'
|
||||||
__app_name__ = 'bauh'
|
__app_name__ = 'bauh'
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ from bauh.gems.arch.model import ArchPackage
|
|||||||
URL_PKG_DOWNLOAD = 'https://aur.archlinux.org/{}'
|
URL_PKG_DOWNLOAD = 'https://aur.archlinux.org/{}'
|
||||||
RE_LETTERS = re.compile(r'\.([a-zA-Z]+)-\d+$')
|
RE_LETTERS = re.compile(r'\.([a-zA-Z]+)-\d+$')
|
||||||
RE_ANY_LETTER = re.compile(r'[a-zA-Z]')
|
RE_ANY_LETTER = re.compile(r'[a-zA-Z]')
|
||||||
|
RE_VERSION_DELS = re.compile(r'[.:#@\-_]')
|
||||||
|
|
||||||
RE_SFX = ('r', 're', 'release')
|
RE_SFX = ('r', 're', 'release')
|
||||||
GA_SFX = ('ga', 'ge')
|
GA_SFX = ('ga', 'ge')
|
||||||
@@ -75,34 +76,26 @@ class ArchDataMapper:
|
|||||||
|
|
||||||
return nlatest > nversion
|
return nlatest > nversion
|
||||||
|
|
||||||
if not RE_ANY_LETTER.findall(latest_version) and not RE_ANY_LETTER.findall(version):
|
latest_split = RE_VERSION_DELS.split(latest_version)
|
||||||
latest_no_rel = latest_version.split('-')
|
version_split = RE_VERSION_DELS.split(version)
|
||||||
version_no_rel = version.split('-')
|
|
||||||
|
|
||||||
latest_split = latest_no_rel[0].split('.')
|
for idx in range(len(latest_split)):
|
||||||
version_split = version_no_rel[0].split('.')
|
if idx < len(version_split):
|
||||||
|
latest_part = latest_split[idx]
|
||||||
|
version_part = version_split[idx]
|
||||||
|
|
||||||
for idx in range(len(latest_split)):
|
if latest_part != version_part:
|
||||||
if idx < len(version_split):
|
if RE_ANY_LETTER.findall(latest_part) or RE_ANY_LETTER.findall(version_part):
|
||||||
dif = int(latest_split[idx]) - int(version_split[idx])
|
return latest_part > version_part
|
||||||
|
|
||||||
if dif > 0:
|
|
||||||
return True
|
|
||||||
elif dif < 0:
|
|
||||||
return False
|
|
||||||
else:
|
else:
|
||||||
continue
|
dif = int(latest_part) - int(version_part)
|
||||||
|
|
||||||
if len(latest_no_rel) > 1 and len(version_no_rel) > 1:
|
|
||||||
if not RE_ANY_LETTER.findall(latest_no_rel[1]) and not RE_ANY_LETTER.findall(version_no_rel[1]):
|
|
||||||
return int(latest_no_rel[1]) > int(version_no_rel[1])
|
|
||||||
else:
|
|
||||||
return latest_no_rel[1] > version_no_rel[1]
|
|
||||||
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
return latest_version > version
|
|
||||||
|
|
||||||
|
if dif > 0:
|
||||||
|
return True
|
||||||
|
elif dif < 0:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
continue
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def fill_package_build(self, pkg: ArchPackage):
|
def fill_package_build(self, pkg: ArchPackage):
|
||||||
|
|||||||
@@ -25,25 +25,28 @@ def load_managers(locale: str, context: ApplicationContext, config: Configuratio
|
|||||||
|
|
||||||
for f in os.scandir(ROOT_DIR + '/gems'):
|
for f in os.scandir(ROOT_DIR + '/gems'):
|
||||||
if f.is_dir() and f.name != '__pycache__':
|
if f.is_dir() and f.name != '__pycache__':
|
||||||
module = pkgutil.find_loader('bauh.gems.{}.controller'.format(f.name)).load_module()
|
loader = pkgutil.find_loader('bauh.gems.{}.controller'.format(f.name))
|
||||||
|
|
||||||
manager_class = find_manager(module)
|
if loader:
|
||||||
|
module = loader.load_module()
|
||||||
|
|
||||||
if manager_class:
|
manager_class = find_manager(module)
|
||||||
if locale:
|
|
||||||
locale_path = '{}/resources/locale'.format(f.path)
|
|
||||||
|
|
||||||
if os.path.exists(locale_path):
|
if manager_class:
|
||||||
context.i18n.update(util.get_locale_keys(locale, locale_path)[1])
|
if locale:
|
||||||
|
locale_path = '{}/resources/locale'.format(f.path)
|
||||||
|
|
||||||
man = manager_class(context=context)
|
if os.path.exists(locale_path):
|
||||||
|
context.i18n.update(util.get_locale_keys(locale, locale_path)[1])
|
||||||
|
|
||||||
if config.enabled_gems is None:
|
man = manager_class(context=context)
|
||||||
man.set_enabled(man.is_default_enabled())
|
|
||||||
else:
|
|
||||||
man.set_enabled(f.name in config.enabled_gems)
|
|
||||||
|
|
||||||
managers.append(man)
|
if config.enabled_gems is None:
|
||||||
|
man.set_enabled(man.is_default_enabled())
|
||||||
|
else:
|
||||||
|
man.set_enabled(f.name in config.enabled_gems)
|
||||||
|
|
||||||
|
managers.append(man)
|
||||||
|
|
||||||
return managers
|
return managers
|
||||||
|
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ class AppsTable(QTableWidget):
|
|||||||
label_version.setStyleSheet("color: #20A435; font-weight: bold")
|
label_version.setStyleSheet("color: #20A435; font-weight: bold")
|
||||||
tooltip = self.i18n['version.installed_outdated']
|
tooltip = self.i18n['version.installed_outdated']
|
||||||
|
|
||||||
if pkg.model.installed and pkg.model.update and pkg.model.version and pkg.model.latest_version and pkg.model.version < pkg.model.latest_version:
|
if pkg.model.installed and pkg.model.update and pkg.model.version and pkg.model.latest_version and pkg.model.version != pkg.model.latest_version:
|
||||||
tooltip = '{}. {}: {}'.format(tooltip, self.i18n['version.latest'], pkg.model.latest_version)
|
tooltip = '{}. {}: {}'.format(tooltip, self.i18n['version.latest'], pkg.model.latest_version)
|
||||||
label_version.setText(label_version.text() + ' > {}'.format(pkg.model.latest_version))
|
label_version.setText(label_version.text() + ' > {}'.format(pkg.model.latest_version))
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ class ArchDataMapperTest(TestCase):
|
|||||||
self.assertFalse(ArchDataMapper.check_update('77.0.3865.900-1', '77.0.3865.120-1'))
|
self.assertFalse(ArchDataMapper.check_update('77.0.3865.900-1', '77.0.3865.120-1'))
|
||||||
self.assertTrue(ArchDataMapper.check_update('77.0.3865.120-1', '77.0.3865.900-1'))
|
self.assertTrue(ArchDataMapper.check_update('77.0.3865.120-1', '77.0.3865.900-1'))
|
||||||
self.assertFalse(ArchDataMapper.check_update('77.0.3865.120-1', '77.0.3865.90-1'))
|
self.assertFalse(ArchDataMapper.check_update('77.0.3865.120-1', '77.0.3865.90-1'))
|
||||||
|
self.assertTrue(ArchDataMapper.check_update('77.0.3865.a-1', '77.0.3865.b-1'))
|
||||||
|
self.assertFalse(ArchDataMapper.check_update('77.0.b.0-1', '77.0.a.1-1'))
|
||||||
|
|
||||||
def test_check_update_no_suffix_3_x_2_digits(self):
|
def test_check_update_no_suffix_3_x_2_digits(self):
|
||||||
self.assertTrue(ArchDataMapper.check_update('1.0.0-1', '1.1-1'))
|
self.assertTrue(ArchDataMapper.check_update('1.0.0-1', '1.1-1'))
|
||||||
|
|||||||
Reference in New Issue
Block a user