Bug 2103470

Summary: dnf --setopt=includepkgs does not work
Product: [Fedora] Fedora Reporter: Todd <ToddAndMargo>
Component: dnfAssignee: rpm-software-management
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 36CC: daniel.mach, jmracek, jrohel, mblaha, mhatina, packaging-team-maint, pkratoch, rpm-software-management, vmukhame
Target Milestone: ---Keywords: Reopened, Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-08-02 08:32:21 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:

Description Todd 2022-07-03 16:21:52 UTC
This may be a misunderstanding on my part.  If so, I do apologize for reporting it here.

Fedora 36
dnf-4.13.0-1.fc36.noarch

/etc/dnf/dnf.conf:
excludepkgs=wine*

# dnf --setopt=includepkgs=wine* whatprovides wine* 
Last metadata expiration check: 2:00:01 ago on Sun 03 Jul 2022 07:13:44 AM PDT.
Error: No matches found. If searching for a file, try specifying the full path or using a wildcard prefix ("*/") at the beginning.

$ man dnf:
--setopt=<option>=<value>
              Override a configuration option from the configuration file.
              To override configuration options for repositories, use  re‐
              poid.option  for  the <option>. Values for configuration op‐
              tions like excludepkgs, includepkgs, installonlypkgs and ts‐
              flags  are appended to the original value, they do not over‐
              ride it. However, specifying  an  empty  value  (e.g.  --se‐
              topt=tsflags=) will clear the option.

Comment 1 Pavla Kratochvilova 2022-07-04 10:55:16 UTC
Hi, in case of the includepkgs option, dnf doesn't override the excludepkgs option but instead will exclude any package that doesn't match this list. See the dnf.conf man page for more information and an example of use.

In your case, you can use the --disableexcludes command line switch.

Comment 2 Todd 2022-07-04 18:56:27 UTC
Hi Pavla,

Thank you for the help!

I could not get the --disableexcludes option to work,  But I did get the following to:

# dnf --setopt=excludepkgs="" whatprovides wine
# dnf --setopt=excludepkgs="" list wine


I do believe the wording of the manual page is poorly stated:


    "Override a configuration option from the configuration file. To override configuration 
    options for repositories, use  repoid.option  for  the <option>. Values for configuration
    options like excludepkgs ..."

This means that is will over ride my excludepkgs in my dnf.confg.  But that is not the case.

Perhaps we should change this bug report to a bug in the man page?

-T

Comment 3 Pavla Kratochvilova 2022-07-07 08:14:05 UTC
Oh, sorry, I just noticed that the --disableexcludes option takes a repoid as an argument. However, you can use --disableexcludes=all for it to apply to all configurations of excludes, not just for specific repository.

As for the --setopt option, I believe the documentation is correct:
"Values for configuration options like excludepkgs, includepkgs, installonlypkgs and tsflags are appended to the original value, they do not override it. However, specifying an empty value (e.g. --setopt=tsflags=) will clear the option."

Just note that for example, --setopt=excludepkgs="" overrides the excludepkgs option, but has no effect on the includepkgs and vice versa.