aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose Castillo <jcastillo@redhat.com>2023-10-13 16:06:31 +0100
committerJake Hunsaker <jacob.r.hunsaker@gmail.com>2023-10-17 07:58:25 -0700
commitfc8333e0d4b21840f111413b7b48591c91437de3 (patch)
tree072211ede9db532a2886d533dc3c6bdd2e5c6275
parent6f1ea82f05e16953443e8ac25712ee9145ffe5e2 (diff)
downloadsos-fc8333e0d4b21840f111413b7b48591c91437de3.tar.gz
[flatpak] Add flatpak pkg manager
Related: RH SUPDEV-136 Signed-off-by: Jose Castillo <jcastillo@redhat.com>
-rw-r--r--sos/policies/distros/redhat.py9
-rw-r--r--sos/policies/package_managers/flatpak.py30
2 files changed, 37 insertions, 2 deletions
diff --git a/sos/policies/distros/redhat.py b/sos/policies/distros/redhat.py
index 15241e27..bdbe8f95 100644
--- a/sos/policies/distros/redhat.py
+++ b/sos/policies/distros/redhat.py
@@ -19,6 +19,8 @@ from sos.presets.redhat import (RHEL_PRESETS, ATOMIC_PRESETS, RHV, RHEL,
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 _
@@ -57,8 +59,11 @@ class RedHatPolicy(LinuxPolicy):
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]
diff --git a/sos/policies/package_managers/flatpak.py b/sos/policies/package_managers/flatpak.py
new file mode 100644
index 00000000..7e171aa5
--- /dev/null
+++ b/sos/policies/package_managers/flatpak.py
@@ -0,0 +1,30 @@
+# Copyright 2023 Red Hat, Inc. Jose Castillo <jcastillo@redhat.com>
+
+# 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 :