Bug 947258

Summary: dnf doesn't erase excluded packages
Product: [Fedora] Fedora Reporter: Cristian Ciupitu <cristian.ciupitu>
Component: dnfAssignee: Ales Kozumplik <akozumpl>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 18CC: akozumpl, jzeleny
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: dnf-0.3.2 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-04-03 13:42:50 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
cobbler-2.3.1-1.fc18.noarch.rpm
none
koan-2.3.1-1.fc18.noarch.rpm none

Description Cristian Ciupitu 2013-04-02 00:18:17 UTC
Description of problem:
dnf fails to erase two installed packages, while yum has no problem.

Version-Release number of selected component (if applicable):
dnf-0.2.22-1.git97180b8.fc18.noarch.rpm
hawkey-0.3.8-1.git046ab1c.fc18.x86_64.rpm

How reproducible:
Every time

Steps to Reproduce:
1. Make /etc/dnf/dnf.conf look like this:
[main]
keepcache=1
debuglevel=2
exactarch=1
obsoletes=1
gpgcheck=1
plugins=0
installonly_limit=3
multilib_policy=best
clean_requirements_on_remove=true

exclude=cobbler,koan

2. Install some locally built RPMs, cobbler and koan in my case

3. Try to erase them:
dnf erase cobbler koan
  
Actual results:
Setting up Remove Process
No Packages marked for removal

Expected results:
The packages should be removed

Additional info:
[root@hermes ~]# cat /etc/yum.conf 
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=1
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=3

exclude=cobbler,koan

[root@hermes ~]# yum erase cobbler koan
Loaded plugins: auto-update-debuginfo, fastestmirror, presto, priorities,
              : protectbase
Resolving Dependencies
--> Running transaction check
---> Package cobbler.noarch 0:2.3.1-1.fc18 will be erased
---> Package koan.noarch 0:2.3.1-1.fc18 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package         Arch           Version                 Repository         Size
================================================================================
Removing:
 cobbler         noarch         2.3.1-1.fc18            installed         2.3 M
 koan            noarch         2.3.1-1.fc18            installed         378 k

Transaction Summary
================================================================================
Remove  2 Packages

Installed size: 2.7 M
Is this ok [y/N]:

Comment 1 Ales Kozumplik 2013-04-02 06:50:56 UTC
Hmmm, odd. Can you attach the two packages to thiz bugzilla please?

You installed these two packages with 'dnf install kobbler.. .rpm coan.. .rpm', yes?

Comment 2 Cristian Ciupitu 2013-04-02 11:03:34 UTC
I might have installed those packages with yum, but I've retested everything with dnf at your request.

[root@hermes ~]# dnf install ~ciupicri/3rdparty-projects/cobbler/rpm-build/cobbler-2.3.1-1.fc18.noarch.rpm  ~ciupicri/3rdparty-projects/cobbler/rpm-build/koan-2.3.1-1.fc18.noarch.rpm 
Setting up Install Process
Resolving Dependencies
--> Starting dependency resolution
---> Package cobbler.noarch 2.3.1-1.fc18 will be installed
---> Package koan.noarch 2.3.1-1.fc18 will be installed
--> Finished dependency resolution

Dependencies Resolved

===============================================================================
 Package        Arch          Version                Repository           Size
===============================================================================
Installing:
 cobbler        noarch        2.3.1-1.fc18           @commandline        596 k
 koan           noarch        2.3.1-1.fc18           @commandline        177 k

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

Total size: 772 k
Installed size: 772 k
Is this ok [y/N]: y
Downloading Packages:
Running Transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
RPMDB altered outside of DNF.
  Installing : koan-2.3.1-1.fc18.noarch                                    1/2 
  Installing : cobbler-2.3.1-1.fc18.noarch                                 2/2 
  Verifying  : cobbler-2.3.1-1.fc18.noarch                                 1/2 
  Verifying  : koan-2.3.1-1.fc18.noarch                                    2/2 

Installed:
  cobbler.noarch 2.3.1-1.fc18             koan.noarch 2.3.1-1.fc18            

Complete!
[root@hermes ~]# dnf erase cobbler koan
Setting up Remove Process
No Packages marked for removal

Comment 3 Cristian Ciupitu 2013-04-02 11:04:42 UTC
Created attachment 730686 [details]
cobbler-2.3.1-1.fc18.noarch.rpm

Comment 4 Cristian Ciupitu 2013-04-02 11:05:13 UTC
Created attachment 730687 [details]
koan-2.3.1-1.fc18.noarch.rpm

Comment 5 Cristian Ciupitu 2013-04-02 11:28:46 UTC
If I temporary disable "exclude=cobbler,koan", dnf asks me if I want to remove those packages.

Comment 6 Ales Kozumplik 2013-04-03 13:42:50 UTC
As we found out on IRC yesterday, this is because DNF extends the semantics of excludes to all operations, erase included (unlike yum where excludes only apply to installs and upgrades). This is documented in commit c2ec957, dnf-0.3.2:

http://akozumpl.github.com/dnf/cli_vs_yum.html#excludes-and-repo-excludes-apply-to-all-operations

While at it I found out that --disableexcludes and more granular per-repo excludes don't work in DNF at all. This is addressed by commit 5cb7f5e.

Thanks again for the report.