mirror of
https://github.com/isjerryxiao/pacroller.git
synced 2024-12-23 22:59:24 +08:00
update known_output
This commit is contained in:
parent
5792891394
commit
0d24257824
3 changed files with 60 additions and 33 deletions
|
@ -240,30 +240,31 @@ def _log_parser(log: List[str], report: checkReport) -> None:
|
|||
else:
|
||||
report.crit(f'[NOM-ALPM] {msg}')
|
||||
elif source == 'ALPM-SCRIPTLET':
|
||||
(_, _, _pmsg) = _split_log_line(log[ln-1])
|
||||
if _m := REGEX['l_upgrade'].match(_pmsg):
|
||||
pkg, *_ = _m.groups()
|
||||
elif _m := REGEX['l_install'].match(_pmsg):
|
||||
pkg, *_ = _m.groups()
|
||||
elif _m := REGEX['l_remove'].match(_pmsg):
|
||||
pkg, *_ = _m.groups()
|
||||
elif _m := REGEX['l_downgrade'].match(_pmsg):
|
||||
pkg, *_ = _m.groups()
|
||||
elif _m := REGEX['l_reinstall'].match(_pmsg):
|
||||
pkg, *_ = _m.groups()
|
||||
(_sourcem1, _, _pmsg) = _split_log_line(log[ln-1])
|
||||
for action in {'upgrade', 'install', 'remove', 'downgrade', 'reinstall'}:
|
||||
if _m := REGEX[f"l_{action}"].match(_pmsg):
|
||||
pkg, *_ = _m.groups()
|
||||
break
|
||||
else:
|
||||
report.crit(f'[NOM-SCRIPTLET] {_pmsg}')
|
||||
ln += 1
|
||||
action = 'unknown'
|
||||
continue
|
||||
logger.debug(f'.install start {pkg=}')
|
||||
logger.debug(f'.install start {pkg=} {action=}')
|
||||
while True:
|
||||
line = log[ln]
|
||||
(_, source, msg) = _split_log_line(line)
|
||||
if source == 'ALPM-SCRIPTLET':
|
||||
for r in (*(KNOWN_PACKAGE_OUTPUT.get('', [])), *(KNOWN_PACKAGE_OUTPUT.get(pkg, []))):
|
||||
if match(r, msg):
|
||||
logger.debug(f'.install output match {pkg=} {msg=} {r=}')
|
||||
break
|
||||
if isinstance(r, dict):
|
||||
if action in r.get('action'):
|
||||
if match(r.get('regex'), msg):
|
||||
logger.debug(f'.install output match {pkg=} {action=} {msg=} {r=}')
|
||||
break
|
||||
else:
|
||||
if match(r, msg):
|
||||
logger.debug(f'.install output match {pkg=} {msg=} {r=}')
|
||||
break
|
||||
else:
|
||||
report.warn(f'package {pkg} says {msg}')
|
||||
else:
|
||||
|
|
|
@ -22,13 +22,22 @@ KNOWN_HOOK_OUTPUT = {
|
|||
r'==> Image generation successful.*',
|
||||
r'[ ]+-> .+',
|
||||
r'ssh-.* .*',
|
||||
],
|
||||
'70-dkms-upgrade.hook': [
|
||||
r'==> dkms remove --no-depmod -m .* -v .* -k .*',
|
||||
r'==> Using default configuration file: \'/etc/mkinitcpio\.conf\'',
|
||||
],
|
||||
'70-dkms-install.hook': [
|
||||
r'==> dkms install --no-depmod -m .* -v .* -k .*',
|
||||
r'==> depmod .*',
|
||||
r'==> dkms install --no-depmod [^ ]+ -k [^ ]+',
|
||||
r'==> depmod [^ ]+',
|
||||
],
|
||||
'71-dkms-remove.hook': [
|
||||
r'==> dkms remove --no-depmod [^ ]+ -k [^ ]+',
|
||||
r'==> depmod [^ ]+',
|
||||
],
|
||||
'70-dkms-upgrade.hook': [
|
||||
r'==> dkms remove --no-depmod [^ ]+ -k [^ ]+',
|
||||
r'==> depmod [^ ]+',
|
||||
],
|
||||
'90-update-appstream-cache.hook': [
|
||||
r'✔ Metadata cache was updated successfully\.',
|
||||
],
|
||||
**KNOWN_HOOK_OUTPUT_OVERRIDE
|
||||
}
|
||||
|
@ -48,6 +57,7 @@ _keyring_output = [
|
|||
r'gpg: depth:.+ valid:.+ signed:.+ trust:.+, .+, .+, .+, .+, .+',
|
||||
r'gpg: key .+: no user ID for key signature packet of class .+',
|
||||
r'gpg: inserting ownertrust of .+',
|
||||
r'gpg: changing ownertrust from .+ to .+',
|
||||
r'[ ]+-> .+',
|
||||
]
|
||||
|
||||
|
@ -70,8 +80,8 @@ KNOWN_PACKAGE_OUTPUT = {
|
|||
'fontconfig': [
|
||||
r'Rebuilding fontconfig cache\.\.\.',
|
||||
],
|
||||
'nvidia-utils': [
|
||||
r'If you run into trouble with CUDA not being available, run nvidia-modprobe first\.',
|
||||
'lib32-fontconfig': [
|
||||
r'Rebuilding 32-bit fontconfig cache\.\.\.',
|
||||
],
|
||||
'virtualbox': _vbox_output,
|
||||
'virtualbox-ext-oracle': _vbox_output,
|
||||
|
@ -79,8 +89,20 @@ KNOWN_PACKAGE_OUTPUT = {
|
|||
'virtualbox-ext-vnc-svn': _vbox_output,
|
||||
'tor-browser': [
|
||||
r'$',
|
||||
r'==> The copy of Tor Browser in your home directory will be upgraded at the',
|
||||
r'==> first time you run it as your normal user\. Just start it and have fun!',
|
||||
{'action': ['upgrade'], 'regex': r'==> The copy of Tor Browser in your home directory will be upgraded at the'},
|
||||
{'action': ['upgrade'], 'regex': r'==> first time you run it as your normal user\. Just start it and have fun!'},
|
||||
],
|
||||
'grub': [
|
||||
{'action': ['upgrade'], 'regex': r':: To use the new features provided in this GRUB update, it is recommended'},
|
||||
{'action': ['upgrade'], 'regex': r' to install it to the MBR or UEFI\. Due to potential configuration'},
|
||||
{'action': ['upgrade'], 'regex': r' incompatibilities, it is advised to run both, installation and generation'},
|
||||
{'action': ['upgrade'], 'regex': r' of configuration:'},
|
||||
{'action': ['upgrade'], 'regex': r' \$ grub-install \.\.\.'},
|
||||
{'action': ['upgrade'], 'regex': r' \$ grub-mkconfig -o /boot/grub/grub\.cfg'},
|
||||
],
|
||||
'nvidia-utils': [
|
||||
{'action': ['upgrade'], 'regex': r'If you run into trouble with CUDA not being available, run nvidia-modprobe first\.'},
|
||||
{'action': ['upgrade'], 'regex': r'If you use GDM on Wayland, you might have to run systemctl enable --now nvidia-resume\.service'},
|
||||
],
|
||||
**KNOWN_PACKAGE_OUTPUT_OVERRIDE
|
||||
}
|
||||
|
|
|
@ -84,15 +84,19 @@ def upgrade(interactive=False) -> List[str]:
|
|||
)
|
||||
if qp.returncode != 1:
|
||||
qp.check_returncode()
|
||||
sp = subprocess.run(
|
||||
sync_upgrade_cmd,
|
||||
stdin=subprocess.DEVNULL,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
encoding='utf-8',
|
||||
timeout=TIMEOUT,
|
||||
check=True
|
||||
)
|
||||
try:
|
||||
sp = subprocess.run(
|
||||
sync_upgrade_cmd,
|
||||
stdin=subprocess.DEVNULL,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
encoding='utf-8',
|
||||
timeout=TIMEOUT,
|
||||
check=True
|
||||
)
|
||||
except subprocess.CalledProcessError as e:
|
||||
logger.error(f"upgrade check failed {e.returncode=} {e.output=}")
|
||||
raise
|
||||
upgrade_pkgnames = list()
|
||||
upgrade_pkgs = list()
|
||||
for line in filter(None, qp.stdout.split('\n')):
|
||||
|
|
Loading…
Reference in a new issue