Bug 1438304

Summary: DNF queries with filter on `provides=` don't work on most arches
Product: [Fedora] Fedora Reporter: Stephen Gallagher <sgallagh>
Component: dnfAssignee: rpm-software-management
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 26CC: jmracek, mmathesi, packaging-team-maint, psabata, rpm-software-management, vmukhame
Target Milestone: ---Keywords: 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: 2017-08-31 13:20:40 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
Simple reproducer none

Description Stephen Gallagher 2017-04-03 00:52:07 UTC
Created attachment 1268309 [details]
Simple reproducer

Description of problem:
When using the DNF API, calling a filter query on a sack of repositories when using `provides=` as a chosen filter gives back no results on any architecture except 

Version-Release number of selected component (if applicable):
dnf-2.2.0-1.fc26.noarch

How reproducible:
Every time


Steps to Reproduce:
1. Execute attached reproducer script
2.
3.

Actual results:
Any attempt to look up by `provides=` in a filter will fail unless the architecture in question is 'x86_64'

Expected results:
The `provides=` filters should return the appropriate values on all architectures.

Additional info:
This is blocking the Base Runtime effort because we cannot use our scripts to generate dependency lists for non-x86_64 architectures.

Comment 1 Igor Gnatenko 2017-04-03 06:00:35 UTC
https://github.com/rpm-software-management/libdnf/pull/200

Basically, you get such result because solver uses your system repo and all other packages are in incompatible arches.

Try to create dnf.Sack with all_arch=True (not sure if it will be properly propagated you hawkey.Sack, but try it ;)

Comment 2 Stephen Gallagher 2017-04-03 13:58:09 UTC
It turns out I can override this auto-detection and convince DNF to think I am running on other architectures with the following code:

    # Create custom configuration to specify the architecture
    config = dnf.conf.Conf()
    subst = dnf.conf.substitutions.Substitutions()
    subst['arch'] = arch
    subst['basearch'] = dnf.rpm.basearch(arch)
    config.substitutions = subst

    base = dnf.Base(conf=config)


That said, I think it would still be beneficial to have such an option available as part of the dnf.Base() constructor. Or at minimum, the documentation should inform the consumer that it is only expected to work with the host system's architecture (plus its multiarch and noarch pieces).

Comment 3 Jaroslav Mracek 2017-08-31 13:20:40 UTC
I think the problem was solved by new conf options basearch, and arch that were introduced in dnf-2.6.3-1 . Please if it is still not working like you expect, please don't hesitate to reopen the bug report.