Bug 1311246

Summary: RFE: Allow specification of both packages to install and remove in the same command.
Product: [Fedora] Fedora Reporter: Bruno Wolff III <bruno>
Component: dnfAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: bruno, jsilhan, mluscon, packaging-team-maint, pnemade, vmukhame
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-02-29 12:41:01 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Bruno Wolff III 2016-02-23 17:39:27 UTC
User-Agent:       
Build Identifier: 

Occasionally a package is replaced by another without proper obsoletes and it would be nice to be able to do the replacement without removing all of dependencies and then adding them back. python-mysql being replaced by python2-mysql is a current example. While that will probably eventually get fixed, it would be nice to coveniently do the switch now.

Reproducible: Always

Comment 1 Bruno Wolff III 2016-02-23 21:11:16 UTC
Here is an example using yum shell:

[root@wolff bruno]# yum-deprecated shell
Yum command has been deprecated, use dnf instead.
See 'man dnf' and 'man yum2dnf' for more information.

Loaded plugins: keys, langpacks, list-data, merge-conf, priorities,
              : protectbase, remove-with-leaves, upgrade-helper, verify,
              : versionlock
> erase python-mysql
> install python2-mysql
fedora-rawhide-kernel-nodebug                             | 2.9 kB  00:00     
local                                                     | 2.9 kB  00:00     
rawhide                                                   | 4.2 kB  00:00     
rpmfusion-free-rawhide                                    | 1.2 kB  00:00     
rpmfusion-nonfree-rawhide                                 | 1.2 kB  00:00     
(1/4): rawhide/i386/group_gz                              | 228 kB  00:00     
(2/4): local/24/i386/primary_db                           | 207 kB  00:00     
(3/4): fedora-rawhide-kernel-nodebug/i386/primary_db      | 206 kB  00:00     
(4/4): rawhide/i386/primary_db                            |  17 MB  00:01     
(1/2): rpmfusion-free-rawhide/i386/primary                | 188 kB  00:00     
(2/2): rpmfusion-nonfree-rawhide/i386/primary             |  59 kB  00:00     
rpmfusion-free-rawhide                                                415/415
rpmfusion-nonfree-rawhide                                             150/150
0 packages excluded due to repository protections
> run
--> Running transaction check
---> Package python-mysql.i686 0:1.3.7-3.fc24 will be erased
---> Package python2-mysql.i686 0:1.3.7-4.fc24 will be installed
--> Finished Dependency Resolution

==============================================================================
 Package              Arch        Version              Repository        Size
==============================================================================
Installing:
 python2-mysql        i686        1.3.7-4.fc24         rawhide           98 k
Removing:
 python-mysql         i686        1.3.7-3.fc24         installed        259 k

Transaction Summary
==============================================================================
Install  1 Package
Remove   1 Package

Total download size: 98 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction (shutdown inhibited)
Warning: RPMDB altered outside of yum.
  Installing : python2-mysql-1.3.7-4.fc24.i686                            1/2 
  Erasing    : python-mysql-1.3.7-3.fc24.i686                             2/2 
  Verifying  : python2-mysql-1.3.7-4.fc24.i686                            1/2 
  Verifying  : python-mysql-1.3.7-3.fc24.i686                             2/2 

Removed:
  python-mysql.i686 0:1.3.7-3.fc24                                            

Installed:
  python2-mysql.i686 0:1.3.7-4.fc24                                           

Finished Transaction
> Leaving Shell

Comment 2 Honza Silhan 2016-02-29 12:41:01 UTC
when the packaging is wrong as this you can erase the package `rpm -e --nodeps...`. During normal upgrade when obsoleting is right, everything should work.

Comment 3 Bruno Wolff III 2016-02-29 19:54:47 UTC
Incorrect obsoletes is not the only case where one might want to do this. This can also happen where there are alternative packages that conflict with each other.
So there is also no plan to provide the yum shell functionallity in dnf?