From 4cee32c0e9d1d166dae6d1eff033bc04ad45a6c2 Mon Sep 17 00:00:00 2001 From: k4z4n0v4 <46030560+k4z4n0v4@users.noreply.github.com> Date: Mon, 1 Apr 2024 14:12:56 +0400 Subject: [PATCH] Fix pacman interaction with new realtime output --- .gitignore | 2 ++ vmupdate/agent/source/pacman/pacman_cli.py | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index d0d50cfe..5907cf54 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ rpm/ pkgs/ + +__pycache__/ diff --git a/vmupdate/agent/source/pacman/pacman_cli.py b/vmupdate/agent/source/pacman/pacman_cli.py index b2dd3fa4..c1f73ee0 100644 --- a/vmupdate/agent/source/pacman/pacman_cli.py +++ b/vmupdate/agent/source/pacman/pacman_cli.py @@ -19,7 +19,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, # USA. -from typing import List +from typing import List,Dict from source.common.package_manager import PackageManager from source.common.process_result import ProcessResult @@ -28,7 +28,7 @@ class PACMANCLI(PackageManager): def __init__(self, log_handler, log_level): super().__init__(log_handler, log_level) - self.package_manager: str = "pacman" + self.package_manager = "pacman" def refresh(self, hard_fail: bool) -> ProcessResult: """ @@ -40,7 +40,7 @@ def refresh(self, hard_fail: bool) -> ProcessResult: cmd = [self.package_manager, "-Sy"] return self.run_cmd(cmd) - def get_packages(self): + def get_packages(self) -> Dict[str, List[str]]: """ Use pacman to return the installed packages and their versions. """ @@ -48,9 +48,9 @@ def get_packages(self): cmd = [self.package_manager, "-Q"] # EXAMPLE OUTPUT: # qubes-vm-core 4.2.25-1 - result = self.run_cmd(cmd) + result = self.run_cmd(cmd, realtime=False) - packages = {} + packages: Dict[str, List[str]] = {} for line in result.out.splitlines(): cols = line.split() package, version = cols