Bug 2103470 - dnf --setopt=includepkgs does not work
Summary: dnf --setopt=includepkgs does not work
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 36
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: rpm-software-management
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-07-03 16:21 UTC by Todd
Modified: 2022-08-02 08:32 UTC (History)
9 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2022-08-02 08:32:21 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.