From 0905f1a1c6bc5373e2fedc8e31d9fe4722ef7212 Mon Sep 17 00:00:00 2001 From: wangqing Date: Tue, 12 Oct 2021 13:40:05 +0800 Subject: [PATCH] fix sosreport exec failed --- UnionTech-add-UnionTech-policy.patch | 48 ++++++++++++++++++++++++++++ add-uniontech-os-support.patch | 45 -------------------------- openEuler-add-openEuler-policy.patch | 2 +- sos.spec | 7 ++-- 4 files changed, 54 insertions(+), 48 deletions(-) create mode 100644 UnionTech-add-UnionTech-policy.patch delete mode 100644 add-uniontech-os-support.patch diff --git a/UnionTech-add-UnionTech-policy.patch b/UnionTech-add-UnionTech-policy.patch new file mode 100644 index 0000000..e9c7852 --- /dev/null +++ b/UnionTech-add-UnionTech-policy.patch @@ -0,0 +1,48 @@ +From ddede462f885e6a5826cefad49fbb6815436a593 Mon Sep 17 00:00:00 2001 +From: panchenbo +Date: Tue, 25 May 2021 11:22:56 +0800 +Subject: [PATCH] add UnionTech policy + +--- + sos/policies/UnionTech.py | 29 +++++++++++++++++++++++++++++ + 1 file changed, 29 insertions(+) + create mode 100644 sos/policies/UnionTech.py + +diff --git a/sos/policies/UnionTech.py b/sos/policies/UnionTech.py +new file mode 100644 +index 0000000..7fbd42c +--- /dev/null ++++ b/sos/policies/UnionTech.py +@@ -0,0 +1,29 @@ ++from __future__ import print_function ++ ++from sos.plugins import RedHatPlugin ++from sos.policies.redhat import RedHatPolicy, OS_RELEASE ++import os ++ ++class UnionTechPolicy(RedHatPolicy): ++ ++ distro = "UnionTech" ++ vendor = "the UnionTech Project" ++ vendor_url = "https://www.chinauos.com/" ++ ++ def __init__(self, sysroot=None): ++ super(UnionTechPolicy, self).__init__(sysroot=sysroot) ++ ++ @classmethod ++ def check(cls): ++ """This method checks to see if we are running on UnionTechOS. It returns ++ True or False.""" ++ try: ++ with open("/etc/UnionTech-release", "r") as f: ++ return "uos" in f.read() ++ except IOError: ++ return False ++ ++ def UnionTech_version(self): ++ pkg = self.pkg_by_name("UnionTech-release") or \ ++ self.all_pkgs_by_name_regex("UnionTech-release-.*")[-1] ++ return int(pkg["version"]) +-- +2.20.1 + diff --git a/add-uniontech-os-support.patch b/add-uniontech-os-support.patch deleted file mode 100644 index c865c31..0000000 --- a/add-uniontech-os-support.patch +++ /dev/null @@ -1,45 +0,0 @@ -From dcb9273e1f5f55fec2957629a5a69ca396f28c51 Mon Sep 17 00:00:00 2001 -From: root -Date: Mon, 19 Jul 2021 15:48:03 +0800 -Subject: [PATCH] add uniontech os support - ---- - sos/policies/uniontech.py | 26 ++++++++++++++++++++++++++ - 1 file changed, 26 insertions(+) - create mode 100644 sos/policies/uniontech.py - -diff --git a/sos/policies/uniontech.py b/sos/policies/uniontech.py -new file mode 100644 -index 0000000..cd30136 ---- /dev/null -+++ b/sos/policies/uniontech.py -@@ -0,0 +1,26 @@ -+from __future__ import print_function -+ -+from sos.plugins import RedHatPlugin -+from sos.policies.redhat import RedHatPolicy, OS_RELEASE -+import os -+ -+class UnionTechPolicy(RedHatPolicy): -+ -+ distro = "UnionTech" -+ vendor = "the UnionTech Project" -+ vendor_url = "https://www.chinauos.com/" -+ -+ def __init__(self, sysroot=None): -+ super(UnionTechPolicy, self).__init__(sysroot=sysroot) -+ -+ @classmethod -+ def check(cls): -+ if not os.path.exists(OS_RELEASE): -+ return False -+ -+ with open(OS_RELEASE, 'r') as f: -+ for line in f: -+ if line.startswith('NAME'): -+ if 'UnionTech' in line: -+ return True -+ return False --- -2.23.0 - diff --git a/openEuler-add-openEuler-policy.patch b/openEuler-add-openEuler-policy.patch index a102f64..bb22f7e 100644 --- a/openEuler-add-openEuler-policy.patch +++ b/openEuler-add-openEuler-policy.patch @@ -17,7 +17,7 @@ index 0000000..ea65ba2 @@ -0,0 +1,30 @@ +from __future__ import print_function + -+from sos.report.plugins import RedHatPlugin ++from sos.plugins import RedHatPlugin +from sos.policies.redhat import RedHatPolicy, OS_RELEASE +import os + diff --git a/sos.spec b/sos.spec index b7ebdc7..ad2f972 100644 --- a/sos.spec +++ b/sos.spec @@ -2,14 +2,14 @@ Name: sos Version: 3.8 -Release: 1 +Release: 2 Summary: A set of tools to gather troubleshooting information from a system License: GPLv2+ URL: https://github.com/sosreport/sos Source0: https://github.com/sosreport/sos/archive/%{version}/%{name}-%{version}.tar.gz Patch9000: openEuler-add-openEuler-policy.patch -Patch9001: add-uniontech-os-support.patch +Patch9001: UnionTech-add-UnionTech-policy.patch BuildRequires: python3-devel gettext python3-six Requires: libxml2-python3 xz python3-rpm tar bzip2 python3-six @@ -47,6 +47,9 @@ install -Dm644 %{name}.conf %{buildroot}%{_sysconfdir}/%{name}.conf %{_mandir}/man5/* %changelog +* Tue Oct 12 2021 wangqing - 3.8-2 +- fix sosreport exec failed + * Tue Sep 14 2021 baizhonggui - 3.8-1 - Update to 3.8