mirror of
https://github.com/isjerryxiao/pacroller.git
synced 2024-11-15 04:42: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:
|
else:
|
||||||
report.crit(f'[NOM-ALPM] {msg}')
|
report.crit(f'[NOM-ALPM] {msg}')
|
||||||
elif source == 'ALPM-SCRIPTLET':
|
elif source == 'ALPM-SCRIPTLET':
|
||||||
(_, _, _pmsg) = _split_log_line(log[ln-1])
|
(_sourcem1, _, _pmsg) = _split_log_line(log[ln-1])
|
||||||
if _m := REGEX['l_upgrade'].match(_pmsg):
|
for action in {'upgrade', 'install', 'remove', 'downgrade', 'reinstall'}:
|
||||||
pkg, *_ = _m.groups()
|
if _m := REGEX[f"l_{action}"].match(_pmsg):
|
||||||
elif _m := REGEX['l_install'].match(_pmsg):
|
pkg, *_ = _m.groups()
|
||||||
pkg, *_ = _m.groups()
|
break
|
||||||
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()
|
|
||||||
else:
|
else:
|
||||||
report.crit(f'[NOM-SCRIPTLET] {_pmsg}')
|
report.crit(f'[NOM-SCRIPTLET] {_pmsg}')
|
||||||
ln += 1
|
ln += 1
|
||||||
|
action = 'unknown'
|
||||||
continue
|
continue
|
||||||
logger.debug(f'.install start {pkg=}')
|
logger.debug(f'.install start {pkg=} {action=}')
|
||||||
while True:
|
while True:
|
||||||
line = log[ln]
|
line = log[ln]
|
||||||
(_, source, msg) = _split_log_line(line)
|
(_, source, msg) = _split_log_line(line)
|
||||||
if source == 'ALPM-SCRIPTLET':
|
if source == 'ALPM-SCRIPTLET':
|
||||||
for r in (*(KNOWN_PACKAGE_OUTPUT.get('', [])), *(KNOWN_PACKAGE_OUTPUT.get(pkg, []))):
|
for r in (*(KNOWN_PACKAGE_OUTPUT.get('', [])), *(KNOWN_PACKAGE_OUTPUT.get(pkg, []))):
|
||||||
if match(r, msg):
|
if isinstance(r, dict):
|
||||||
logger.debug(f'.install output match {pkg=} {msg=} {r=}')
|
if action in r.get('action'):
|
||||||
break
|
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:
|
else:
|
||||||
report.warn(f'package {pkg} says {msg}')
|
report.warn(f'package {pkg} says {msg}')
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -22,13 +22,22 @@ KNOWN_HOOK_OUTPUT = {
|
||||||
r'==> Image generation successful.*',
|
r'==> Image generation successful.*',
|
||||||
r'[ ]+-> .+',
|
r'[ ]+-> .+',
|
||||||
r'ssh-.* .*',
|
r'ssh-.* .*',
|
||||||
],
|
r'==> Using default configuration file: \'/etc/mkinitcpio\.conf\'',
|
||||||
'70-dkms-upgrade.hook': [
|
|
||||||
r'==> dkms remove --no-depmod -m .* -v .* -k .*',
|
|
||||||
],
|
],
|
||||||
'70-dkms-install.hook': [
|
'70-dkms-install.hook': [
|
||||||
r'==> dkms install --no-depmod -m .* -v .* -k .*',
|
r'==> dkms install --no-depmod [^ ]+ -k [^ ]+',
|
||||||
r'==> depmod .*',
|
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
|
**KNOWN_HOOK_OUTPUT_OVERRIDE
|
||||||
}
|
}
|
||||||
|
@ -48,6 +57,7 @@ _keyring_output = [
|
||||||
r'gpg: depth:.+ valid:.+ signed:.+ trust:.+, .+, .+, .+, .+, .+',
|
r'gpg: depth:.+ valid:.+ signed:.+ trust:.+, .+, .+, .+, .+, .+',
|
||||||
r'gpg: key .+: no user ID for key signature packet of class .+',
|
r'gpg: key .+: no user ID for key signature packet of class .+',
|
||||||
r'gpg: inserting ownertrust of .+',
|
r'gpg: inserting ownertrust of .+',
|
||||||
|
r'gpg: changing ownertrust from .+ to .+',
|
||||||
r'[ ]+-> .+',
|
r'[ ]+-> .+',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -70,8 +80,8 @@ KNOWN_PACKAGE_OUTPUT = {
|
||||||
'fontconfig': [
|
'fontconfig': [
|
||||||
r'Rebuilding fontconfig cache\.\.\.',
|
r'Rebuilding fontconfig cache\.\.\.',
|
||||||
],
|
],
|
||||||
'nvidia-utils': [
|
'lib32-fontconfig': [
|
||||||
r'If you run into trouble with CUDA not being available, run nvidia-modprobe first\.',
|
r'Rebuilding 32-bit fontconfig cache\.\.\.',
|
||||||
],
|
],
|
||||||
'virtualbox': _vbox_output,
|
'virtualbox': _vbox_output,
|
||||||
'virtualbox-ext-oracle': _vbox_output,
|
'virtualbox-ext-oracle': _vbox_output,
|
||||||
|
@ -79,8 +89,20 @@ KNOWN_PACKAGE_OUTPUT = {
|
||||||
'virtualbox-ext-vnc-svn': _vbox_output,
|
'virtualbox-ext-vnc-svn': _vbox_output,
|
||||||
'tor-browser': [
|
'tor-browser': [
|
||||||
r'$',
|
r'$',
|
||||||
r'==> The copy of Tor Browser in your home directory will be upgraded at the',
|
{'action': ['upgrade'], 'regex': 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'==> 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
|
**KNOWN_PACKAGE_OUTPUT_OVERRIDE
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,15 +84,19 @@ def upgrade(interactive=False) -> List[str]:
|
||||||
)
|
)
|
||||||
if qp.returncode != 1:
|
if qp.returncode != 1:
|
||||||
qp.check_returncode()
|
qp.check_returncode()
|
||||||
sp = subprocess.run(
|
try:
|
||||||
sync_upgrade_cmd,
|
sp = subprocess.run(
|
||||||
stdin=subprocess.DEVNULL,
|
sync_upgrade_cmd,
|
||||||
stdout=subprocess.PIPE,
|
stdin=subprocess.DEVNULL,
|
||||||
stderr=subprocess.STDOUT,
|
stdout=subprocess.PIPE,
|
||||||
encoding='utf-8',
|
stderr=subprocess.STDOUT,
|
||||||
timeout=TIMEOUT,
|
encoding='utf-8',
|
||||||
check=True
|
timeout=TIMEOUT,
|
||||||
)
|
check=True
|
||||||
|
)
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
logger.error(f"upgrade check failed {e.returncode=} {e.output=}")
|
||||||
|
raise
|
||||||
upgrade_pkgnames = list()
|
upgrade_pkgnames = list()
|
||||||
upgrade_pkgs = list()
|
upgrade_pkgs = list()
|
||||||
for line in filter(None, qp.stdout.split('\n')):
|
for line in filter(None, qp.stdout.split('\n')):
|
||||||
|
|
Loading…
Reference in a new issue