fix version calculation on gentoo

This commit is contained in:
Fredrik Eriksson 2021-07-04 14:52:35 +02:00
parent f5adcbc140
commit 214ec6abad
Signed by: feffe
GPG Key ID: F4329687B0FA7F8D

View File

@ -102,10 +102,7 @@ def pkg_upgrade():
_sync_portage() _sync_portage()
# [ebuild U ] media-plugins/alsa-plugins-1.1.8 [1.1.6] # [ebuild U ] media-plugins/alsa-plugins-1.1.8 [1.1.6]
pretend_re = re.compile(r'^\[(?:ebuild|binary) ([^\]]*)\] ([^ ]+)( \[[^\]]+\])?') pretend_re = re.compile(r'^\[(?:ebuild|binary) ([^\]]*)\] ([^ ]+?)-(\d[-\.\w]*)( \[[^\]]+\])?')
# media-plugins/alsa-plugins-1.1.8
version_re = re.compile(r'^(.*/.*)-(\d+.*)$')
ignore_re = re.compile(r'^(|.*caus.* rebuilds.*|.*scheduled for merge.*|.*waiting for lock on.*)$') ignore_re = re.compile(r'^(|.*caus.* rebuilds.*|.*scheduled for merge.*|.*waiting for lock on.*)$')
default_version_sens = conf.getint('default', 'version_sensitivity', fallback=1) default_version_sens = conf.getint('default', 'version_sensitivity', fallback=1)
@ -131,20 +128,18 @@ def pkg_upgrade():
continue continue
status = match.group(1) status = match.group(1)
name = match.group(2) name = match.group(2)
old = match.group(3) new = match.group(3)
old = match.group(4)
if not old: if not old:
continue continue
old = old.strip(' []') old = old.strip(' []')
nmatch = re.match(version_re, name)
name = nmatch.group(1)
version = nmatch.group(2)
sens = conf.getint('packages', name, fallback=default_version_sens) sens = conf.getint('packages', name, fallback=default_version_sens)
common = sau.helpers.version_diff(version, old) common = sau.helpers.version_diff(new, old)
if sens >= common: if sens >= common:
log.info('{} -- {} -> {} configured level {} >= pkg level {}'.format(name, old, version, sens, common)) log.info('{} -- {} -> {} configured level {} >= pkg level {}'.format(name, old, new, sens, common))
else: else:
log.warning('{} -- {} -> {} configured level {} < pkg level {}'.format(name, old, version, sens, common)) log.warning('{} -- {} -> {} configured level {} < pkg level {}'.format(name, old, new, sens, common))
do_rebuild = False do_rebuild = False
if not do_rebuild: if not do_rebuild: