diff --git a/src/pacroller/checker.py b/src/pacroller/checker.py index 756aec2..1bcb83a 100644 --- a/src/pacroller/checker.py +++ b/src/pacroller/checker.py @@ -30,7 +30,7 @@ REGEX: Dict[str, Pattern] # get through lint class checkReport: def __init__(self, info: List[str] = None, warn: List[str] = None, crit: List[str] = None, changes: List[Tuple[str]] = None, - date: int = int(time)) -> None: + date: int = int(time())) -> None: self._info = info or list() self._warn = warn or list() self._crit = crit or list() @@ -86,7 +86,7 @@ class checkReport: ret.append("Package changes:") ret.extend([" " * indent + i for i in pkg_ret]) if len(ret) == 1: - ret.append('all systems go') + ret.append('nothing to show') return "\n".join(ret) def info(self, text: str) -> None: logger.debug(f'report info {text}') @@ -229,7 +229,7 @@ def _log_parser(log: List[str], report: checkReport) -> None: report.crit(f'ALPM {line=} is unknown') elif source == 'ALPM-SCRIPTLET': (_, _, _pmsg) = _split_log_line(log[ln-1]) - if _m := REGEX['s_upgrade_pkg'].match(_pmsg): + if _m := REGEX['l_upgrade'].match(_pmsg): pkg, *_ = _m.groups() elif _m := REGEX['l_install'].match(_pmsg): pkg, *_ = _m.groups() @@ -237,6 +237,8 @@ def _log_parser(log: List[str], report: checkReport) -> None: pkg, *_ = _m.groups() else: report.crit(f'{line=} has unknown SCRIPTLET output') + ln += 1 + continue logger.debug(f'.install start {pkg=}') while True: ln += 1 diff --git a/src/pacroller/config.json.example b/src/pacroller/config.json.example index d52f4b7..561902c 100644 --- a/src/pacroller/config.json.example +++ b/src/pacroller/config.json.example @@ -8,9 +8,9 @@ "hold": { "linux": "(.*)", "python": "[0-9]+[.]([0-9]+)[.][0-9]+[-][0-9]+" - } - 'ignored_pacnew': [ - '/etc/locale.gen', - '/etc/pacman.d/mirrorlist' + }, + "ignored_pacnew": [ + "/etc/locale.gen", + "/etc/pacman.d/mirrorlist" ] } diff --git a/src/pacroller/config.py b/src/pacroller/config.py index 09f0d56..5488205 100644 --- a/src/pacroller/config.py +++ b/src/pacroller/config.py @@ -27,7 +27,7 @@ EXTRA_SAFE = bool(_config.get('extra_safe', False)) SHELL = str(_config.get('shell', '/bin/bash')) HOLD = _config.get('hold', dict()) -for (k, v) in HOLD: +for (k, v) in HOLD.items(): assert isinstance(k, str) and isinstance(v, str) IGNORED_PACNEW = _config.get('ignored_pacnew', list()) diff --git a/src/pacroller/main.py b/src/pacroller/main.py index d414be2..2b545f7 100644 --- a/src/pacroller/main.py +++ b/src/pacroller/main.py @@ -68,8 +68,8 @@ class alpmCallback: def upgrade() -> List[str]: logger.info('upgrade start') - handle = pycman.config.init_with_config(PACMAN_CONFIG) pycman.config.cb_log = lambda *_: None + handle = pycman.config.init_with_config(PACMAN_CONFIG) localdb = handle.get_localdb() alpmCallback().setup_hdl(handle) t = handle.init_transaction() @@ -77,6 +77,7 @@ def upgrade() -> List[str]: t.sysupgrade(False) # no downgrade if len(t.to_add) + len(t.to_remove) == 0: logger.info('upgrade end, nothing to do') + exit(0) else: def examine_upgrade(toadd: List[pyalpm.Package], toremove: List[pyalpm.Package]) -> None: for pkg in toadd: