diff --git a/0001-hoperun-openeuler-sos-policy.patch b/0001-hoperun-openeuler-sos-policy.patch new file mode 100644 index 0000000000000000000000000000000000000000..64c436e456af5379643516f106c7669d3fc378a9 --- /dev/null +++ b/0001-hoperun-openeuler-sos-policy.patch @@ -0,0 +1,55 @@ +From 96ac9e7f7c2502f64f7ebae77fbca18ce2b6fdb9 Mon Sep 17 00:00:00 2001 +From: jeff200902 +Date: Mon, 13 Jul 2020 09:52:11 +0000 +Subject: [PATCH] hoperun-openeuler-sos-policy + +--- + sos/policies/openEuler.py | 36 ++++++++++++++++++++++++++++++++++++ + 1 file changed, 36 insertions(+) + create mode 100644 sos/policies/openEuler.py + +diff --git a/sos/policies/openEuler.py b/sos/policies/openEuler.py +new file mode 100644 +index 0000000..de58f92 +--- /dev/null ++++ b/sos/policies/openEuler.py +@@ -0,0 +1,36 @@ ++# Copyright (C) Huawei, Inc. 2020 ++ ++# 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. ++ ++# This enables the use of with syntax in python 2.5 (e.g. jython) ++from __future__ import print_function ++ ++from sos.policies.redhat import RedHatPolicy, OS_RELEASE ++import os ++ ++ ++class OpenEulerPolicy(RedHatPolicy): ++ ++ distro = "OpenEuler" ++ vendor = "the openEuler Project" ++ vendor_url = "https://openeuler.org/" ++ ++ def __init__(self, sysroot=None): ++ super(OpenEulerPolicy, self).__init__(sysroot=sysroot) ++ ++ @classmethod ++ def check(cls): ++ """This method checks to see if we are running on OpenEuler. It returns ++ True or False.""" ++ return os.path.isfile('/etc/openEuler-release') ++ ++ def openEuler_version(self): ++ pkg = self.pkg_by_name("openEuler-release") or \ ++ self.all_pkgs_by_name_regex("openEuler-release-.*")[-1] ++ return int(pkg["version"]) +-- +2.23.0 + diff --git a/sos.spec b/sos.spec index df610ae062c98b96eef91c4f065c9b26e0179909..98f2c64dbbe29ecea2388cf62f5e3de3f8f6d569 100644 --- a/sos.spec +++ b/sos.spec @@ -2,11 +2,12 @@ Name: sos Version: 3.9.1 -Release: 2 +Release: 3 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}.tar.gz +Patch0000: 0001-hoperun-openeuler-sos-policy.patch BuildRequires: python3-devel gettext python3-six Requires: libxml2-python3 bzip2 xz python3-six Conflicts: vdsm <= 4.30.17 @@ -44,6 +45,9 @@ install -Dm644 %{name}.conf %{buildroot}%{_sysconfdir}/%{name}.conf %{_mandir}/man5/sos.conf.5.gz %changelog +* Mon Jul 13 2020 Jeffery.Gao - 3.9.1-3 +- Append openEuler policy + * Mon Jun 1 2020 chengzihan - 3.9.1-2 - Package update