how to invalidate obsoletes dependency during update

200 views Asked by At

In my linux machine, I have release-1 installed which contains a rpm foo-1.0.

foo-1.0 has obsoletes dependency with bar.

# rpm -q  --obsoletes base/foo-1.0-0.x86_64.rpm
bar

Now I'm trying to update to release-2.

In release-2, foo-2.0 has removed obsoletes dependency with bar.

# rpm -q  --obsoletes update/foo-2.0-0.x86_64.rpm
# 

release-2 also adds new rpm bar-2.0.

The release wise updates are handled via ansible dnf module which sets update_only: false i.e it installs new packages as well as updates packages in same transaction. For demonstration, I am using dnf command directly.

Update to release-2 rpms is failing:

# dnf --verbose install --best foo bar
Loaded plugins: builddep, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, leaves, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync, show-leaves, versionlock
DNF version: 4.0.9
cachedir: /var/cache/dnf
repo: using cache for: My_Base
not found other for: repo location
not found modules for: repo location
not found deltainfo for: repo location
not found updateinfo for: repo location
My_Base: using metadata from Tue 04 Apr 2023 03:38:38 PM IST.
repo: using cache for: My_Update
not found other for: repo location
not found modules for: repo location
not found deltainfo for: repo location
not found updateinfo for: repo location
My_Update: using metadata from Tue 04 Apr 2023 03:39:34 PM IST.
Last metadata expiration check: 0:12:35 ago on Tue 04 Apr 2023 03:39:44 PM IST.
No module defaults found
Completion plugin: Generating completion cache...
Package foo-1.0-0.x86_64 is already installed.
Package foo-1.0-0.x86_64 is already installed.
--> Starting dependency resolution
--> Finished dependency resolution
Error:
 Problem: cannot install both foo-2.0-0.x86_64 and foo-1.0-0.x86_64
  - cannot install the best candidate for the job
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages)

I was expecting update to work, as later version of foo which removes the obsoletes dependency is also part of same transaction.

How can this be handled? Could any dnf option or changes in dependency in rpm.spec of release-2 rpms can help? I want foo-2.0 and bar-2.0 to be updated in a single dnf transaction.

[Edit] dnf update command cannot be used, as it will not install new packages i.e bar will not be installed. To install new package and update existing packages dnf install --best has to be used.

# dnf --verbose update --best foo bar
Loaded plugins: builddep, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, leaves, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync, show-leaves, versionlock
DNF version: 4.0.9
cachedir: /var/cache/dnf
repo: downloading from remote: My_Base
repo location                                                                                                                      629 kB/s | 849  B     00:00
not found other for: repo location
not found modules for: repo location
not found deltainfo for: repo location
not found updateinfo for: repo location
My_Base: using metadata from Wed 05 Apr 2023 10:57:49 AM IST.
repo: downloading from remote: My_Update
repo location                                                                                                                      789 kB/s | 997  B     00:00
not found other for: repo location
not found modules for: repo location
not found deltainfo for: repo location
not found updateinfo for: repo location
My_Update: using metadata from Wed 05 Apr 2023 10:58:11 AM IST.
No module defaults found
Completion plugin: Generating completion cache...
Package bar available, but not installed.
No match for argument: bar
--> Starting dependency resolution
---> Package foo.x86_64 1.0-0 will be upgraded
---> Package foo.x86_64 2.0-0 will be an upgrade
--> Finished dependency resolution
Dependencies resolved.
===================================================================================================================================================================
 Package                             Arch                                   Version                                Repository                                 Size
===================================================================================================================================================================
Upgrading:
 foo                                 x86_64                                 2.0-0                                  My_Update                                 6.0 k

Transaction Summary
===================================================================================================================================================================
Upgrade  1 Package

/usr/lib/python3.9/site-packages/dnf/package.py:57: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
  return super(Package, self).chksum

Total size: 6.0 k
Is this ok [y/N]:

0

There are 0 answers