Skip to content

Commit

Permalink
[flatpak] Add flatpak pkg manager
Browse files Browse the repository at this point in the history
Related: RH SUPDEV-136

Signed-off-by: Jose Castillo <[email protected]>
  • Loading branch information
jcastill authored and TurboTurtle committed Oct 17, 2023
1 parent 6f1ea82 commit fc8333e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
9 changes: 7 additions & 2 deletions sos/policies/distros/redhat.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
ATOMIC)
from sos.policies.distros import LinuxPolicy, ENV_HOST_SYSROOT
from sos.policies.package_managers.rpm import RpmPackageManager
from sos.policies.package_managers.flatpak import FlatpakPackageManager
from sos.policies.package_managers import MultiPackageManager
from sos.utilities import bold
from sos import _sos as _

Expand Down Expand Up @@ -57,8 +59,11 @@ def __init__(self, sysroot=None, init=None, probe_runtime=True,
remote_exec=remote_exec)
self.usrmove = False

self.package_manager = RpmPackageManager(chroot=self.sysroot,
remote_exec=remote_exec)
self.package_manager = MultiPackageManager(
primary=RpmPackageManager,
fallbacks=[FlatpakPackageManager],
chroot=self.sysroot,
remote_exec=remote_exec)

self.valid_subclasses += [RedHatPlugin]

Expand Down
30 changes: 30 additions & 0 deletions sos/policies/package_managers/flatpak.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2023 Red Hat, Inc. Jose Castillo <[email protected]>

# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution for further information.

from sos.policies.package_managers import PackageManager


class FlatpakPackageManager(PackageManager):
"""Package Manager for Flatpak distributions
"""

query_command = 'flatpak list --columns=name,version'
query_path_command = ''
files_command = ''
verify_command = ''
verify_filter = ''

def _parse_pkg_list(self, pkg_list):
for line in pkg_list.splitlines():
pkg = line.split()
name, version = pkg[0], pkg[1]
yield (name, version, None)

# vim: set et ts=4 sw=4 :

0 comments on commit fc8333e

Please sign in to comment.