File sos.spec of Package sos
#
# spec file for package sos
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%if 0%{?suse_version} < 1600
%define pythons python311
%else
%define pythons python3
%endif
Name: sos
Version: 4.10.1
Release: 0
Summary: A unified tool for collecting system logs and other debug information
License: GPL-2.0-only
Group: System/Base
URL: https://github.com/sosreport/sos
Source0: https://github.com/sosreport/sos/archive/%{version}/%{name}-%{version}.tar.gz
BuildRequires: fdupes
BuildRequires: gettext
%if 0%{?suse_version} == 1600
BuildRequires: Leap-release
%else
BuildRequires: openSUSE-release
%endif
BuildRequires: %{python_module base >= 3.11}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module Sphinx >= 1.3.5}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module wheel}
#/SECTION not need for build, but need for test if exist
BuildRequires: %{python_module python-magic >= 0.4.20}
#/SECTION
Requires: bzip2
Requires: %{python_flavor}-pexpect >= 4.0.0
Requires: %{python_flavor}-packaging
Requires: %{python_flavor}-requests
Requires: %{python_flavor}-rpm
Requires: tar
Requires: xz
Recommends: %{python_flavor}-boto3
Recommends: %{python_flavor}-python-magic >= 0.4.20
Recommends: %{python_flavor}-PyYAML
Obsoletes: sos-collector <= 1.9
Provides: sos-collector = %{version}
%python_subpackages
%description
Sos is an extensible, portable, support data collection tool primarily aimed at Linux distributions and other UNIX-like operating systems.
%prep
%setup -q
%build
%pyproject_wheel
%install
%pyproject_install
install -d -m 755 %{buildroot}%{_sysconfdir}/%{name}
install -d -m 700 %{buildroot}%{_sysconfdir}/%{name}/cleaner
install -d -m 755 %{buildroot}%{_sysconfdir}/%{name}/presets.d
install -d -m 755 %{buildroot}%{_sysconfdir}/%{name}/groups.d
install -d -m 755 %{buildroot}%{_sysconfdir}/%{name}/extras.d
install -m 644 %{name}.conf %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
rm -rf %{buildroot}%{_prefix}/config/
rm -rf %{buildroot}/%{_datadir}/doc/%{name}
rm -rf %{buildroot}%{python_sitelib}/sos/report/*/__pycache__
rm -rf %{buildroot}%{python_sitelib}/sos/policies/*/__pycache__
rm -rf %{buildroot}%{python_sitelib}/sos/cleaner/*/__pycache__
sphinx-build -b html docs html
# Fix python-bytecode-inconsistent-mtime
pushd %{buildroot}%{python_sitelib}
find . -name '*.pyc' -exec rm -f '{}' ';'
python%python_bin_suffix -m compileall *.py ';'
popd
%fdupes %{buildroot}%{python_sitelib}
# internationalization is currently broken. Uncomment this line once fixed
#%%find_lang %%{name}
# internationalization is currently broken. Uncomment this line once fixed
#%%files -f %%{name}.lang
%files
%license LICENSE
%doc AUTHORS README.md html/
%dir %{_sysconfdir}/sos
%dir %{_sysconfdir}/sos/cleaner
%dir %{_sysconfdir}/sos/presets.d
%dir %{_sysconfdir}/sos/extras.d
%dir %{_sysconfdir}/sos/groups.d
%config(noreplace) %{_sysconfdir}/sos/sos.conf
%{_bindir}/sos
%{python_sitelib}/*
%{_mandir}/man1/*
%{_mandir}/man5/*
%changelog