mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-06 22:54:16 +02:00
[aur] fix -> update-checking for some scenarios described in Manjaro's forum
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.7.1] 2019-
|
||||||
|
### Fixes
|
||||||
|
- AUR:
|
||||||
|
- update-checking for some scenarios
|
||||||
|
|
||||||
## [0.7.0] 2019-10-18
|
## [0.7.0] 2019-10-18
|
||||||
### Features
|
### Features
|
||||||
- AppImage support ( see below )
|
- AppImage support ( see below )
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
__version__ = '0.7.0'
|
__version__ = '0.7.1'
|
||||||
__app_name__ = 'bauh'
|
__app_name__ = 'bauh'
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|||||||
@@ -7,8 +7,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_VERSION_SPLIT = re.compile(r'[a-zA-Z]+|\d+|[\.\-_@#]+')
|
||||||
RE_VERSION_DELS = re.compile(r'[.:#@\-_]')
|
|
||||||
|
|
||||||
RE_SFX = ('r', 're', 'release')
|
RE_SFX = ('r', 're', 'release')
|
||||||
GA_SFX = ('ga', 'ge')
|
GA_SFX = ('ga', 'ge')
|
||||||
@@ -76,19 +75,18 @@ class ArchDataMapper:
|
|||||||
|
|
||||||
return nlatest > nversion
|
return nlatest > nversion
|
||||||
|
|
||||||
latest_split = RE_VERSION_DELS.split(latest_version)
|
latest_split = RE_VERSION_SPLIT.findall(latest_version)
|
||||||
version_split = RE_VERSION_DELS.split(version)
|
current_split = RE_VERSION_SPLIT.findall(version)
|
||||||
|
|
||||||
for idx in range(len(latest_split)):
|
for idx in range(len(latest_split)):
|
||||||
if idx < len(version_split):
|
if idx < len(current_split):
|
||||||
latest_part = latest_split[idx]
|
latest_part = latest_split[idx]
|
||||||
version_part = version_split[idx]
|
current_part = current_split[idx]
|
||||||
|
|
||||||
if latest_part != version_part:
|
if latest_part != current_part:
|
||||||
if RE_ANY_LETTER.findall(latest_part) or RE_ANY_LETTER.findall(version_part):
|
|
||||||
return latest_part > version_part
|
try:
|
||||||
else:
|
dif = int(latest_part) - int(current_part)
|
||||||
dif = int(latest_part) - int(version_part)
|
|
||||||
|
|
||||||
if dif > 0:
|
if dif > 0:
|
||||||
return True
|
return True
|
||||||
@@ -96,6 +94,14 @@ class ArchDataMapper:
|
|||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
except ValueError:
|
||||||
|
if latest_part.isdigit():
|
||||||
|
return True
|
||||||
|
elif current_part.isdigit():
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return latest_part > current_part
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def fill_package_build(self, pkg: ArchPackage):
|
def fill_package_build(self, pkg: ArchPackage):
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ class ArchDataMapperTest(TestCase):
|
|||||||
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.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'))
|
self.assertFalse(ArchDataMapper.check_update('77.0.b.0-1', '77.0.a.1-1'))
|
||||||
|
self.assertFalse(ArchDataMapper.check_update('r25.e22697c-1', 'r8.19fe011-1'))
|
||||||
|
self.assertFalse(ArchDataMapper.check_update('1.1.0.r11.caacf30-1', 'r65.4c7144a-1'))
|
||||||
|
self.assertFalse(ArchDataMapper.check_update('1.2.16.r688.8b2c199-1', 'r2105.e91f0e9-3'))
|
||||||
|
|
||||||
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