Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pr/173'
Browse files Browse the repository at this point in the history
* origin/pr/173:
  Sort list of updated, installed & removed packages

Pull request description:

resolves: QubesOS/qubes-issues#9617

also adding missing docstrings to make pylint happier
  • Loading branch information
marmarek committed Dec 17, 2024
2 parents 8fa2929 + ef1b36a commit aa27f80
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions vmupdate/agent/source/common/package_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
""" package manager for VMs """
import io
import logging
import subprocess
Expand All @@ -28,6 +29,7 @@


class PackageManager:
""" main package manager class """
def __init__(self, log_handler, log_level):
self.package_manager: Optional[str] = None
self.log = logging.getLogger(
Expand Down Expand Up @@ -216,15 +218,15 @@ def _print_changes(self, changes):
result = ProcessResult()
result.out += self._print_to_string("Installed packages:")
if changes["installed"]:
for pkg in changes["installed"]:
for pkg in sorted(changes["installed"]):
result.out += self._print_to_string(
pkg, changes["installed"][pkg])
else:
result.out += self._print_to_string("None")

result.out += self._print_to_string("Updated packages:")
if changes["updated"]:
for pkg in changes["updated"]:
for pkg in sorted(changes["updated"]):
result.out += self._print_to_string(
pkg,
str(changes["updated"][pkg]["old"])[2:-2]
Expand All @@ -235,7 +237,7 @@ def _print_changes(self, changes):

result.out += self._print_to_string("Removed packages:")
if changes["removed"]:
for pkg in changes["removed"]:
for pkg in sorted(changes["removed"]):
result.out += self._print_to_string(
pkg, changes["removed"][pkg])
else:
Expand Down

0 comments on commit aa27f80

Please sign in to comment.