Bug 1299261 - dnf repoquery's --repo argument does not work
Summary: dnf repoquery's --repo argument does not work
Keywords:
Status: CLOSED DUPLICATE of bug 1260986
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf-plugins-core
Version: 22
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
Assignee: Packaging Maintenance Team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-01-17 23:22 UTC by Erik Johnson
Modified: 2016-01-19 15:10 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-01-19 15:10:52 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Erik Johnson 2016-01-17 23:22:43 UTC
Description of problem:

The release notes for 0.1.7 state that --repoid has been changed to --repo to make usage consistent (http://dnf-plugins-core.readthedocs.org/en/latest/release_notes.html?#id8)

However, using "--repo" results in an error while using the old (and now deprecated) "--repoid" works properly.


Version-Release number of selected component (if applicable):

At least the most recent version (as of now, 0.1.15) has this problem.


How reproducible:

100% of the time


Steps to Reproduce:

1. Run the following command:

dnf repoquery --quiet --repo=updates --queryformat='%{name} - %{repoid}' bash


Actual results:

usage: dnf [--allowerasing] [-b] [-C] [-c [config file]] [-d [debug level]]
           [--debugsolver] [--showduplicates] [-e ERRORLEVEL]
           [--rpmverbosity [debug level name]] [-q] [-v] [-y] [--assumeno]
           [--version] [--installroot [path]] [--enablerepo [repo]]
           [--disablerepo [repo]] [-x [package]] [--disableexcludes [repo]]
           [--repofrompath [repo,path]] [--noplugins] [--nogpgcheck]
           [--disableplugin [plugin]] [--color COLOR]
           [--releasever RELEASEVER] [--setopt SETOPTS] [--refresh] [-4] [-6]
           [--downloadonly] [-h]
Command line error: argument --repofrompath: bad format: updates


Expected results:

bash - updates


Additional info:

As mentioned above, using --repoid works properly:

% dnf repoquery --quiet --repoid=updates --queryformat='%{name} - %{repoid}' bash
bash - updates

Comment 1 Erik Johnson 2016-01-18 01:34:56 UTC
I've found the issue. This is getting caught up in dnf's own argument parsing before it ever reaches the repoquery plugin. I dug into the source code for argparse in the Python stdlib, and found this gem:

for option_string in self._option_string_actions:
    if option_string.startswith(option_prefix):
        action = self._option_string_actions[option_string]
        tup = action, option_string, explicit_arg
        result.append(tup)

(See https://hg.python.org/releases/2.7.11/file/tip/Lib/argparse.py#l2156)

So, what's happening is that the repoquery plugin has a "--repo" argument, but because of this loose matching in argparse.py, it is being matched to "--repofrompat" from dnf proper.

Comment 2 Honza Silhan 2016-01-19 15:10:52 UTC

*** This bug has been marked as a duplicate of bug 1260986 ***


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