sosreport / sos

A unified tool for collecting system logs and other debug information
http://sos.rtfd.org
GNU General Public License v2.0
507 stars 543 forks source link

sos spec file needs to remove python3-magic file under RH9 release #3702

Open apalakun opened 2 months ago

apalakun commented 2 months ago

Needs to remove python3-magic file recommended entry from sos.spec file under RH9 as the file is deprecated or renamed to python3-file-magic. Needs to modify the same by replacing with python3-file-magic.

diff --git a/sos.spec b/sos.spec index 77c2953..256c77a 100644 --- a/sos.spec +++ b/sos.spec @@ -5,7 +5,7 @@ Summary: A set of tools to gather troubleshooting information from a system Name: sos Version: 4.7.1 -Release: 3.0.1%{?dist} +Release: 3.0.2%{?dist} Group: Applications/System Source0: https://github.com/sosreport/sos/archive/%{version}/sos-%{version}.tar.gz Source1: sos-audit-%{auditversion}.tgz @@ -43,6 +43,7 @@ BuildRequires: gettext BuildRequires: python3-setuptools Requires: python3-requests Requires: python3-setuptools +Requires: python3-file-magic Recommends: python3-magic Recommends: python3-pexpect Recommends: python3-pyyaml @@ -156,6 +157,9 @@ of the system. Currently storage and filesystem commands are audited.

jcastill commented 2 months ago

@pmoravec thoughts on this? We moved python3-magic to a soft requirement via your 4245de0b978a4d28bb8c833c2f2f5a15a260bd22 so I'm not sure if this change is worth it.

Also, RHEL 9 gets python3-file-magic anyway when installing sos:

dnf install sos
Updating Subscription Management repositories.
Last metadata expiration check: 0:17:54 ago on Tue 16 Jul 2024 09:05:24 BST.
Dependencies resolved.
====================================================================================================
 Package                                     Architecture                    Version                                 Repository                                                 Size
====================================================================================================
Installing:
 sos                                         noarch                          4.7.1-3.el9                             rhel-9-for-x86_64-baseos-rpms                             1.1 M
Installing weak dependencies:
 python3-file-magic                          noarch                          5.39-14.el9                             rhel-9-for-x86_64-appstream-rpms                           20 k

Transaction Summary
====================================================================================================
Install  2 Packages

`

So I'm not sure if this change is needed.

ryan-mccabe commented 2 months ago

Even if adding the explicit dep is not needed, the Recommends: line could either be updated to reflect the new package name or removed entirely.

jcastill commented 2 months ago

We could do that, so it's not against https://github.com/sosreport/sos/commit/4245de0b978a4d28bb8c833c2f2f5a15a260bd22 . @apalakun will you create the PR, or should I?

pmoravec commented 2 months ago

python3-file-magic package does provide/fulfill the Recommendation:

# rpm -q --provides python3-file-magic
python-file-magic = 5.39-14.el9
python3-file-magic = 5.39-14.el9
python3-magic = 5.39-14.el9
python3.9-file-magic = 5.39-14.el9
python3.9dist(file-magic) = 0.4
python3dist(file-magic) = 0.4
#

And that is also why installing sos on RHEL9 does install python3-file-magic as well, by default: the weak dependency of Recommends: python3-magic is enforced by default dnf behaviour, and the dependency is fulfilled by the python3-file-magic.

So until python3-file-magic stops providing python3-magic capability, I think we don't need that change (for RHEL9, but I think other versions and other distros are same here).

Or is the concern "a hard dependency is needed, not weak"..? Our aim is to have as few hard dependencies as possible, to let sos be installable on as many systems as possible.

apalakun commented 2 months ago

python3-file-magic package does provide/fulfill the Recommendation:

# rpm -q --provides python3-file-magic
python-file-magic = 5.39-14.el9
python3-file-magic = 5.39-14.el9
python3-magic = 5.39-14.el9
python3.9-file-magic = 5.39-14.el9
python3.9dist(file-magic) = 0.4
python3dist(file-magic) = 0.4
#

And that is also why installing sos on RHEL9 does install python3-file-magic as well, by default: the weak dependency of Recommends: python3-magic is enforced by default dnf behaviour, and the dependency is fulfilled by the python3-file-magic.

So until python3-file-magic stops providing python3-magic capability, I think we don't need that change (for RHEL9, but I think other versions and other distros are same here).

Or is the concern "a hard dependency is needed, not weak"..? Our aim is to have as few hard dependencies as possible, to let sos be installable on as many systems as possible.

I think its not whether python3-file-magic supports or provides python3-magic capability. If we use magic module , and in spec if its 'Recommended' the installation of the sos package will proceed without errors and will only when we run the command. we need to make sure that the installation fails on dependency, which is by using 'Requires'.

rpm -ivh /sos/RPMS/noarch/sos-4.7.x.rpm

error: Failed dependencies: python3-magic is needed by sos-4.7.x.noarch

apalakun commented 2 months ago

We could do that, so it's not against 4245de0 . @apalakun will you create the PR, or should I?

Please proceed raising PR

pmoravec commented 2 months ago

This is interesting - I have different experience:

# rpm -qa | grep -e magic -e expect -e pyyaml
# rpm -ivh /root/rpmbuild/RPMS/noarch/sos-4.7.1-3.el9.noarch.rpm
error: Failed dependencies:
        python3.9dist(pexpect) is needed by sos-4.7.1-3.el9.noarch
    python3.9dist(pyyaml) is needed by sos-4.7.1-3.el9.noarch
# dnf install python3-pexpect python3-pyyaml -y > /dev/null 2>&1
# rpm -ivh /root/rpmbuild/RPMS/noarch/sos-4.7.1-3.el9.noarch.rpm
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:sos-4.7.1-3.el9                  ################################# [100%]
# rpm -qa | grep -e magic -e expect -e pyyaml
python3-pexpect-4.8.0-7.el9.noarch
python3-pyyaml-5.4.1-6.el9.x86_64
# 

I.e. when having neither:

Recommends: python3-magic
Recommends: python3-pexpect
Recommends: python3-pyyaml

satisfied, installing sos fails on pyexpect and pyyaml. But missing magic does not matter for me. But imho the weak dependency should not be strictly required by rpm at all.

We should check with some rpm devels for the difference in rpm behaviour..?

jcastill commented 2 months ago

I've raised a draft PR to change the recommend for now. @apalakun would it be ok if I add you as co-author in the commit?

apalakun commented 2 months ago

I've raised a draft PR to change the recommend for now. @apalakun would it be ok if I add you as co-author in the commit?

Sure, thanks