rpm-software-management / dnf

Package manager based on libdnf and libsolv. Replaces YUM.
GNU General Public License v2.0
1.21k stars 405 forks source link

dnf behaves differently depending on installing local rpm or from repo #2087

Open brianjmurrell opened 2 months ago

brianjmurrell commented 2 months ago

I am finding an odd situation in Fedora 39's DNF. It seems it behaves differently with regard to Obsoletes: and Conflicts: based on whether the RPM is installed from a repo or from a local file (with the repo still enabled). Observe:

First from the repo:

$ sudo dnf --refresh install python3-hass-nabucasa
…
Dependencies resolved.
=============================================================================================================================================================
 Package                             Architecture     Version                     Repository                                                            Size
=============================================================================================================================================================
Installing:
 python3-hass-nabucasa               noarch           0.78.0-0.01                 copr:copr.fedorainfracloud.org:brianjmurrell:homeassistant           119 k
Installing dependencies:
 python3-acme                        noarch           2.8.0-1.fc39                copr:copr.fedorainfracloud.org:brianjmurrell:homeassistant           197 k
 python3-async-timeout               noarch           4.0.2-9.fc39                fedora                                                                19 k
 python3-boto3                       noarch           1.34.47-1.fc39              updates-home                                                         366 k
 python3-botocore                    noarch           1.34.47-1.fc39              updates-home                                                         7.0 M
 python3-envs                        noarch           1.4-0.01                    copr:copr.fedorainfracloud.org:brianjmurrell:homeassistant            29 k
 python3-jose                        noarch           3.3.0-24.fc39               fedora                                                                85 k
 python3-jose+cryptography           noarch           3.3.0-24.fc39               fedora                                                                10 k
 python3-josepy                      noarch           1.13.0-6.fc39               fedora                                                                82 k
 python3-pycognito                   noarch           2023.5.0-0.01               copr:copr.fedorainfracloud.org:brianjmurrell:homeassistant            49 k
 python3-pyrfc3339                   noarch           1.1-16.fc39                 fedora                                                                19 k
 python3-s3transfer                  noarch           0.10.1-1.fc39               updates-home                                                         152 k
 python3-snitun                      noarch           0.36.2-0.01                 copr:copr.fedorainfracloud.org:brianjmurrell:homeassistant            78 k
Installing weak dependencies:
 python-josepy-doc                   noarch           1.13.0-6.fc39               fedora                                                                19 k

Transaction Summary
=============================================================================================================================================================
Install  14 Packages

Total download size: 8.1 M
Installed size: 94 M

Yet, when the exact same RPM is downloaded locally and installation is attempted:

$ sudo dnf install ~/Downloads/python3-hass-nabucasa-0.78.0-0.01.noarch.rpm 
…
Last metadata expiration check: 0:00:40 ago on Wed 24 Apr 2024 06:26:26 AM EDT.
Dependencies resolved.
=============================================================================================================================================================
 Package                             Architecture     Version                     Repository                                                            Size
=============================================================================================================================================================
Installing:
 python3-hass-nabucasa               noarch           0.78.0-0.01                 @commandline                                                         376 k
     replacing  python3-homeassistant.noarch 2024.3.0-1.fc39
Installing dependencies:
 python3-acme                        noarch           2.8.0-1.fc39                copr:copr.fedorainfracloud.org:brianjmurrell:homeassistant           197 k
 python3-async-timeout               noarch           4.0.2-9.fc39                fedora                                                                19 k
 python3-boto3                       noarch           1.34.47-1.fc39              updates-home                                                         366 k
 python3-botocore                    noarch           1.34.47-1.fc39              updates-home                                                         7.0 M
 python3-envs                        noarch           1.4-0.01                    copr:copr.fedorainfracloud.org:brianjmurrell:homeassistant            29 k
 python3-jose                        noarch           3.3.0-24.fc39               fedora                                                                85 k
 python3-jose+cryptography           noarch           3.3.0-24.fc39               fedora                                                                10 k
 python3-josepy                      noarch           1.13.0-6.fc39               fedora                                                                82 k
 python3-pycognito                   noarch           2023.5.0-0.01               copr:copr.fedorainfracloud.org:brianjmurrell:homeassistant            49 k
 python3-pyrfc3339                   noarch           1.1-16.fc39                 fedora                                                                19 k
 python3-s3transfer                  noarch           0.10.1-1.fc39               updates-home                                                         152 k
 python3-snitun                      noarch           0.36.2-0.01                 copr:copr.fedorainfracloud.org:brianjmurrell:homeassistant            78 k
Installing weak dependencies:
 python-josepy-doc                   noarch           1.13.0-6.fc39               fedora                                                                19 k

Transaction Summary
=============================================================================================================================================================
Install  14 Packages

Total size: 8.4 M
Total download size: 8.0 M

As you can see, when installed from a local file, DNF properly makes python3-hass-nabucasa replace python3-homeassistant but when installing the exact same RPM from the repo, it does not have python3-hass-nabucasa replace python3-homeassistant .

The repo in question here is https://copr.fedorainfracloud.org/coprs/brianjmurrell/homeassistant/.

m-blaha commented 2 months ago

Are they really the same package (not only same NEVRA)? For me both variants behave the same - not obsoleting python3-homeassistant.

Which is I think correct:

# dnf repoquery python3-hass-nabucasa
python3-hass-nabucasa-0:0.78.0-0.01.noarch

# dnf repoquery --obsoletes python3-hass-nabucasa
python3-homeassistant <= 2024.3.0

# rpm -q python3-homeassistant
python3-homeassistant-2024.3.0-1.fc39.noarch

So the installed version of python3-homeassistant is bigger than the obsoleted, thus nothing is obsoleted.

brianjmurrell commented 2 months ago

Are they really the same package (not only same NEVRA)?

They are the same as far as I would understand. I downloaded it from https://download.copr.fedorainfracloud.org/results/brianjmurrell/homeassistant/fedora-39-x86_64/07340075-python-hass-nabucasa/python3-hass-nabucasa-0.78.0-0.01.noarch.rpm

For me both variants behave the same - not obsoleting python3-homeassistant.

Interesting. What else could be different between our reproductions then?

Which is I think correct:

# dnf repoquery python3-hass-nabucasa
python3-hass-nabucasa-0:0.78.0-0.01.noarch

# dnf repoquery --obsoletes python3-hass-nabucasa
python3-homeassistant <= 2024.3.0

So this would mean that if python3-homeassistant-2024.3.0-1.fc39 were installed, that Obsoletes: should replace it right? That version is <= 2024.3.0 isn't it?

# rpm -q python3-homeassistant
python3-homeassistant-2024.3.0-1.fc39.noarch

So the installed version of python3-homeassistant is bigger than the obsoleted, thus nothing is obsoleted.

How do you figure it's bigger? 2024.3.0 is <= 2024.3.0 isn't it? Or is the -1 release also being factored into this comparison and what I really need is:

Obsoletes: <= 2024.3.0-1

?

m-blaha commented 2 months ago

Yes, it's not only version, but the whole EVR - see https://docs.fedoraproject.org/en-US/packaging-guidelines/#renaming-or-replacing-existing-packages The Obsoletes is often used with < operator, so that you don't need to worry about release number, e.g.:

Obsoletes: python3-homeassistant < 2024.4.0
m-blaha commented 2 months ago

Regarding my attempt to reproduce the issue, this is what I did:

$ podman run --rm -ti  registry.fedoraproject.org/fedora:39 bash
# dnf install dnf-plugins-core -y
# dnf copr enable brianjmurrell/homeassistant -y
# dnf install python3-homeassistant-0:2024.3.0-1.fc39.noarch -y
# dnf download python3-hass-nabucasa

and then the test:

# dnf install python3-hass-nabucasa

and

# dnf install ./python3-hass-nabucasa-0.78.0-0.01.noarch.rpm
m-blaha commented 2 months ago

And one small note - do not forget about the dist tag (.fc39) - your current version used for obsoletes is 2024.3.0-1.fc39.